Refactor cc scrollbar layers architecture.
This CL separates the solid-color scrollbar functionality into its own class structure, resulting in the following hierarchy:
ScrollbarLayerInterface (pure-virtual)
|
-------- PaintedScrollbarLayer (for outer-viewport)
|
--------- SolidColorScrollbarLayer (for inner-viewport)
(Android, pinch-zoom)
ScrollbarLayerImplBase
|
----- PaintedScrollbarLayerImpl (for outer-viewport)
|
----- SolidColorScrollbarLayerImpl (for inner-viewport)
(Android, pinch-zoom)
In this architecture, solid-color scrollbars can live side-by side with regular desktop scrollbars, and no longer require a WebScrollbar in order to be created. The scrolling LayerImpl's only know about ScrollbarLayerImplBase, and the TreeSynchronizer & LTI only deal with *Base layer types.
The ScrollbarLayerImplBase layer is not pure virtual, but rather attempts to collect any common functionality, and the result is much simpler classes for SolidColorScrollbarLayerImpl.
Work remaining:
1) Once the pinch-viewport layers are in place in CC, we can get rid of vertical adjust (I think), and so LTI::UpdateSolidColorScrollbars() can go away. When this goes away, some of the interface for ScrollbarLayerImplBase can be simplified as well.
Review URL: https://chromiumcodereview.appspot.com/18341009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220637 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 853a1133..52a539b 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -9,8 +9,8 @@
#include "cc/animation/scrollbar_animation_controller.h"
#include "cc/debug/traced_value.h"
#include "cc/layers/heads_up_display_layer_impl.h"
-#include "cc/layers/painted_scrollbar_layer_impl.h"
#include "cc/layers/render_surface_impl.h"
+#include "cc/layers/scrollbar_layer_impl_base.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "ui/gfx/size_conversions.h"
@@ -257,6 +257,9 @@
root_layer(), base::Bind(&ApplyScrollDeltasSinceBeginFrameTo));
}
+// TODO(wjmaclean) This needs to go away, and be replaced with a single core
+// of login that works for both scrollbar layer types. This is already planned
+// as part of the larger pinch-zoom re-factoring viewport.
void LayerTreeImpl::UpdateSolidColorScrollbars() {
DCHECK(settings().solid_color_scrollbars);
@@ -271,13 +274,13 @@
if (RootContainerLayer())
vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() -
RootContainerLayer()->bounds().height();
- if (PaintedScrollbarLayerImpl* horiz =
+ if (ScrollbarLayerImplBase* horiz =
root_scroll->horizontal_scrollbar_layer()) {
horiz->SetVerticalAdjust(vertical_adjust);
horiz->SetVisibleToTotalLengthRatio(
scrollable_viewport.width() / ScrollableSize().width());
}
- if (PaintedScrollbarLayerImpl* vertical =
+ if (ScrollbarLayerImplBase* vertical =
root_scroll->vertical_scrollbar_layer()) {
vertical->SetVerticalAdjust(vertical_adjust);
vertical->SetVisibleToTotalLengthRatio(