| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/scrollbar_layer_impl.h" | 7 #include "cc/scrollbar_layer_impl.h" |
| 8 | 8 |
| 9 #include "cc/quad_sink.h" | 9 #include "cc/quad_sink.h" |
| 10 #include "cc/scrollbar_animation_controller.h" | 10 #include "cc/scrollbar_animation_controller.h" |
| 11 #include "cc/texture_draw_quad.h" | 11 #include "cc/texture_draw_quad.h" |
| 12 #include "ui/gfx/rect_conversions.h" |
| 12 | 13 |
| 13 using WebKit::WebRect; | 14 using WebKit::WebRect; |
| 14 using WebKit::WebScrollbar; | 15 using WebKit::WebScrollbar; |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 | 18 |
| 18 scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(int id) | 19 scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(int id) |
| 19 { | 20 { |
| 20 return make_scoped_ptr(new ScrollbarLayerImpl(id)); | 21 return make_scoped_ptr(new ScrollbarLayerImpl(id)); |
| 21 } | 22 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 scrollbar->getTickmarks(m_tickmarks); | 65 scrollbar->getTickmarks(m_tickmarks); |
| 65 | 66 |
| 66 m_geometry->update(scrollbar); | 67 m_geometry->update(scrollbar); |
| 67 } | 68 } |
| 68 | 69 |
| 69 static gfx::RectF toUVRect(const gfx::Rect& r, const gfx::Rect& bounds) | 70 static gfx::RectF toUVRect(const gfx::Rect& r, const gfx::Rect& bounds) |
| 70 { | 71 { |
| 71 return gfx::ScaleRect(r, 1.0 / bounds.width(), 1.0 / bounds.height()); | 72 return gfx::ScaleRect(r, 1.0 / bounds.width(), 1.0 / bounds.height()); |
| 72 } | 73 } |
| 73 | 74 |
| 74 IntRect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const WebRect& layer
Rect) const | 75 gfx::Rect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const gfx::Rect& l
ayerRect) const |
| 75 { | 76 { |
| 76 // Don't intersect with the bounds as in layerRectToContentRect() because | 77 // Don't intersect with the bounds as in layerRectToContentRect() because |
| 77 // layerRect here might be in coordinates of the containing layer. | 78 // layerRect here might be in coordinates of the containing layer. |
| 78 FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.h
eight); | 79 gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), content
sScaleY()); |
| 79 contentRect.scale(contentsScaleX(), contentsScaleY()); | 80 return gfx::ToEnclosingRect(contentRect); |
| 80 return enclosingIntRect(contentRect); | |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
QuadsData) | 83 void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
QuadsData) |
| 84 { | 84 { |
| 85 bool premultipledAlpha = false; | 85 bool premultipledAlpha = false; |
| 86 bool flipped = false; | 86 bool flipped = false; |
| 87 gfx::RectF uvRect(0, 0, 1, 1); | 87 gfx::RectF uvRect(0, 0, 1, 1); |
| 88 gfx::Rect boundsRect(gfx::Point(), bounds()); | 88 gfx::Rect boundsRect(gfx::Point(), bounds()); |
| 89 gfx::Rect contentBoundsRect(gfx::Point(), contentBounds()); | 89 gfx::Rect contentBoundsRect(gfx::Point(), contentBounds()); |
| 90 | 90 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 { | 201 { |
| 202 return m_owner->m_isCustomScrollbar; | 202 return m_owner->m_isCustomScrollbar; |
| 203 } | 203 } |
| 204 | 204 |
| 205 const char* ScrollbarLayerImpl::layerTypeAsString() const | 205 const char* ScrollbarLayerImpl::layerTypeAsString() const |
| 206 { | 206 { |
| 207 return "ScrollbarLayer"; | 207 return "ScrollbarLayer"; |
| 208 } | 208 } |
| 209 | 209 |
| 210 } | 210 } |
| OLD | NEW |