Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Side by Side Diff: cc/scrollbar_layer_impl.cc

Issue 11882037: Activate LayerImpl tree with sync+push instead of pointer swap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/scrollbar_layer_impl.h ('k') | cc/solid_color_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scrollbar_layer_impl.h" 5 #include "cc/scrollbar_layer_impl.h"
6 6
7 #include "cc/quad_sink.h" 7 #include "cc/quad_sink.h"
8 #include "cc/scrollbar_animation_controller.h" 8 #include "cc/scrollbar_animation_controller.h"
9 #include "cc/texture_draw_quad.h" 9 #include "cc/texture_draw_quad.h"
10 #include "ui/gfx/rect_conversions.h" 10 #include "ui/gfx/rect_conversions.h"
(...skipping 10 matching lines...) Expand all
21 21
22 ScrollbarLayerImpl::ScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) 22 ScrollbarLayerImpl::ScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id)
23 : ScrollbarLayerImplBase(treeImpl, id) 23 : ScrollbarLayerImplBase(treeImpl, id)
24 , m_scrollbar(this) 24 , m_scrollbar(this)
25 , m_backTrackResourceId(0) 25 , m_backTrackResourceId(0)
26 , m_foreTrackResourceId(0) 26 , m_foreTrackResourceId(0)
27 , m_thumbResourceId(0) 27 , m_thumbResourceId(0)
28 , m_currentPos(0) 28 , m_currentPos(0)
29 , m_totalSize(0) 29 , m_totalSize(0)
30 , m_maximum(0) 30 , m_maximum(0)
31 , m_scrollLayerId(-1)
31 , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault) 32 , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault)
32 , m_orientation(WebScrollbar::Horizontal) 33 , m_orientation(WebScrollbar::Horizontal)
33 , m_controlSize(WebScrollbar::RegularScrollbar) 34 , m_controlSize(WebScrollbar::RegularScrollbar)
34 , m_pressedPart(WebScrollbar::NoPart) 35 , m_pressedPart(WebScrollbar::NoPart)
35 , m_hoveredPart(WebScrollbar::NoPart) 36 , m_hoveredPart(WebScrollbar::NoPart)
36 , m_isScrollableAreaActive(false) 37 , m_isScrollableAreaActive(false)
37 , m_isScrollViewScrollbar(false) 38 , m_isScrollViewScrollbar(false)
38 , m_enabled(false) 39 , m_enabled(false)
39 , m_isCustomScrollbar(false) 40 , m_isCustomScrollbar(false)
40 , m_isOverlayScrollbar(false) 41 , m_isOverlayScrollbar(false)
41 { 42 {
42 } 43 }
43 44
44 ScrollbarLayerImpl::~ScrollbarLayerImpl() 45 ScrollbarLayerImpl::~ScrollbarLayerImpl()
45 { 46 {
46 } 47 }
47 48
49 ScrollbarLayerImpl* ScrollbarLayerImpl::toScrollbarLayer()
50 {
51 return this;
52 }
53
48 void ScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<ScrollbarGeometryFixedT humb> geometry) 54 void ScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<ScrollbarGeometryFixedT humb> geometry)
49 { 55 {
50 m_geometry = geometry.Pass(); 56 m_geometry = geometry.Pass();
51 } 57 }
52 58
53 void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar) 59 void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar)
54 { 60 {
55 m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle(); 61 m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle();
56 m_orientation = scrollbar->orientation(); 62 m_orientation = scrollbar->orientation();
57 m_controlSize = scrollbar->controlSize(); 63 m_controlSize = scrollbar->controlSize();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 100 }
95 101
96 gfx::Rect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const gfx::Rect& l ayerRect) const 102 gfx::Rect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const gfx::Rect& l ayerRect) const
97 { 103 {
98 // Don't intersect with the bounds as in layerRectToContentRect() because 104 // Don't intersect with the bounds as in layerRectToContentRect() because
99 // layerRect here might be in coordinates of the containing layer. 105 // layerRect here might be in coordinates of the containing layer.
100 gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), content sScaleY()); 106 gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), content sScaleY());
101 return gfx::ToEnclosingRect(contentRect); 107 return gfx::ToEnclosingRect(contentRect);
102 } 108 }
103 109
110 scoped_ptr<LayerImpl> ScrollbarLayerImpl::createLayerImpl(LayerTreeImpl* treeImp l)
111 {
112 return ScrollbarLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>();
113 }
114
115 void ScrollbarLayerImpl::pushPropertiesTo(LayerImpl* layer)
116 {
117 LayerImpl::pushPropertiesTo(layer);
118
119 ScrollbarLayerImpl* scrollbarLayer = static_cast<ScrollbarLayerImpl*>(layer) ;
120
121 if (!scrollbarLayer->scrollbarGeometry())
122 scrollbarLayer->setScrollbarGeometry(ScrollbarGeometryFixedThumb::create (make_scoped_ptr(m_geometry->clone())));
123
124 scrollbarLayer->setScrollbarData(&m_scrollbar);
125
126 scrollbarLayer->setBackTrackResourceId(m_backTrackResourceId);
127 scrollbarLayer->setForeTrackResourceId(m_foreTrackResourceId);
128 scrollbarLayer->setThumbResourceId(m_thumbResourceId);
129 }
130
104 void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append QuadsData) 131 void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append QuadsData)
105 { 132 {
106 bool premultipledAlpha = false; 133 bool premultipledAlpha = false;
107 bool flipped = false; 134 bool flipped = false;
108 gfx::PointF uvTopLeft(0.f, 0.f); 135 gfx::PointF uvTopLeft(0.f, 0.f);
109 gfx::PointF uvBottomRight(1.f, 1.f); 136 gfx::PointF uvBottomRight(1.f, 1.f);
110 gfx::Rect boundsRect(gfx::Point(), bounds()); 137 gfx::Rect boundsRect(gfx::Point(), bounds());
111 gfx::Rect contentBoundsRect(gfx::Point(), contentBounds()); 138 gfx::Rect contentBoundsRect(gfx::Point(), contentBounds());
112 139
113 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ uadState()); 140 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ uadState());
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 { 266 {
240 return m_owner->m_isCustomScrollbar; 267 return m_owner->m_isCustomScrollbar;
241 } 268 }
242 269
243 const char* ScrollbarLayerImpl::layerTypeAsString() const 270 const char* ScrollbarLayerImpl::layerTypeAsString() const
244 { 271 {
245 return "ScrollbarLayer"; 272 return "ScrollbarLayer";
246 } 273 }
247 274
248 } // namespace cc 275 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scrollbar_layer_impl.h ('k') | cc/solid_color_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698