diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 17:36:49 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 17:36:49 +0000 |
commit | c28df4c12c5acfca195bd473ed11a2003634846e (patch) | |
tree | aa4f4a8aa86e6fab0331e65c833f80e6ec307f07 /cc/test/fake_scrollbar.cc | |
parent | 6c7a0fdd05370cd3899cffdc6170f9b0df8856a0 (diff) | |
download | chromium_src-c28df4c12c5acfca195bd473ed11a2003634846e.zip chromium_src-c28df4c12c5acfca195bd473ed11a2003634846e.tar.gz chromium_src-c28df4c12c5acfca195bd473ed11a2003634846e.tar.bz2 |
Remove cc/ dependency on WebKit::WebScrollbar*
This removes the compositor implementation's dependency on the WebKit scrollbar
family of classes. The compositor supports two types of scrollbars - those that
have arbitrarily painted content, used on most platforms, and solid color simple
scrollbars used on mobile platforms and for pinch.
The former grab their geometry and paint info on the main thread during the
update via the cc::Scrollbar interface, which for the WebKit embedding is
implemented by webkit/renderer/compositor_bindings/scrollbar_impl which uses the
WebKit WebScrollbar/WebScrollbarThemeGeometry/WebScrollbarThemePainter
interfaces to handles the complex positioning and part painting logic. The only
mutation we support on the compositor thread for these scrollbars is moving the
thumb, which is done in cc::ScrollbarLayerImpl::AppendQuads.
The latter simply have everything computed directly by cc::ScrollbarLayer(Impl).
BUG=can't find it
R=enne@chromium.org
Review URL: https://codereview.chromium.org/15349002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_scrollbar.cc')
-rw-r--r-- | cc/test/fake_scrollbar.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/cc/test/fake_scrollbar.cc b/cc/test/fake_scrollbar.cc new file mode 100644 index 0000000..e6b4253 --- /dev/null +++ b/cc/test/fake_scrollbar.cc @@ -0,0 +1,58 @@ +// Copyright 2013 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/test/fake_scrollbar.h" + +#include "third_party/skia/include/core/SkCanvas.h" + +namespace cc { + +FakeScrollbar::FakeScrollbar() + : paint_(false), + has_thumb_(false), + is_overlay_(false), + fill_color_(SK_ColorGREEN) {} + +FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay) + : paint_(paint), + has_thumb_(has_thumb), + is_overlay_(is_overlay), + fill_color_(SK_ColorGREEN) {} + +FakeScrollbar::~FakeScrollbar() {} + +ScrollbarOrientation FakeScrollbar::Orientation() const { + return HORIZONTAL; +} + +gfx::Point FakeScrollbar::Location() const { return location_; } + +bool FakeScrollbar::IsOverlay() const { return is_overlay_; } + +bool FakeScrollbar::HasThumb() const { return has_thumb_; } + +int FakeScrollbar::ThumbThickness() const { + return 10; +} + +int FakeScrollbar::ThumbLength() const { + return 10; +} + +gfx::Rect FakeScrollbar::TrackRect() const { + return gfx::Rect(0, 0, 100, 10); +} + +void FakeScrollbar::PaintPart(SkCanvas* canvas, + ScrollbarPart part, + gfx::Rect content_rect) { + if (!paint_) + return; + + // Fill the scrollbar with a different color each time. + fill_color_++; + canvas->clear(SK_ColorBLACK | fill_color_); +} + +} // namespace cc |