OLD | NEW |
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.h" | 5 #include "cc/scrollbar_layer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/layer_painter.h" | 9 #include "cc/layer_painter.h" |
10 #include "cc/layer_tree_host.h" | 10 #include "cc/layer_tree_host.h" |
11 #include "cc/resource_update_queue.h" | 11 #include "cc/resource_update_queue.h" |
12 #include "cc/scrollbar_layer_impl.h" | 12 #include "cc/scrollbar_layer_impl.h" |
13 #include "ui/gfx/rect_conversions.h" | 13 #include "ui/gfx/rect_conversions.h" |
14 #include <public/WebRect.h> | 14 #include <public/WebRect.h> |
15 | 15 |
16 using WebKit::WebRect; | 16 using WebKit::WebRect; |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 scoped_ptr<LayerImpl> ScrollbarLayer::createLayerImpl() | 20 scoped_ptr<LayerImpl> ScrollbarLayer::createLayerImpl(LayerTreeHostImpl* hostImp
l) |
21 { | 21 { |
22 return ScrollbarLayerImpl::create(id()).PassAs<LayerImpl>(); | 22 return ScrollbarLayerImpl::create(hostImpl, id()).PassAs<LayerImpl>(); |
23 } | 23 } |
24 | 24 |
25 scoped_refptr<ScrollbarLayer> ScrollbarLayer::create(scoped_ptr<WebKit::WebScrol
lbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::We
bScrollbarThemeGeometry> geometry, int scrollLayerId) | 25 scoped_refptr<ScrollbarLayer> ScrollbarLayer::create(scoped_ptr<WebKit::WebScrol
lbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::We
bScrollbarThemeGeometry> geometry, int scrollLayerId) |
26 { | 26 { |
27 return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), painter, geom
etry.Pass(), scrollLayerId)); | 27 return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), painter, geom
etry.Pass(), scrollLayerId)); |
28 } | 28 } |
29 | 29 |
30 ScrollbarLayer::ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKi
t::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometr
y> geometry, int scrollLayerId) | 30 ScrollbarLayer::ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKi
t::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometr
y> geometry, int scrollLayerId) |
31 : m_scrollbar(scrollbar.Pass()) | 31 : m_scrollbar(scrollbar.Pass()) |
32 , m_painter(painter) | 32 , m_painter(painter) |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que
ue, stats); | 304 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que
ue, stats); |
305 | 305 |
306 // Consider the thumb to be at the origin when painting. | 306 // Consider the thumb to be at the origin when painting. |
307 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); | 307 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); |
308 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0,
thumbRect.width, thumbRect.height)); | 308 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0,
thumbRect.width, thumbRect.height)); |
309 if (!originThumbRect.IsEmpty()) | 309 if (!originThumbRect.IsEmpty()) |
310 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); | 310 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); |
311 } | 311 } |
312 | 312 |
313 } // namespace cc | 313 } // namespace cc |
OLD | NEW |