| Index: cc/pinch_zoom_scrollbar.cc
|
| diff --git a/cc/pinch_zoom_scrollbar.cc b/cc/pinch_zoom_scrollbar.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a804250dc2efddd79d26505d807cdd167a045af4
|
| --- /dev/null
|
| +++ b/cc/pinch_zoom_scrollbar.cc
|
| @@ -0,0 +1,104 @@
|
| +#include "cc/pinch_zoom_scrollbar.h"
|
| +
|
| +#include "cc/layer.h"
|
| +#include "cc/layer_tree_host.h"
|
| +
|
| +namespace cc {
|
| +
|
| +PinchZoomScrollbar::PinchZoomScrollbar(
|
| + WebKit::WebScrollbar::Orientation orientation, LayerTreeHost* owner)
|
| + : orientation_(orientation),
|
| + owner_(owner) {
|
| + DCHECK(owner_);
|
| +}
|
| +
|
| +
|
| +bool PinchZoomScrollbar::isOverlay() const { return true; }
|
| +
|
| +int PinchZoomScrollbar::value() const {
|
| + Layer* rootScrollLayer = owner_->rootScrollLayer();
|
| + if (!rootScrollLayer)
|
| + return 0;
|
| +
|
| + if (orientation_ == WebKit::WebScrollbar::Horizontal)
|
| + return rootScrollLayer->scrollOffset().x();
|
| + else
|
| + return rootScrollLayer->scrollOffset().y();
|
| +}
|
| +
|
| +WebKit::WebPoint PinchZoomScrollbar::location() const {
|
| + return WebKit::WebPoint();
|
| +}
|
| +
|
| +WebKit::WebSize PinchZoomScrollbar::size() const {
|
| + gfx::Size viewportSize = owner_->layoutViewportSize();
|
| + gfx::Size size;
|
| + if (orientation_ == WebKit::WebScrollbar::Horizontal)
|
| + size = gfx::Size(viewportSize.width() - kTrackWidth, kTrackWidth);
|
| + else
|
| + size = gfx::Size(kTrackWidth, viewportSize.height() - kTrackWidth);
|
| + return WebKit::WebSize(size);
|
| +}
|
| +
|
| +bool PinchZoomScrollbar::enabled() const {
|
| + return true;
|
| +}
|
| +
|
| +int PinchZoomScrollbar::maximum() const {
|
| + gfx::Size size = owner_->layoutViewportSize();
|
| + Layer* rootScrollLayer = owner_->rootScrollLayer();
|
| + if (!rootScrollLayer)
|
| + return 0;
|
| +
|
| + if (orientation_ == WebKit::WebScrollbar::Horizontal)
|
| + return rootScrollLayer->contentBounds().width() - size.width();
|
| + else
|
| + return rootScrollLayer->contentBounds().height() - size.height();
|
| +}
|
| +
|
| +int PinchZoomScrollbar::totalSize() const {
|
| + Layer* rootScrollLayer = owner_->rootScrollLayer();
|
| + gfx::Size size;
|
| + if (rootScrollLayer)
|
| + size = rootScrollLayer->contentBounds();
|
| + else
|
| + size = owner_->layoutViewportSize();
|
| +
|
| + if (orientation_ == WebKit::WebScrollbar::Horizontal)
|
| + return size.width();
|
| + else
|
| + return size.height();
|
| +}
|
| +
|
| +bool PinchZoomScrollbar::isScrollViewScrollbar() const {
|
| + return false;
|
| +}
|
| +
|
| +bool PinchZoomScrollbar::isScrollableAreaActive() const {
|
| + return true;
|
| +}
|
| +
|
| +WebKit::WebScrollbar::ScrollbarControlSize PinchZoomScrollbar::controlSize() const {
|
| + return WebKit::WebScrollbar::SmallScrollbar;
|
| +}
|
| +
|
| +WebKit::WebScrollbar::ScrollbarPart PinchZoomScrollbar::pressedPart() const {
|
| + return WebKit::WebScrollbar::NoPart;
|
| +}
|
| +
|
| +WebKit::WebScrollbar::ScrollbarPart PinchZoomScrollbar::hoveredPart() const {
|
| + return WebKit::WebScrollbar::NoPart;
|
| +}
|
| +
|
| +WebKit::WebScrollbar::ScrollbarOverlayStyle PinchZoomScrollbar::scrollbarOverlayStyle() const {
|
| + return WebKit::WebScrollbar::ScrollbarOverlayStyleDefault;
|
| +}
|
| +bool PinchZoomScrollbar::isCustomScrollbar() const {
|
| + return false;
|
| +}
|
| +
|
| +WebKit::WebScrollbar::Orientation PinchZoomScrollbar::orientation() const {
|
| + return orientation_;
|
| +}
|
| +
|
| +} // namespace cc
|
|
|