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

Side by Side Diff: cc/scrollbar_geometry_fixed_thumb.cc

Issue 11144034: cc: Remove wtf includes for scrollbar layer classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 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_geometry_fixed_thumb.h ('k') | cc/scrollbar_geometry_stub.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 "config.h" 5 #include "config.h"
6 6
7 #include "CCScrollbarGeometryFixedThumb.h" 7 #include "CCScrollbarGeometryFixedThumb.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <public/WebRect.h> 10 #include <public/WebRect.h>
11 #include <public/WebScrollbar.h> 11 #include <public/WebScrollbar.h>
12 12
13 using WebKit::WebRect; 13 using WebKit::WebRect;
14 using WebKit::WebScrollbar; 14 using WebKit::WebScrollbar;
15 using WebKit::WebScrollbarThemeGeometry; 15 using WebKit::WebScrollbarThemeGeometry;
16 16
17 namespace cc { 17 namespace cc {
18 18
19 PassOwnPtr<CCScrollbarGeometryFixedThumb> CCScrollbarGeometryFixedThumb::create( PassOwnPtr<WebScrollbarThemeGeometry> geometry) 19 scoped_ptr<CCScrollbarGeometryFixedThumb> CCScrollbarGeometryFixedThumb::create( scoped_ptr<WebScrollbarThemeGeometry> geometry)
20 { 20 {
21 return adoptPtr(new CCScrollbarGeometryFixedThumb(geometry)); 21 return make_scoped_ptr(new CCScrollbarGeometryFixedThumb(geometry.Pass()));
22 } 22 }
23 23
24 CCScrollbarGeometryFixedThumb::~CCScrollbarGeometryFixedThumb() 24 CCScrollbarGeometryFixedThumb::~CCScrollbarGeometryFixedThumb()
25 { 25 {
26 } 26 }
27 27
28 void CCScrollbarGeometryFixedThumb::update(WebScrollbar* scrollbar) 28 void CCScrollbarGeometryFixedThumb::update(WebScrollbar* scrollbar)
29 { 29 {
30 int length = CCScrollbarGeometryStub::thumbLength(scrollbar); 30 int length = CCScrollbarGeometryStub::thumbLength(scrollbar);
31 31
32 if (scrollbar->orientation() == WebScrollbar::Horizontal) 32 if (scrollbar->orientation() == WebScrollbar::Horizontal)
33 m_thumbSize = IntSize(length, scrollbar->size().height); 33 m_thumbSize = IntSize(length, scrollbar->size().height);
34 else 34 else
35 m_thumbSize = IntSize(scrollbar->size().width, length); 35 m_thumbSize = IntSize(scrollbar->size().width, length);
36 } 36 }
37 37
38 WebScrollbarThemeGeometry* CCScrollbarGeometryFixedThumb::clone() const 38 WebScrollbarThemeGeometry* CCScrollbarGeometryFixedThumb::clone() const
39 { 39 {
40 CCScrollbarGeometryFixedThumb* geometry = new CCScrollbarGeometryFixedThumb( adoptPtr(CCScrollbarGeometryStub::clone())); 40 CCScrollbarGeometryFixedThumb* geometry = new CCScrollbarGeometryFixedThumb( make_scoped_ptr(CCScrollbarGeometryStub::clone()));
41 geometry->m_thumbSize = m_thumbSize; 41 geometry->m_thumbSize = m_thumbSize;
42 return geometry; 42 return geometry;
43 } 43 }
44 44
45 int CCScrollbarGeometryFixedThumb::thumbLength(WebScrollbar* scrollbar) 45 int CCScrollbarGeometryFixedThumb::thumbLength(WebScrollbar* scrollbar)
46 { 46 {
47 if (scrollbar->orientation() == WebScrollbar::Horizontal) 47 if (scrollbar->orientation() == WebScrollbar::Horizontal)
48 return m_thumbSize.width(); 48 return m_thumbSize.width();
49 return m_thumbSize.height(); 49 return m_thumbSize.height();
50 } 50 }
(...skipping 28 matching lines...) Expand all
79 thumbRect = WebRect(trackRect.x + thumbPos, trackRect.y + (trackRect.hei ght - thickness) / 2, thumbLength(scrollbar), thickness); 79 thumbRect = WebRect(trackRect.x + thumbPos, trackRect.y + (trackRect.hei ght - thickness) / 2, thumbLength(scrollbar), thickness);
80 beforeThumbRect = WebRect(trackRect.x, trackRect.y, thumbPos + thumbRect .width / 2, trackRect.height); 80 beforeThumbRect = WebRect(trackRect.x, trackRect.y, thumbPos + thumbRect .width / 2, trackRect.height);
81 afterThumbRect = WebRect(trackRect.x + beforeThumbRect.width, trackRect. y, trackRect.x + trackRect.width - beforeThumbRect.x - beforeThumbRect.width, tr ackRect.height); 81 afterThumbRect = WebRect(trackRect.x + beforeThumbRect.width, trackRect. y, trackRect.x + trackRect.width - beforeThumbRect.x - beforeThumbRect.width, tr ackRect.height);
82 } else { 82 } else {
83 thumbRect = WebRect(trackRect.x + (trackRect.width - thickness) / 2, tra ckRect.y + thumbPos, thickness, thumbLength(scrollbar)); 83 thumbRect = WebRect(trackRect.x + (trackRect.width - thickness) / 2, tra ckRect.y + thumbPos, thickness, thumbLength(scrollbar));
84 beforeThumbRect = WebRect(trackRect.x, trackRect.y, trackRect.width, thu mbPos + thumbRect.height / 2); 84 beforeThumbRect = WebRect(trackRect.x, trackRect.y, trackRect.width, thu mbPos + thumbRect.height / 2);
85 afterThumbRect = WebRect(trackRect.x, trackRect.y + beforeThumbRect.heig ht, trackRect.width, trackRect.y + trackRect.height - beforeThumbRect.y - before ThumbRect.height); 85 afterThumbRect = WebRect(trackRect.x, trackRect.y + beforeThumbRect.heig ht, trackRect.width, trackRect.y + trackRect.height - beforeThumbRect.y - before ThumbRect.height);
86 } 86 }
87 } 87 }
88 88
89 CCScrollbarGeometryFixedThumb::CCScrollbarGeometryFixedThumb(PassOwnPtr<WebScrol lbarThemeGeometry> geometry) 89 CCScrollbarGeometryFixedThumb::CCScrollbarGeometryFixedThumb(scoped_ptr<WebScrol lbarThemeGeometry> geometry)
90 : CCScrollbarGeometryStub(geometry) 90 : CCScrollbarGeometryStub(geometry.Pass())
91 { 91 {
92 } 92 }
93 93
94 } 94 }
OLDNEW
« no previous file with comments | « cc/scrollbar_geometry_fixed_thumb.h ('k') | cc/scrollbar_geometry_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698