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

Unified Diff: cc/scrollbar_geometry_fixed_thumb.cc

Issue 12603013: Part 10 of cc/ directory shuffles: layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scrollbar_geometry_fixed_thumb.h ('k') | cc/scrollbar_geometry_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scrollbar_geometry_fixed_thumb.cc
diff --git a/cc/scrollbar_geometry_fixed_thumb.cc b/cc/scrollbar_geometry_fixed_thumb.cc
deleted file mode 100644
index 4e5342271bd69db8d7839f5ce0a717b0ec35e422..0000000000000000000000000000000000000000
--- a/cc/scrollbar_geometry_fixed_thumb.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/scrollbar_geometry_fixed_thumb.h"
-
-#include <cmath>
-
-#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h"
-
-using WebKit::WebRect;
-using WebKit::WebScrollbar;
-using WebKit::WebScrollbarThemeGeometry;
-
-namespace cc {
-
-scoped_ptr<ScrollbarGeometryFixedThumb> ScrollbarGeometryFixedThumb::create(scoped_ptr<WebScrollbarThemeGeometry> geometry)
-{
- return make_scoped_ptr(new ScrollbarGeometryFixedThumb(geometry.Pass()));
-}
-
-ScrollbarGeometryFixedThumb::~ScrollbarGeometryFixedThumb()
-{
-}
-
-WebScrollbarThemeGeometry* ScrollbarGeometryFixedThumb::clone() const
-{
- ScrollbarGeometryFixedThumb* geometry = new ScrollbarGeometryFixedThumb(make_scoped_ptr(ScrollbarGeometryStub::clone()));
- geometry->m_thumbSize = m_thumbSize;
- return geometry;
-}
-
-int ScrollbarGeometryFixedThumb::thumbLength(WebScrollbar* scrollbar)
-{
- if (scrollbar->orientation() == WebScrollbar::Horizontal)
- return m_thumbSize.width();
- return m_thumbSize.height();
-}
-
-int ScrollbarGeometryFixedThumb::thumbPosition(WebScrollbar* scrollbar)
-{
- if (scrollbar->enabled()) {
- float size = scrollbar->maximum();
- if (!size)
- return 1;
- int value = std::min(std::max(0, scrollbar->value()), scrollbar->maximum());
- float pos = (trackLength(scrollbar) - thumbLength(scrollbar)) * value / size;
- return static_cast<int>(floorf((pos < 1 && pos > 0) ? 1 : pos));
- }
- return 0;
-}
-void ScrollbarGeometryFixedThumb::splitTrack(WebScrollbar* scrollbar, const WebRect& unconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& afterThumbRect)
-{
- // This is a reimplementation of ScrollbarThemeComposite::splitTrack.
- // Because the WebScrollbarThemeGeometry functions call down to native
- // ScrollbarThemeComposite code which uses ScrollbarThemeComposite virtual
- // helpers, there's no way to override a helper like thumbLength from
- // the WebScrollbarThemeGeometry level. So, these three functions
- // (splitTrack, thumbPosition, thumbLength) are copied here so that the
- // WebScrollbarThemeGeometry helper functions are used instead and
- // a fixed size thumbLength can be used.
-
- WebRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
- int thickness = scrollbar->orientation() == WebScrollbar::Horizontal ? scrollbar->size().height : scrollbar->size().width;
- int thumbPos = thumbPosition(scrollbar);
- if (scrollbar->orientation() == WebScrollbar::Horizontal) {
- thumbRect = WebRect(trackRect.x + thumbPos, trackRect.y + (trackRect.height - thickness) / 2, thumbLength(scrollbar), thickness);
- beforeThumbRect = WebRect(trackRect.x, trackRect.y, thumbPos + thumbRect.width / 2, trackRect.height);
- afterThumbRect = WebRect(trackRect.x + beforeThumbRect.width, trackRect.y, trackRect.x + trackRect.width - beforeThumbRect.x - beforeThumbRect.width, trackRect.height);
- } else {
- thumbRect = WebRect(trackRect.x + (trackRect.width - thickness) / 2, trackRect.y + thumbPos, thickness, thumbLength(scrollbar));
- beforeThumbRect = WebRect(trackRect.x, trackRect.y, trackRect.width, thumbPos + thumbRect.height / 2);
- afterThumbRect = WebRect(trackRect.x, trackRect.y + beforeThumbRect.height, trackRect.width, trackRect.y + trackRect.height - beforeThumbRect.y - beforeThumbRect.height);
- }
-}
-
-ScrollbarGeometryFixedThumb::ScrollbarGeometryFixedThumb(scoped_ptr<WebScrollbarThemeGeometry> geometry)
- : ScrollbarGeometryStub(geometry.Pass())
-{
-}
-
-} // namespace cc
« 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