Commit 3ae40881 authored by danakj's avatar danakj Committed by Commit Bot

blink: Remove the WebScrollbarLayer class.

This removes the class, replacing it with uses of the cc scrollbar layer
types: cc::PaintedScrollbarLayer, cc::PaintedOverlayScrollbarLayer, and
cc::SolidColorScrollbarLayer directly. The scrollbar layer map needs to
maintain ownership of these along with a wrapping WebLayer (for now),
and a raw pointer to a base cc::ScrollbarLayerInterface* for changing
the element id that the scrollbar controls the view of. So we add a
ScrollingCoordinator::ScrollbarLayerGroup that holds these three things
together.

The cc_blink::ScrollbarImpl, which is a subclass of cc::Scrollbar, moves
from cc/blink/ to platform/scroll/ beside the ScrollingCoordinator, and
is renamed to ScrollbarLayerDelegate. It still makes use of Web* types
like WebScrollbarThemePainter and these can be removed to use the
platform/scroll/ types directly instead.

R=bokan@chromium.org, jbroman@chromium.org

Bug: 838693, 738465
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I021fc69a2c8fd90a21bf406cd08d968e0335506a
Reviewed-on: https://chromium-review.googlesource.com/1048247Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557203}
parent 191635e5
...@@ -9,8 +9,6 @@ cc_component("blink") { ...@@ -9,8 +9,6 @@ cc_component("blink") {
sources = [ sources = [
"cc_blink_export.h", "cc_blink_export.h",
"scrollbar_impl.cc",
"scrollbar_impl.h",
"web_compositor_support_impl.cc", "web_compositor_support_impl.cc",
"web_compositor_support_impl.h", "web_compositor_support_impl.h",
"web_content_layer_impl.cc", "web_content_layer_impl.cc",
...@@ -21,8 +19,6 @@ cc_component("blink") { ...@@ -21,8 +19,6 @@ cc_component("blink") {
"web_layer_impl.h", "web_layer_impl.h",
"web_layer_impl_fixed_bounds.cc", "web_layer_impl_fixed_bounds.cc",
"web_layer_impl_fixed_bounds.h", "web_layer_impl_fixed_bounds.h",
"web_scrollbar_layer_impl.cc",
"web_scrollbar_layer_impl.h",
] ]
defines = [ "CC_BLINK_IMPLEMENTATION" ] defines = [ "CC_BLINK_IMPLEMENTATION" ]
......
...@@ -9,16 +9,11 @@ ...@@ -9,16 +9,11 @@
#include "cc/blink/web_content_layer_impl.h" #include "cc/blink/web_content_layer_impl.h"
#include "cc/blink/web_image_layer_impl.h" #include "cc/blink/web_image_layer_impl.h"
#include "cc/blink/web_layer_impl.h" #include "cc/blink/web_layer_impl.h"
#include "cc/blink/web_scrollbar_layer_impl.h"
#include "cc/layers/layer.h" #include "cc/layers/layer.h"
using blink::WebContentLayer; using blink::WebContentLayer;
using blink::WebImageLayer; using blink::WebImageLayer;
using blink::WebLayer; using blink::WebLayer;
using blink::WebScrollbar;
using blink::WebScrollbarLayer;
using blink::WebScrollbarThemeGeometry;
using blink::WebScrollbarThemePainter;
namespace cc_blink { namespace cc_blink {
...@@ -45,35 +40,4 @@ WebCompositorSupportImpl::CreateImageLayer() { ...@@ -45,35 +40,4 @@ WebCompositorSupportImpl::CreateImageLayer() {
return std::make_unique<WebImageLayerImpl>(); return std::make_unique<WebImageLayerImpl>();
} }
std::unique_ptr<WebScrollbarLayer>
WebCompositorSupportImpl::CreateScrollbarLayer(
std::unique_ptr<WebScrollbar> scrollbar,
WebScrollbarThemePainter painter,
std::unique_ptr<WebScrollbarThemeGeometry> geometry) {
return std::make_unique<WebScrollbarLayerImpl>(std::move(scrollbar), painter,
std::move(geometry),
/* is overlay */ false);
}
std::unique_ptr<WebScrollbarLayer>
WebCompositorSupportImpl::CreateOverlayScrollbarLayer(
std::unique_ptr<WebScrollbar> scrollbar,
WebScrollbarThemePainter painter,
std::unique_ptr<WebScrollbarThemeGeometry> geometry) {
return std::make_unique<WebScrollbarLayerImpl>(std::move(scrollbar), painter,
std::move(geometry),
/* is overlay */ true);
}
std::unique_ptr<WebScrollbarLayer>
WebCompositorSupportImpl::CreateSolidColorScrollbarLayer(
WebScrollbar::Orientation orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar) {
return std::make_unique<WebScrollbarLayerImpl>(
orientation, thumb_thickness, track_start,
is_left_side_vertical_scrollbar);
}
} // namespace cc_blink } // namespace cc_blink
...@@ -28,19 +28,6 @@ class CC_BLINK_EXPORT WebCompositorSupportImpl ...@@ -28,19 +28,6 @@ class CC_BLINK_EXPORT WebCompositorSupportImpl
std::unique_ptr<blink::WebContentLayer> CreateContentLayer( std::unique_ptr<blink::WebContentLayer> CreateContentLayer(
cc::ContentLayerClient* client) override; cc::ContentLayerClient* client) override;
std::unique_ptr<blink::WebImageLayer> CreateImageLayer() override; std::unique_ptr<blink::WebImageLayer> CreateImageLayer() override;
std::unique_ptr<blink::WebScrollbarLayer> CreateScrollbarLayer(
std::unique_ptr<blink::WebScrollbar> scrollbar,
blink::WebScrollbarThemePainter painter,
std::unique_ptr<blink::WebScrollbarThemeGeometry>) override;
std::unique_ptr<blink::WebScrollbarLayer> CreateOverlayScrollbarLayer(
std::unique_ptr<blink::WebScrollbar> scrollbar,
blink::WebScrollbarThemePainter painter,
std::unique_ptr<blink::WebScrollbarThemeGeometry>) override;
std::unique_ptr<blink::WebScrollbarLayer> CreateSolidColorScrollbarLayer(
blink::WebScrollbar::Orientation orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar) override;
private: private:
DISALLOW_COPY_AND_ASSIGN(WebCompositorSupportImpl); DISALLOW_COPY_AND_ASSIGN(WebCompositorSupportImpl);
......
// Copyright 2014 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/blink/web_scrollbar_layer_impl.h"
#include <utility>
#include "cc/blink/scrollbar_impl.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/layers/layer.h"
#include "cc/layers/painted_overlay_scrollbar_layer.h"
#include "cc/layers/painted_scrollbar_layer.h"
#include "cc/layers/scrollbar_layer_interface.h"
#include "cc/layers/solid_color_scrollbar_layer.h"
#include "cc/trees/element_id.h"
using cc::PaintedOverlayScrollbarLayer;
using cc::PaintedScrollbarLayer;
using cc::SolidColorScrollbarLayer;
namespace {
cc::ScrollbarOrientation ConvertOrientation(
blink::WebScrollbar::Orientation orientation) {
return orientation == blink::WebScrollbar::kHorizontal ? cc::HORIZONTAL
: cc::VERTICAL;
}
} // namespace
namespace cc_blink {
WebScrollbarLayerImpl::WebScrollbarLayerImpl(
std::unique_ptr<blink::WebScrollbar> scrollbar,
blink::WebScrollbarThemePainter painter,
std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry,
bool is_overlay)
: layer_(is_overlay
? new WebLayerImpl(PaintedOverlayScrollbarLayer::Create(
std::make_unique<ScrollbarImpl>(std::move(scrollbar),
painter,
std::move(geometry)),
cc::ElementId()))
: new WebLayerImpl(PaintedScrollbarLayer::Create(
std::make_unique<ScrollbarImpl>(std::move(scrollbar),
painter,
std::move(geometry)),
cc::ElementId()))) {}
WebScrollbarLayerImpl::WebScrollbarLayerImpl(
blink::WebScrollbar::Orientation orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar)
: layer_(new WebLayerImpl(
SolidColorScrollbarLayer::Create(ConvertOrientation(orientation),
thumb_thickness,
track_start,
is_left_side_vertical_scrollbar,
cc::ElementId()))) {}
WebScrollbarLayerImpl::~WebScrollbarLayerImpl() = default;
blink::WebLayer* WebScrollbarLayerImpl::Layer() {
return layer_.get();
}
void WebScrollbarLayerImpl::SetScrollLayer(blink::WebLayer* layer) {
cc::Layer* scroll_layer =
layer ? static_cast<WebLayerImpl*>(layer)->layer() : nullptr;
layer_->layer()->ToScrollbarLayer()->SetScrollElementId(
scroll_layer ? scroll_layer->element_id() : cc::ElementId());
}
void WebScrollbarLayerImpl::SetElementId(const cc::ElementId& element_id) {
layer_->SetElementId(element_id);
}
} // namespace cc_blink
// Copyright 2014 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.
#ifndef CC_BLINK_WEB_SCROLLBAR_LAYER_IMPL_H_
#define CC_BLINK_WEB_SCROLLBAR_LAYER_IMPL_H_
#include <memory>
#include "base/macros.h"
#include "cc/blink/cc_blink_export.h"
#include "third_party/blink/public/platform/web_scrollbar.h"
#include "third_party/blink/public/platform/web_scrollbar_layer.h"
namespace blink {
class WebScrollbarThemeGeometry;
class WebScrollbarThemePainter;
}
namespace cc_blink {
class WebLayerImpl;
class WebScrollbarLayerImpl : public blink::WebScrollbarLayer {
public:
CC_BLINK_EXPORT WebScrollbarLayerImpl(
std::unique_ptr<blink::WebScrollbar> scrollbar,
blink::WebScrollbarThemePainter painter,
std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry,
bool is_overlay);
CC_BLINK_EXPORT WebScrollbarLayerImpl(
blink::WebScrollbar::Orientation orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar);
~WebScrollbarLayerImpl() override;
// blink::WebScrollbarLayer implementation.
blink::WebLayer* Layer() override;
void SetScrollLayer(blink::WebLayer* layer) override;
void SetElementId(const cc::ElementId&) override;
private:
std::unique_ptr<WebLayerImpl> layer_;
DISALLOW_COPY_AND_ASSIGN(WebScrollbarLayerImpl);
};
} // namespace cc_blink
#endif // CC_BLINK_WEB_SCROLLBAR_LAYER_IMPL_H_
...@@ -383,7 +383,6 @@ source_set("blink_headers") { ...@@ -383,7 +383,6 @@ source_set("blink_headers") {
"platform/web_scrollbar.h", "platform/web_scrollbar.h",
"platform/web_scrollbar_behavior.h", "platform/web_scrollbar_behavior.h",
"platform/web_scrollbar_buttons_placement.h", "platform/web_scrollbar_buttons_placement.h",
"platform/web_scrollbar_layer.h",
"platform/web_scrollbar_overlay_color_theme.h", "platform/web_scrollbar_overlay_color_theme.h",
"platform/web_scrollbar_theme_geometry.h", "platform/web_scrollbar_theme_geometry.h",
"platform/web_scrollbar_theme_painter.h", "platform/web_scrollbar_theme_painter.h",
......
...@@ -44,8 +44,6 @@ namespace blink { ...@@ -44,8 +44,6 @@ namespace blink {
class WebContentLayer; class WebContentLayer;
class WebImageLayer; class WebImageLayer;
class WebLayer; class WebLayer;
class WebScrollbarLayer;
class WebScrollbarThemeGeometry;
class WebCompositorSupport { class WebCompositorSupport {
public: public:
...@@ -60,22 +58,6 @@ class WebCompositorSupport { ...@@ -60,22 +58,6 @@ class WebCompositorSupport {
virtual std::unique_ptr<WebImageLayer> CreateImageLayer() = 0; virtual std::unique_ptr<WebImageLayer> CreateImageLayer() = 0;
virtual std::unique_ptr<WebScrollbarLayer> CreateScrollbarLayer(
std::unique_ptr<WebScrollbar>,
WebScrollbarThemePainter,
std::unique_ptr<WebScrollbarThemeGeometry>) = 0;
virtual std::unique_ptr<WebScrollbarLayer> CreateOverlayScrollbarLayer(
std::unique_ptr<WebScrollbar>,
WebScrollbarThemePainter,
std::unique_ptr<WebScrollbarThemeGeometry>) = 0;
virtual std::unique_ptr<WebScrollbarLayer> CreateSolidColorScrollbarLayer(
WebScrollbar::Orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar) = 0;
protected: protected:
virtual ~WebCompositorSupport() = default; virtual ~WebCompositorSupport() = default;
}; };
......
...@@ -32,11 +32,10 @@ ...@@ -32,11 +32,10 @@
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_POINT_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_POINT_H_
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_common.h"
#include "ui/gfx/geometry/point.h"
#if INSIDE_BLINK #if INSIDE_BLINK
#include "third_party/blink/renderer/platform/geometry/int_point.h" #include "third_party/blink/renderer/platform/geometry/int_point.h"
#else
#include <ui/gfx/geometry/point.h>
#endif #endif
namespace blink { namespace blink {
...@@ -59,6 +58,10 @@ struct WebPoint { ...@@ -59,6 +58,10 @@ struct WebPoint {
} }
operator IntPoint() const { return IntPoint(x, y); } operator IntPoint() const { return IntPoint(x, y); }
explicit WebPoint(const gfx::Point& p) : x(p.x()), y(p.y()) {}
explicit operator gfx::Point() const { return gfx::Point(x, y); }
#else #else
WebPoint(const gfx::Point& p) : x(p.x()), y(p.y()) {} WebPoint(const gfx::Point& p) : x(p.x()), y(p.y()) {}
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RECT_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RECT_H_
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_common.h"
#include "ui/gfx/geometry/rect.h"
#if INSIDE_BLINK #if INSIDE_BLINK
#include "third_party/blink/renderer/platform/geometry/int_rect.h" #include "third_party/blink/renderer/platform/geometry/int_rect.h"
#else #else
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <ui/gfx/geometry/rect.h>
#endif #endif
namespace blink { namespace blink {
...@@ -69,6 +69,12 @@ struct WebRect { ...@@ -69,6 +69,12 @@ struct WebRect {
} }
operator IntRect() const { return IntRect(x, y, width, height); } operator IntRect() const { return IntRect(x, y, width, height); }
explicit WebRect(const gfx::Rect& r)
: x(r.x()), y(r.y()), width(r.width()), height(r.height()) {}
// Note that this conversion clamps the size to be non-negative.
explicit operator gfx::Rect() const { return gfx::Rect(x, y, width, height); }
#else #else
WebRect(const gfx::Rect& r) WebRect(const gfx::Rect& r)
: x(r.x()), y(r.y()), width(r.width()), height(r.height()) {} : x(r.x()), y(r.y()), width(r.width()), height(r.height()) {}
...@@ -81,9 +87,8 @@ struct WebRect { ...@@ -81,9 +87,8 @@ struct WebRect {
return *this; return *this;
} }
operator gfx::Rect() const { // Note that this conversion clamps the size to be non-negative.
return gfx::Rect(x, y, std::max(0, width), std::max(0, height)); operator gfx::Rect() const { return gfx::Rect(x, y, width, height); }
}
#endif #endif
}; };
......
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCROLLBAR_LAYER_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCROLLBAR_LAYER_H_
#include "third_party/blink/public/platform/web_layer.h"
#include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h"
#include "third_party/blink/public/platform/web_scrollbar_theme_painter.h"
namespace cc {
struct ElementId;
}
namespace blink {
class WebScrollbarLayer {
public:
virtual ~WebScrollbarLayer() = default;
virtual WebLayer* Layer() = 0;
virtual void SetScrollLayer(WebLayer*) = 0;
// This is an element id for the scrollbar, not the scrolling layer.
// This is not to be confused with scrolling_element_id, which is the
// element id of the scrolling layer that has a scrollbar.
// All scrollbar layers require element ids.
virtual void SetElementId(const cc::ElementId&) = 0;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCROLLBAR_LAYER_H_
...@@ -32,14 +32,14 @@ ...@@ -32,14 +32,14 @@
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SIZE_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SIZE_H_
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_common.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/vector2d.h"
#if INSIDE_BLINK #if INSIDE_BLINK
#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/geometry/int_size.h"
#else #else
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <ui/gfx/geometry/size.h>
#include <ui/gfx/geometry/vector2d.h>
#endif #endif
namespace blink { namespace blink {
...@@ -64,9 +64,18 @@ struct WebSize { ...@@ -64,9 +64,18 @@ struct WebSize {
} }
operator IntSize() const { return IntSize(width, height); } operator IntSize() const { return IntSize(width, height); }
explicit WebSize(const gfx::Size& s) : width(s.width()), height(s.height()) {}
explicit WebSize(const gfx::Vector2d& v) : width(v.x()), height(v.y()) {}
// Note that this conversion clamps to non-negative values.
explicit operator gfx::Size() const { return gfx::Size(width, height); }
explicit operator gfx::Vector2d() const {
return gfx::Vector2d(width, height);
}
#else #else
WebSize(const gfx::Size& s) : width(s.width()), height(s.height()) {} WebSize(const gfx::Size& s) : width(s.width()), height(s.height()) {}
WebSize(const gfx::Vector2d& v) : width(v.x()), height(v.y()) {} WebSize(const gfx::Vector2d& v) : width(v.x()), height(v.y()) {}
WebSize& operator=(const gfx::Size& s) { WebSize& operator=(const gfx::Size& s) {
...@@ -81,9 +90,8 @@ struct WebSize { ...@@ -81,9 +90,8 @@ struct WebSize {
return *this; return *this;
} }
operator gfx::Size() const { // Note that this conversion clamps to non-negative values.
return gfx::Size(std::max(0, width), std::max(0, height)); operator gfx::Size() const { return gfx::Size(width, height); }
}
operator gfx::Vector2d() const { return gfx::Vector2d(width, height); } operator gfx::Vector2d() const { return gfx::Vector2d(width, height); }
#endif #endif
......
...@@ -8,8 +8,10 @@ include_rules = [ ...@@ -8,8 +8,10 @@ include_rules = [
"+cc/base/region.h", "+cc/base/region.h",
"+cc/input/overscroll_behavior.h", "+cc/input/overscroll_behavior.h",
"+cc/layers/content_layer_client.h", "+cc/layers/content_layer_client.h",
"+cc/layers/layer.h",
"+cc/layers/layer_position_constraint.h", "+cc/layers/layer_position_constraint.h",
"+cc/layers/layer_sticky_position_constraint.h", "+cc/layers/layer_sticky_position_constraint.h",
"+cc/layers/scrollbar_layer_interface.h",
"+cc/paint/display_item_list.h", "+cc/paint/display_item_list.h",
"+gpu/config/gpu_feature_info.h", "+gpu/config/gpu_feature_info.h",
"-inspector/v8", "-inspector/v8",
......
...@@ -31,10 +31,13 @@ ...@@ -31,10 +31,13 @@
#include "third_party/blink/renderer/core/frame/visual_viewport.h" #include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include <memory> #include <memory>
#include "cc/layers/layer.h"
#include "cc/layers/scrollbar_layer_interface.h"
#include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_compositor_support.h" #include "third_party/blink/public/platform/web_compositor_support.h"
#include "third_party/blink/public/platform/web_layer.h"
#include "third_party/blink/public/platform/web_scrollbar.h" #include "third_party/blink/public/platform/web_scrollbar.h"
#include "third_party/blink/public/platform/web_scrollbar_layer.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h"
...@@ -47,7 +50,6 @@ ...@@ -47,7 +50,6 @@
#include "third_party/blink/renderer/core/layout/text_autosizer.h" #include "third_party/blink/renderer/core/layout/text_autosizer.h"
#include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/geometry/double_rect.h" #include "third_party/blink/renderer/platform/geometry/double_rect.h"
...@@ -444,9 +446,9 @@ void VisualViewport::SetupScrollbar(WebScrollbar::Orientation orientation) { ...@@ -444,9 +446,9 @@ void VisualViewport::SetupScrollbar(WebScrollbar::Orientation orientation) {
GraphicsLayer* scrollbar_graphics_layer = GraphicsLayer* scrollbar_graphics_layer =
is_horizontal ? overlay_scrollbar_horizontal_.get() is_horizontal ? overlay_scrollbar_horizontal_.get()
: overlay_scrollbar_vertical_.get(); : overlay_scrollbar_vertical_.get();
std::unique_ptr<WebScrollbarLayer>& web_scrollbar_layer = std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup>&
is_horizontal ? web_overlay_scrollbar_horizontal_ scrollbar_layer_group = is_horizontal ? scrollbar_layer_group_horizontal_
: web_overlay_scrollbar_vertical_; : scrollbar_layer_group_vertical_;
ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::MobileTheme(); ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::MobileTheme();
int thumb_thickness = clampTo<int>( int thumb_thickness = clampTo<int>(
...@@ -459,23 +461,23 @@ void VisualViewport::SetupScrollbar(WebScrollbar::Orientation orientation) { ...@@ -459,23 +461,23 @@ void VisualViewport::SetupScrollbar(WebScrollbar::Orientation orientation) {
std::floor(GetPage().GetChromeClient().WindowToViewportScalar( std::floor(GetPage().GetChromeClient().WindowToViewportScalar(
theme.ScrollbarMargin()))); theme.ScrollbarMargin())));
if (!web_scrollbar_layer) { if (!scrollbar_layer_group) {
ScrollingCoordinator* coordinator = GetPage().GetScrollingCoordinator(); ScrollingCoordinator* coordinator = GetPage().GetScrollingCoordinator();
DCHECK(coordinator); DCHECK(coordinator);
ScrollbarOrientation webcore_orientation = ScrollbarOrientation webcore_orientation =
is_horizontal ? kHorizontalScrollbar : kVerticalScrollbar; is_horizontal ? kHorizontalScrollbar : kVerticalScrollbar;
web_scrollbar_layer = coordinator->CreateSolidColorScrollbarLayer( scrollbar_layer_group = coordinator->CreateSolidColorScrollbarLayer(
webcore_orientation, thumb_thickness, scrollbar_margin, false); webcore_orientation, thumb_thickness, scrollbar_margin, false);
// The compositor will control the scrollbar's visibility. Set to invisible // The compositor will control the scrollbar's visibility. Set to invisible
// by default so scrollbars don't show up in layout tests. // by default so scrollbars don't show up in layout tests.
web_scrollbar_layer->Layer()->SetOpacity(0); scrollbar_layer_group->layer->SetOpacity(0.f);
scrollbar_graphics_layer->SetContentsToPlatformLayer( scrollbar_graphics_layer->SetContentsToPlatformLayer(
web_scrollbar_layer->Layer(), scrollbar_layer_group->web_layer.get(),
/*prevent_contents_opaque_changes=*/false); /*prevent_contents_opaque_changes=*/false);
scrollbar_graphics_layer->SetDrawsContent(false); scrollbar_graphics_layer->SetDrawsContent(false);
web_scrollbar_layer->SetScrollLayer( scrollbar_layer_group->scrollbar_layer->SetScrollElementId(
inner_viewport_scroll_layer_->PlatformLayer()); inner_viewport_scroll_layer_->PlatformLayer()->GetElementId());
} }
int x_position = is_horizontal int x_position = is_horizontal
......
...@@ -32,11 +32,13 @@ ...@@ -32,11 +32,13 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_VISUAL_VIEWPORT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_VISUAL_VIEWPORT_H_
#include <memory> #include <memory>
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "third_party/blink/public/platform/web_scrollbar.h" #include "third_party/blink/public/platform/web_scrollbar.h"
#include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/geometry/float_rect.h"
#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/geometry/float_size.h"
#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/geometry/int_size.h"
...@@ -44,10 +46,6 @@ ...@@ -44,10 +46,6 @@
#include "third_party/blink/renderer/platform/graphics/graphics_layer_client.h" #include "third_party/blink/renderer/platform/graphics/graphics_layer_client.h"
#include "third_party/blink/renderer/platform/scroll/scrollable_area.h" #include "third_party/blink/renderer/platform/scroll/scrollable_area.h"
namespace blink {
class WebScrollbarLayer;
}
namespace blink { namespace blink {
class GraphicsContext; class GraphicsContext;
...@@ -286,10 +284,13 @@ class CORE_EXPORT VisualViewport final ...@@ -286,10 +284,13 @@ class CORE_EXPORT VisualViewport final
std::unique_ptr<GraphicsLayer> page_scale_layer_; std::unique_ptr<GraphicsLayer> page_scale_layer_;
std::unique_ptr<GraphicsLayer> inner_viewport_scroll_layer_; std::unique_ptr<GraphicsLayer> inner_viewport_scroll_layer_;
// The layers of the WebScrollbarLayers are referenced from the GraphicsLayers // The layers of the ScrollbarLayerGroups are referenced from the
// so the GraphicsLayers must be destructed first (declared after). // GraphicsLayers, so the GraphicsLayers must be destructed first (declared
std::unique_ptr<WebScrollbarLayer> web_overlay_scrollbar_horizontal_; // after).
std::unique_ptr<WebScrollbarLayer> web_overlay_scrollbar_vertical_; std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup>
scrollbar_layer_group_horizontal_;
std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup>
scrollbar_layer_group_vertical_;
std::unique_ptr<GraphicsLayer> overlay_scrollbar_horizontal_; std::unique_ptr<GraphicsLayer> overlay_scrollbar_horizontal_;
std::unique_ptr<GraphicsLayer> overlay_scrollbar_vertical_; std::unique_ptr<GraphicsLayer> overlay_scrollbar_vertical_;
......
include_rules = [
"+cc/layers/painted_overlay_scrollbar_layer.h",
"+cc/layers/painted_scrollbar_layer.h",
"+cc/layers/solid_color_scrollbar_layer.h",
]
...@@ -38,6 +38,11 @@ ...@@ -38,6 +38,11 @@
#include "third_party/blink/renderer/platform/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/scroll/scroll_types.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace cc {
class Layer;
class ScrollbarLayerInterface;
} // namespace cc
namespace blink { namespace blink {
using MainThreadScrollingReasons = uint32_t; using MainThreadScrollingReasons = uint32_t;
...@@ -51,14 +56,14 @@ class Page; ...@@ -51,14 +56,14 @@ class Page;
class PaintLayer; class PaintLayer;
class Region; class Region;
class ScrollableArea; class ScrollableArea;
class WebLayer;
class WebLayerTreeView; class WebLayerTreeView;
class WebScrollbarLayer;
using ScrollbarId = uint64_t; using ScrollbarId = uint64_t;
// ScrollingCoordinator is a page-level object that mediates interactions // ScrollingCoordinator is a page-level object that mediates interactions
// between Blink and the compositor's scroll-related APIs on WebLayer and // between Blink and the compositor's scroll-related APIs on the composited
// WebScrollbarLayer. // layer representing the scrollbar.
// //
// It's responsible for propagating scroll offsets, main-thread scrolling // It's responsible for propagating scroll offsets, main-thread scrolling
// reasons, touch action regions, and non-fast-scrollable regions into the // reasons, touch action regions, and non-fast-scrollable regions into the
...@@ -67,6 +72,17 @@ using ScrollbarId = uint64_t; ...@@ -67,6 +72,17 @@ using ScrollbarId = uint64_t;
class CORE_EXPORT ScrollingCoordinator final class CORE_EXPORT ScrollingCoordinator final
: public GarbageCollectedFinalized<ScrollingCoordinator> { : public GarbageCollectedFinalized<ScrollingCoordinator> {
public: public:
struct ScrollbarLayerGroup {
// The compositor layer for the scrollbar. It can be one of a few
// concrete types, so we store the base type.
scoped_refptr<cc::Layer> layer;
// A wrapper for the |layer| for use in blink core.
std::unique_ptr<WebLayer> web_layer;
// An interface shared by all scrollbar layer types since we don't know
// the concrete |layer| type.
cc::ScrollbarLayerInterface* scrollbar_layer = nullptr;
};
static ScrollingCoordinator* Create(Page*); static ScrollingCoordinator* Create(Page*);
~ScrollingCoordinator(); ~ScrollingCoordinator();
...@@ -103,7 +119,7 @@ class CORE_EXPORT ScrollingCoordinator final ...@@ -103,7 +119,7 @@ class CORE_EXPORT ScrollingCoordinator final
// Should be called whenever the root layer for the given frame view changes. // Should be called whenever the root layer for the given frame view changes.
void FrameViewRootLayerDidChange(LocalFrameView*); void FrameViewRootLayerDidChange(LocalFrameView*);
std::unique_ptr<WebScrollbarLayer> CreateSolidColorScrollbarLayer( std::unique_ptr<ScrollbarLayerGroup> CreateSolidColorScrollbarLayer(
ScrollbarOrientation, ScrollbarOrientation,
int thumb_thickness, int thumb_thickness,
int track_start, int track_start,
...@@ -178,12 +194,12 @@ class CORE_EXPORT ScrollingCoordinator final ...@@ -178,12 +194,12 @@ class CORE_EXPORT ScrollingCoordinator final
void SetTouchEventTargetRects(LocalFrame*, LayerHitTestRects&); void SetTouchEventTargetRects(LocalFrame*, LayerHitTestRects&);
void ComputeTouchEventTargetRects(LocalFrame*, LayerHitTestRects&); void ComputeTouchEventTargetRects(LocalFrame*, LayerHitTestRects&);
WebScrollbarLayer* AddWebScrollbarLayer(ScrollableArea*, void AddScrollbarLayerGroup(ScrollableArea*,
ScrollbarOrientation, ScrollbarOrientation,
std::unique_ptr<WebScrollbarLayer>); std::unique_ptr<ScrollbarLayerGroup>);
WebScrollbarLayer* GetWebScrollbarLayer(ScrollableArea*, ScrollbarLayerGroup* GetScrollbarLayerGroup(ScrollableArea*,
ScrollbarOrientation); ScrollbarOrientation);
void RemoveWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); void RemoveScrollbarLayerGroup(ScrollableArea*, ScrollbarOrientation);
bool FrameScrollerIsDirty(LocalFrameView*) const; bool FrameScrollerIsDirty(LocalFrameView*) const;
...@@ -192,7 +208,7 @@ class CORE_EXPORT ScrollingCoordinator final ...@@ -192,7 +208,7 @@ class CORE_EXPORT ScrollingCoordinator final
programmatic_scroll_animator_timeline_; programmatic_scroll_animator_timeline_;
using ScrollbarMap = using ScrollbarMap =
HeapHashMap<Member<ScrollableArea>, std::unique_ptr<WebScrollbarLayer>>; HeapHashMap<Member<ScrollableArea>, std::unique_ptr<ScrollbarLayerGroup>>;
ScrollbarMap horizontal_scrollbars_; ScrollbarMap horizontal_scrollbars_;
ScrollbarMap vertical_scrollbars_; ScrollbarMap vertical_scrollbars_;
......
...@@ -885,7 +885,7 @@ TEST_P(ScrollingCoordinatorTest, setupScrollbarLayerShouldNotCrash) { ...@@ -885,7 +885,7 @@ TEST_P(ScrollingCoordinatorTest, setupScrollbarLayerShouldNotCrash) {
} }
TEST_P(ScrollingCoordinatorTest, TEST_P(ScrollingCoordinatorTest,
scrollbarsForceMainThreadOrHaveWebScrollbarLayer) { ScrollbarsForceMainThreadOrHaveCompositorScrollbarLayer) {
RegisterMockedHttpURLLoad("trivial-scroller.html"); RegisterMockedHttpURLLoad("trivial-scroller.html");
NavigateTo(base_url_ + "trivial-scroller.html"); NavigateTo(base_url_ + "trivial-scroller.html");
ForceFullCompositingUpdate(); ForceFullCompositingUpdate();
......
...@@ -1320,6 +1320,8 @@ jumbo_component("platform") { ...@@ -1320,6 +1320,8 @@ jumbo_component("platform") {
"scroll/scrollable_area.h", "scroll/scrollable_area.h",
"scroll/scrollbar.cc", "scroll/scrollbar.cc",
"scroll/scrollbar.h", "scroll/scrollbar.h",
"scroll/scrollbar_layer_delegate.cc",
"scroll/scrollbar_layer_delegate.h",
"scroll/scrollbar_theme.cc", "scroll/scrollbar_theme.cc",
"scroll/scrollbar_theme.h", "scroll/scrollbar_theme.h",
"scroll/scrollbar_theme_android.cc", "scroll/scrollbar_theme_android.cc",
......
...@@ -2,127 +2,130 @@ ...@@ -2,127 +2,130 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cc/blink/scrollbar_impl.h" #include "third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.h"
#include "base/logging.h" #include "third_party/blink/public/platform/web_point.h"
#include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_scrollbar.h" #include "third_party/blink/public/platform/web_scrollbar.h"
#include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h" #include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h"
using blink::WebScrollbar; namespace blink {
namespace cc_blink { ScrollbarLayerDelegate::ScrollbarLayerDelegate(
ScrollbarImpl::ScrollbarImpl(
std::unique_ptr<WebScrollbar> scrollbar, std::unique_ptr<WebScrollbar> scrollbar,
blink::WebScrollbarThemePainter painter, WebScrollbarThemePainter painter,
std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry) std::unique_ptr<WebScrollbarThemeGeometry> geometry)
: scrollbar_(std::move(scrollbar)), : scrollbar_(std::move(scrollbar)),
painter_(painter), painter_(painter),
geometry_(std::move(geometry)) {} geometry_(std::move(geometry)) {}
ScrollbarImpl::~ScrollbarImpl() = default; ScrollbarLayerDelegate::~ScrollbarLayerDelegate() = default;
cc::ScrollbarOrientation ScrollbarImpl::Orientation() const { cc::ScrollbarOrientation ScrollbarLayerDelegate::Orientation() const {
if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal)
return cc::HORIZONTAL; return cc::HORIZONTAL;
return cc::VERTICAL; return cc::VERTICAL;
} }
bool ScrollbarImpl::IsLeftSideVerticalScrollbar() const { bool ScrollbarLayerDelegate::IsLeftSideVerticalScrollbar() const {
return scrollbar_->IsLeftSideVerticalScrollbar(); return scrollbar_->IsLeftSideVerticalScrollbar();
} }
bool ScrollbarImpl::HasThumb() const { bool ScrollbarLayerDelegate::HasThumb() const {
return geometry_->HasThumb(scrollbar_.get()); return geometry_->HasThumb(scrollbar_.get());
} }
bool ScrollbarImpl::IsOverlay() const { bool ScrollbarLayerDelegate::IsOverlay() const {
return scrollbar_->IsOverlay(); return scrollbar_->IsOverlay();
} }
gfx::Point ScrollbarImpl::Location() const { gfx::Point ScrollbarLayerDelegate::Location() const {
return scrollbar_->Location(); return static_cast<gfx::Point>(scrollbar_->Location());
} }
int ScrollbarImpl::ThumbThickness() const { int ScrollbarLayerDelegate::ThumbThickness() const {
gfx::Rect thumb_rect = geometry_->ThumbRect(scrollbar_.get()); auto thumb_rect =
static_cast<gfx::Rect>(geometry_->ThumbRect(scrollbar_.get()));
if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal)
return thumb_rect.height(); return thumb_rect.height();
return thumb_rect.width(); return thumb_rect.width();
} }
int ScrollbarImpl::ThumbLength() const { int ScrollbarLayerDelegate::ThumbLength() const {
gfx::Rect thumb_rect = geometry_->ThumbRect(scrollbar_.get()); auto thumb_rect =
static_cast<gfx::Rect>(geometry_->ThumbRect(scrollbar_.get()));
if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal)
return thumb_rect.width(); return thumb_rect.width();
return thumb_rect.height(); return thumb_rect.height();
} }
gfx::Rect ScrollbarImpl::TrackRect() const { gfx::Rect ScrollbarLayerDelegate::TrackRect() const {
return geometry_->TrackRect(scrollbar_.get()); return static_cast<gfx::Rect>(geometry_->TrackRect(scrollbar_.get()));
} }
float ScrollbarImpl::ThumbOpacity() const { float ScrollbarLayerDelegate::ThumbOpacity() const {
return painter_.ThumbOpacity(); return painter_.ThumbOpacity();
} }
bool ScrollbarImpl::NeedsPaintPart(cc::ScrollbarPart part) const { bool ScrollbarLayerDelegate::NeedsPaintPart(cc::ScrollbarPart part) const {
if (part == cc::THUMB) if (part == cc::THUMB)
return painter_.ThumbNeedsRepaint(); return painter_.ThumbNeedsRepaint();
return painter_.TrackNeedsRepaint(); return painter_.TrackNeedsRepaint();
} }
bool ScrollbarImpl::UsesNinePatchThumbResource() const { bool ScrollbarLayerDelegate::UsesNinePatchThumbResource() const {
return painter_.UsesNinePatchThumbResource(); return painter_.UsesNinePatchThumbResource();
} }
gfx::Size ScrollbarImpl::NinePatchThumbCanvasSize() const { gfx::Size ScrollbarLayerDelegate::NinePatchThumbCanvasSize() const {
return geometry_->NinePatchThumbCanvasSize(scrollbar_.get()); return static_cast<gfx::Size>(
geometry_->NinePatchThumbCanvasSize(scrollbar_.get()));
} }
gfx::Rect ScrollbarImpl::NinePatchThumbAperture() const { gfx::Rect ScrollbarLayerDelegate::NinePatchThumbAperture() const {
return geometry_->NinePatchThumbAperture(scrollbar_.get()); return static_cast<gfx::Rect>(
geometry_->NinePatchThumbAperture(scrollbar_.get()));
} }
bool ScrollbarImpl::HasTickmarks() const { bool ScrollbarLayerDelegate::HasTickmarks() const {
return scrollbar_->HasTickmarks(); return scrollbar_->HasTickmarks();
} }
void ScrollbarImpl::PaintPart(cc::PaintCanvas* canvas, void ScrollbarLayerDelegate::PaintPart(cc::PaintCanvas* canvas,
cc::ScrollbarPart part, cc::ScrollbarPart part,
const gfx::Rect& content_rect) { const gfx::Rect& content_rect) {
if (part == cc::THUMB) { if (part == cc::THUMB) {
painter_.PaintThumb(canvas, content_rect); painter_.PaintThumb(canvas, WebRect(content_rect));
return; return;
} }
if (part == cc::TICKMARKS) { if (part == cc::TICKMARKS) {
painter_.PaintTickmarks(canvas, content_rect); painter_.PaintTickmarks(canvas, WebRect(content_rect));
return; return;
} }
// The following is a simplification of ScrollbarThemeComposite::paint. // The following is a simplification of ScrollbarThemeComposite::paint.
painter_.PaintScrollbarBackground(canvas, content_rect); painter_.PaintScrollbarBackground(canvas, WebRect(content_rect));
if (geometry_->HasButtons(scrollbar_.get())) { if (geometry_->HasButtons(scrollbar_.get())) {
gfx::Rect back_button_start_paint_rect = WebRect back_button_start_paint_rect =
geometry_->BackButtonStartRect(scrollbar_.get()); geometry_->BackButtonStartRect(scrollbar_.get());
painter_.PaintBackButtonStart(canvas, back_button_start_paint_rect); painter_.PaintBackButtonStart(canvas, back_button_start_paint_rect);
gfx::Rect back_button_end_paint_rect = WebRect back_button_end_paint_rect =
geometry_->BackButtonEndRect(scrollbar_.get()); geometry_->BackButtonEndRect(scrollbar_.get());
painter_.PaintBackButtonEnd(canvas, back_button_end_paint_rect); painter_.PaintBackButtonEnd(canvas, back_button_end_paint_rect);
gfx::Rect forward_button_start_paint_rect = WebRect forward_button_start_paint_rect =
geometry_->ForwardButtonStartRect(scrollbar_.get()); geometry_->ForwardButtonStartRect(scrollbar_.get());
painter_.PaintForwardButtonStart(canvas, forward_button_start_paint_rect); painter_.PaintForwardButtonStart(canvas, forward_button_start_paint_rect);
gfx::Rect forward_button_end_paint_rect = WebRect forward_button_end_paint_rect =
geometry_->ForwardButtonEndRect(scrollbar_.get()); geometry_->ForwardButtonEndRect(scrollbar_.get());
painter_.PaintForwardButtonEnd(canvas, forward_button_end_paint_rect); painter_.PaintForwardButtonEnd(canvas, forward_button_end_paint_rect);
} }
gfx::Rect track_paint_rect = geometry_->TrackRect(scrollbar_.get()); WebRect track_paint_rect = geometry_->TrackRect(scrollbar_.get());
painter_.PaintTrackBackground(canvas, track_paint_rect); painter_.PaintTrackBackground(canvas, track_paint_rect);
bool thumb_present = geometry_->HasThumb(scrollbar_.get()); bool thumb_present = geometry_->HasThumb(scrollbar_.get());
...@@ -134,4 +137,4 @@ void ScrollbarImpl::PaintPart(cc::PaintCanvas* canvas, ...@@ -134,4 +137,4 @@ void ScrollbarImpl::PaintPart(cc::PaintCanvas* canvas,
painter_.PaintTickmarks(canvas, track_paint_rect); painter_.PaintTickmarks(canvas, track_paint_rect);
} }
} // namespace cc_blink } // namespace blink
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CC_BLINK_SCROLLBAR_IMPL_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_LAYER_DELEGATE_H_
#define CC_BLINK_SCROLLBAR_IMPL_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_LAYER_DELEGATE_H_
#include <memory> #include <memory>
...@@ -11,20 +11,20 @@ ...@@ -11,20 +11,20 @@
#include "cc/input/scrollbar.h" #include "cc/input/scrollbar.h"
#include "cc/paint/paint_canvas.h" #include "cc/paint/paint_canvas.h"
#include "third_party/blink/public/platform/web_scrollbar_theme_painter.h" #include "third_party/blink/public/platform/web_scrollbar_theme_painter.h"
#include "third_party/blink/renderer/platform/platform_export.h"
namespace blink { namespace blink {
class WebScrollbar; class WebScrollbar;
class WebScrollbarThemeGeometry; class WebScrollbarThemeGeometry;
}
namespace cc_blink { // Implementation of cc::Scrollbar, providing a delegate to query about
// scrollbar state and to paint the image in the scrollbar.
class ScrollbarImpl : public cc::Scrollbar { class PLATFORM_EXPORT ScrollbarLayerDelegate : public cc::Scrollbar {
public: public:
ScrollbarImpl(std::unique_ptr<blink::WebScrollbar> scrollbar, ScrollbarLayerDelegate(std::unique_ptr<WebScrollbar> scrollbar,
blink::WebScrollbarThemePainter painter, WebScrollbarThemePainter painter,
std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry); std::unique_ptr<WebScrollbarThemeGeometry> geometry);
~ScrollbarImpl() override; ~ScrollbarLayerDelegate() override;
// cc::Scrollbar implementation. // cc::Scrollbar implementation.
cc::ScrollbarOrientation Orientation() const override; cc::ScrollbarOrientation Orientation() const override;
...@@ -47,13 +47,13 @@ class ScrollbarImpl : public cc::Scrollbar { ...@@ -47,13 +47,13 @@ class ScrollbarImpl : public cc::Scrollbar {
gfx::Rect NinePatchThumbAperture() const override; gfx::Rect NinePatchThumbAperture() const override;
private: private:
std::unique_ptr<blink::WebScrollbar> scrollbar_; std::unique_ptr<WebScrollbar> scrollbar_;
blink::WebScrollbarThemePainter painter_; WebScrollbarThemePainter painter_;
std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry_; std::unique_ptr<WebScrollbarThemeGeometry> geometry_;
DISALLOW_COPY_AND_ASSIGN(ScrollbarImpl); DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerDelegate);
}; };
} // namespace cc_blink } // namespace blink
#endif // CC_BLINK_SCROLLBAR_IMPL_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_LAYER_DELEGATE_H_
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "third_party/blink/public/platform/web_external_texture_layer.h" #include "third_party/blink/public/platform/web_external_texture_layer.h"
#include "third_party/blink/public/platform/web_image_layer.h" #include "third_party/blink/public/platform/web_image_layer.h"
#include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/public/platform/web_scrollbar_layer.h"
#include "third_party/blink/renderer/platform/font_family_names.h" #include "third_party/blink/renderer/platform/font_family_names.h"
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/resource_coordinator/blink_resource_coordinator_base.h" #include "third_party/blink/renderer/platform/instrumentation/resource_coordinator/blink_resource_coordinator_base.h"
...@@ -108,31 +107,6 @@ std::unique_ptr<WebImageLayer> TestingCompositorSupport::CreateImageLayer() { ...@@ -108,31 +107,6 @@ std::unique_ptr<WebImageLayer> TestingCompositorSupport::CreateImageLayer() {
return nullptr; return nullptr;
} }
std::unique_ptr<WebScrollbarLayer>
TestingCompositorSupport::CreateScrollbarLayer(
std::unique_ptr<WebScrollbar>,
WebScrollbarThemePainter,
std::unique_ptr<WebScrollbarThemeGeometry>) {
return nullptr;
}
std::unique_ptr<WebScrollbarLayer>
TestingCompositorSupport::CreateOverlayScrollbarLayer(
std::unique_ptr<WebScrollbar>,
WebScrollbarThemePainter,
std::unique_ptr<WebScrollbarThemeGeometry>) {
return nullptr;
}
std::unique_ptr<WebScrollbarLayer>
TestingCompositorSupport::CreateSolidColorScrollbarLayer(
WebScrollbar::Orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar) {
return nullptr;
}
TestingPlatformSupport::TestingPlatformSupport() TestingPlatformSupport::TestingPlatformSupport()
: TestingPlatformSupport(TestingPlatformSupport::Config()) {} : TestingPlatformSupport(TestingPlatformSupport::Config()) {}
......
...@@ -59,19 +59,6 @@ class TestingCompositorSupport : public WebCompositorSupport { ...@@ -59,19 +59,6 @@ class TestingCompositorSupport : public WebCompositorSupport {
std::unique_ptr<WebContentLayer> CreateContentLayer( std::unique_ptr<WebContentLayer> CreateContentLayer(
cc::ContentLayerClient*) override; cc::ContentLayerClient*) override;
std::unique_ptr<WebImageLayer> CreateImageLayer() override; std::unique_ptr<WebImageLayer> CreateImageLayer() override;
std::unique_ptr<WebScrollbarLayer> CreateScrollbarLayer(
std::unique_ptr<WebScrollbar>,
WebScrollbarThemePainter,
std::unique_ptr<WebScrollbarThemeGeometry>) override;
std::unique_ptr<WebScrollbarLayer> CreateOverlayScrollbarLayer(
std::unique_ptr<WebScrollbar>,
WebScrollbarThemePainter,
std::unique_ptr<WebScrollbarThemeGeometry>) override;
std::unique_ptr<WebScrollbarLayer> CreateSolidColorScrollbarLayer(
WebScrollbar::Orientation,
int thumb_thickness,
int track_start,
bool is_left_side_vertical_scrollbar) override;
}; };
// A base class to override Platform methods for testing. You can override the // A base class to override Platform methods for testing. You can override the
......
...@@ -80,6 +80,7 @@ _CONFIG = [ ...@@ -80,6 +80,7 @@ _CONFIG = [
'base::FEATURE_.+', 'base::FEATURE_.+',
# Chromium geometry types. # Chromium geometry types.
'gfx::Point',
'gfx::Rect', 'gfx::Rect',
'gfx::RectF', 'gfx::RectF',
'gfx::Size', 'gfx::Size',
...@@ -92,10 +93,24 @@ _CONFIG = [ ...@@ -92,10 +93,24 @@ _CONFIG = [
# depends on the geometry types above. # depends on the geometry types above.
'cc::TouchActionRegion', 'cc::TouchActionRegion',
# cc::Layers.
'cc::Layer',
# cc::Layer helper data structs. # cc::Layer helper data structs.
'cc::ElementId',
'cc::LayerPositionConstraint', 'cc::LayerPositionConstraint',
'cc::LayerStickyPositionConstraint', 'cc::LayerStickyPositionConstraint',
'cc::OverscrollBehavior', 'cc::OverscrollBehavior',
'cc::Scrollbar',
'cc::ScrollbarLayerInterface',
'cc::ScrollbarOrientation',
'cc::ScrollbarPart',
# cc::Layer helper enums.
'cc::HORIZONTAL',
'cc::VERTICAL',
'cc::THUMB',
'cc::TICKMARKS',
# Standalone utility libraries that only depend on //base # Standalone utility libraries that only depend on //base
'skia::.+', 'skia::.+',
...@@ -176,6 +191,18 @@ _CONFIG = [ ...@@ -176,6 +191,18 @@ _CONFIG = [
'cc::DrawRecordOp', 'cc::DrawRecordOp',
], ],
}, },
{
'paths': ['third_party/blink/renderer/core/page/scrolling'],
'allowed': [
# cc painting types.
'cc::PaintCanvas',
# cc scrollbar layer types.
'cc::PaintedOverlayScrollbarLayer',
'cc::PaintedScrollbarLayer',
'cc::SolidColorScrollbarLayer',
],
},
{ {
'paths': ['third_party/blink/renderer/core/inspector/InspectorMemoryAgent.cpp'], 'paths': ['third_party/blink/renderer/core/inspector/InspectorMemoryAgent.cpp'],
'allowed': [ 'allowed': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment