Commit 03814999 authored by danakj's avatar danakj Committed by Commit Bot

blink: Remove WebContentLayer.

Own a cc::PictureLayer directly in GraphicsLayer and LinkHighlightImpl
and expose it instead of WebContentLayer*. Wrap it in a WebLayer for
interactions that require one of those for now.

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

Bug: 838693
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: I5486b58337987dbfa13e2048dcdf10ae059beea5
Reviewed-on: https://chromium-review.googlesource.com/1048545
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557231}
parent b94880fa
......@@ -11,8 +11,6 @@ cc_component("blink") {
"cc_blink_export.h",
"web_compositor_support_impl.cc",
"web_compositor_support_impl.h",
"web_content_layer_impl.cc",
"web_content_layer_impl.h",
"web_image_layer_impl.cc",
"web_image_layer_impl.h",
"web_layer_impl.cc",
......
......@@ -6,12 +6,10 @@
#include <utility>
#include "cc/blink/web_content_layer_impl.h"
#include "cc/blink/web_image_layer_impl.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/layers/layer.h"
using blink::WebContentLayer;
using blink::WebImageLayer;
using blink::WebLayer;
......@@ -30,11 +28,6 @@ std::unique_ptr<WebLayer> WebCompositorSupportImpl::CreateLayerFromCCLayer(
return std::make_unique<WebLayerImpl>(layer);
}
std::unique_ptr<WebContentLayer> WebCompositorSupportImpl::CreateContentLayer(
cc::ContentLayerClient* client) {
return std::make_unique<WebContentLayerImpl>(client);
}
std::unique_ptr<blink::WebImageLayer>
WebCompositorSupportImpl::CreateImageLayer() {
return std::make_unique<WebImageLayerImpl>();
......
......@@ -11,10 +11,6 @@
#include "third_party/blink/public/platform/web_compositor_support.h"
#include "third_party/blink/public/platform/web_layer.h"
namespace cc {
class ContentLayerClient;
}
namespace cc_blink {
class CC_BLINK_EXPORT WebCompositorSupportImpl
......@@ -25,8 +21,6 @@ class CC_BLINK_EXPORT WebCompositorSupportImpl
std::unique_ptr<blink::WebLayer> CreateLayer() override;
std::unique_ptr<blink::WebLayer> CreateLayerFromCCLayer(cc::Layer*) override;
std::unique_ptr<blink::WebContentLayer> CreateContentLayer(
cc::ContentLayerClient* client) override;
std::unique_ptr<blink::WebImageLayer> CreateImageLayer() override;
private:
......
// 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_content_layer_impl.h"
#include <stddef.h>
#include "base/command_line.h"
#include "cc/base/switches.h"
#include "cc/layers/content_layer_client.h"
#include "cc/layers/picture_layer.h"
#include "third_party/blink/public/platform/web_float_point.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_size.h"
#include "third_party/skia/include/core/SkMatrix44.h"
using cc::PictureLayer;
namespace cc_blink {
WebContentLayerImpl::WebContentLayerImpl(cc::ContentLayerClient* client)
: client_(client) {
layer_ = std::make_unique<WebLayerImpl>(PictureLayer::Create(this));
}
WebContentLayerImpl::~WebContentLayerImpl() {
static_cast<PictureLayer*>(layer_->layer())->ClearClient();
}
blink::WebLayer* WebContentLayerImpl::Layer() {
return layer_.get();
}
void WebContentLayerImpl::SetTransformedRasterizationAllowed(bool allowed) {
static_cast<PictureLayer*>(layer_->layer())
->SetTransformedRasterizationAllowed(allowed);
}
bool WebContentLayerImpl::TransformedRasterizationAllowed() const {
return static_cast<PictureLayer*>(layer_->layer())
->transformed_rasterization_allowed();
}
gfx::Rect WebContentLayerImpl::PaintableRegion() {
return client_->PaintableRegion();
}
scoped_refptr<cc::DisplayItemList>
WebContentLayerImpl::PaintContentsToDisplayList(
PaintingControlSetting painting_control) {
return client_->PaintContentsToDisplayList(painting_control);
}
bool WebContentLayerImpl::FillsBoundsCompletely() const {
return client_->FillsBoundsCompletely();
}
size_t WebContentLayerImpl::GetApproximateUnsharedMemoryUsage() const {
return client_->GetApproximateUnsharedMemoryUsage();
}
} // 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_CONTENT_LAYER_IMPL_H_
#define CC_BLINK_WEB_CONTENT_LAYER_IMPL_H_
#include <stddef.h>
#include <memory>
#include "base/macros.h"
#include "cc/blink/cc_blink_export.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/layers/content_layer_client.h"
#include "third_party/blink/public/platform/web_content_layer.h"
namespace cc {
class ContentLayerClient;
}
namespace cc_blink {
class WebContentLayerImpl : public blink::WebContentLayer,
public cc::ContentLayerClient {
public:
CC_BLINK_EXPORT explicit WebContentLayerImpl(cc::ContentLayerClient*);
~WebContentLayerImpl() override;
// WebContentLayer implementation.
blink::WebLayer* Layer() override;
void SetTransformedRasterizationAllowed(bool) override;
bool TransformedRasterizationAllowed() const override;
protected:
// ContentLayerClient implementation.
gfx::Rect PaintableRegion() override;
scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList(
PaintingControlSetting painting_control) override;
bool FillsBoundsCompletely() const override;
size_t GetApproximateUnsharedMemoryUsage() const override;
std::unique_ptr<WebLayerImpl> layer_;
cc::ContentLayerClient* client_;
private:
DISALLOW_COPY_AND_ASSIGN(WebContentLayerImpl);
};
} // namespace cc_blink
#endif // CC_BLINK_WEB_CONTENT_LAYER_IMPL_H_
......@@ -232,7 +232,6 @@ source_set("blink_headers") {
"platform/web_content_decryption_module_exception.h",
"platform/web_content_decryption_module_result.h",
"platform/web_content_decryption_module_session.h",
"platform/web_content_layer.h",
"platform/web_content_security_policy.h",
"platform/web_content_security_policy_struct.h",
"platform/web_content_setting_callbacks.h",
......
......@@ -35,13 +35,11 @@
#include <memory>
namespace cc {
class ContentLayerClient;
class Layer;
}
namespace blink {
class WebContentLayer;
class WebImageLayer;
class WebLayer;
......@@ -50,12 +48,7 @@ class WebCompositorSupport {
// Layers -------------------------------------------------------
virtual std::unique_ptr<WebLayer> CreateLayer() = 0;
virtual std::unique_ptr<WebLayer> CreateLayerFromCCLayer(cc::Layer*) = 0;
virtual std::unique_ptr<WebContentLayer> CreateContentLayer(
cc::ContentLayerClient*) = 0;
virtual std::unique_ptr<WebImageLayer> CreateImageLayer() = 0;
protected:
......
/*
* Copyright (C) 2011 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_CONTENT_LAYER_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_LAYER_H_
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/platform/web_layer.h"
namespace blink {
class WebContentLayer {
public:
virtual ~WebContentLayer() = default;
// The WebContentLayer has ownership of this wrapper.
virtual WebLayer* Layer() = 0;
// Normally content layers are rasterized in a space with both axis and
// origin aligned to local layer space, optionally with a uniform scale.
// With this flag set to true, the compositor may raster contents in any
// space, e.g. device pixel space.
virtual void SetTransformedRasterizationAllowed(bool) = 0;
virtual bool TransformedRasterizationAllowed() const = 0;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_LAYER_H_
include_rules = [
# This goes away after slimming paint v2. For now it violates strict onion
# soup guidelines.
"+cc/layers/picture_layer.h",
]
......@@ -28,6 +28,7 @@
#include <memory>
#include "cc/input/overscroll_behavior.h"
#include "cc/layers/picture_layer.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
......
......@@ -4,8 +4,8 @@
#include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h"
#include "cc/layers/picture_layer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_content_layer.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/layout/layout_box_model_object.h"
#include "third_party/blink/renderer/core/layout/layout_image.h"
......@@ -2357,7 +2357,7 @@ TEST_P(CompositedLayerMappingTest,
target_layer ? target_layer->GraphicsLayerBacking() : nullptr;
ASSERT_TRUE(target_graphics_layer);
EXPECT_FALSE(target_graphics_layer->ContentLayer()
->TransformedRasterizationAllowed());
->transformed_rasterization_allowed());
}
{
LayoutObject* target = GetLayoutObjectByElementId("target2");
......@@ -2367,7 +2367,7 @@ TEST_P(CompositedLayerMappingTest,
target_layer ? target_layer->GraphicsLayerBacking() : nullptr;
ASSERT_TRUE(target_graphics_layer);
EXPECT_FALSE(target_graphics_layer->ContentLayer()
->TransformedRasterizationAllowed());
->transformed_rasterization_allowed());
}
{
LayoutObject* target = GetLayoutObjectByElementId("target3");
......@@ -2377,7 +2377,7 @@ TEST_P(CompositedLayerMappingTest,
target_layer ? target_layer->GraphicsLayerBacking() : nullptr;
ASSERT_TRUE(target_graphics_layer);
EXPECT_FALSE(target_graphics_layer->ContentLayer()
->TransformedRasterizationAllowed());
->transformed_rasterization_allowed());
}
}
......@@ -2399,8 +2399,8 @@ TEST_P(CompositedLayerMappingTest, TransformedRasterizationForInlineTransform) {
GraphicsLayer* target_graphics_layer =
target_layer ? target_layer->GraphicsLayerBacking() : nullptr;
ASSERT_TRUE(target_graphics_layer);
EXPECT_TRUE(
target_graphics_layer->ContentLayer()->TransformedRasterizationAllowed());
EXPECT_TRUE(target_graphics_layer->ContentLayer()
->transformed_rasterization_allowed());
}
// This tests that when the scroller becomes no longer scrollable if a sticky
......
......@@ -29,10 +29,10 @@
#include <utility>
#include "base/memory/ptr_util.h"
#include "cc/layers/picture_layer.h"
#include "cc/paint/display_item_list.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_compositor_support.h"
#include "third_party/blink/public/platform/web_content_layer.h"
#include "third_party/blink/public/platform/web_float_point.h"
#include "third_party/blink/public/platform/web_layer.h"
#include "third_party/blink/public/platform/web_rect.h"
......@@ -90,10 +90,12 @@ LinkHighlightImpl::LinkHighlightImpl(Node* node, WebViewImpl* owning_web_view)
WebCompositorSupport* compositor_support =
Platform::Current()->CompositorSupport();
DCHECK(compositor_support);
content_layer_ = compositor_support->CreateContentLayer(this);
content_layer_ = cc::PictureLayer::Create(this);
web_content_layer_ =
compositor_support->CreateLayerFromCCLayer(content_layer_.get());
clip_layer_ = compositor_support->CreateLayer();
clip_layer_->SetTransformOrigin(FloatPoint3D());
clip_layer_->AddChild(content_layer_->Layer());
clip_layer_->AddChild(web_content_layer_.get());
compositor_animation_ = CompositorAnimation::Create();
DCHECK(compositor_animation_);
......@@ -104,9 +106,9 @@ LinkHighlightImpl::LinkHighlightImpl(Node* node, WebViewImpl* owning_web_view)
CompositorElementId element_id =
CompositorElementIdFromUniqueObjectId(unique_id_);
compositor_animation_->AttachElement(element_id);
content_layer_->Layer()->SetDrawsContent(true);
content_layer_->Layer()->SetOpacity(1);
content_layer_->Layer()->SetElementId(element_id);
content_layer_->SetIsDrawable(true);
content_layer_->SetOpacity(1);
content_layer_->SetElementId(element_id);
geometry_needs_update_ = true;
}
......@@ -122,7 +124,7 @@ LinkHighlightImpl::~LinkHighlightImpl() {
ReleaseResources();
}
WebContentLayer* LinkHighlightImpl::ContentLayer() {
cc::PictureLayer* LinkHighlightImpl::ContentLayer() {
return content_layer_.get();
}
......@@ -260,17 +262,17 @@ bool LinkHighlightImpl::ComputeHighlightLayerPathAndPosition(
bool path_has_changed = !(new_path == path_);
if (path_has_changed) {
path_ = new_path;
content_layer_->Layer()->SetBounds(
content_layer_->SetBounds(
static_cast<gfx::Size>(EnclosingIntRect(bounding_rect).Size()));
}
content_layer_->Layer()->SetPosition(bounding_rect.Location());
content_layer_->SetPosition(bounding_rect.Location());
return path_has_changed;
}
gfx::Rect LinkHighlightImpl::PaintableRegion() {
return gfx::Rect(ContentLayer()->Layer()->Bounds());
return gfx::Rect(content_layer_->bounds());
}
scoped_refptr<cc::DisplayItemList>
......@@ -311,7 +313,7 @@ void LinkHighlightImpl::StartHighlightAnimationIfNeeded() {
const float kFadeDuration = 0.1f;
const float kMinPreFadeDuration = 0.1f;
content_layer_->Layer()->SetOpacity(kStartOpacity);
content_layer_->SetOpacity(kStartOpacity);
std::unique_ptr<CompositorFloatAnimationCurve> curve =
CompositorFloatAnimationCurve::Create();
......@@ -340,7 +342,7 @@ void LinkHighlightImpl::StartHighlightAnimationIfNeeded() {
CompositorKeyframeModel::Create(*curve, CompositorTargetProperty::OPACITY,
0, 0);
content_layer_->Layer()->SetDrawsContent(true);
content_layer_->SetIsDrawable(true);
compositor_animation_->AddKeyframeModel(std::move(keyframe_model));
Invalidate();
......@@ -385,7 +387,7 @@ void LinkHighlightImpl::UpdateGeometry() {
// We only need to invalidate the layer if the highlight size has changed,
// otherwise we can just re-position the layer without needing to
// repaint.
content_layer_->Layer()->Invalidate();
content_layer_->SetNeedsDisplay();
if (current_graphics_layer_) {
gfx::Rect rect = gfx::ToEnclosingRect(
......
......@@ -29,7 +29,6 @@
#include <memory>
#include "cc/layers/content_layer_client.h"
#include "third_party/blink/public/platform/web_content_layer.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_client.h"
......@@ -40,12 +39,15 @@
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
namespace cc {
class PictureLayer;
}
namespace blink {
class GraphicsLayer;
class LayoutBoxModelObject;
class Node;
class WebContentLayer;
class WebLayer;
class WebViewImpl;
......@@ -57,7 +59,7 @@ class CORE_EXPORT LinkHighlightImpl final : public LinkHighlight,
static std::unique_ptr<LinkHighlightImpl> Create(Node*, WebViewImpl*);
~LinkHighlightImpl() override;
WebContentLayer* ContentLayer();
cc::PictureLayer* ContentLayer();
WebLayer* ClipLayer();
void StartHighlightAnimationIfNeeded();
void UpdateGeometry();
......@@ -99,7 +101,8 @@ class CORE_EXPORT LinkHighlightImpl final : public LinkHighlight,
// changed size since the last call to this function.
bool ComputeHighlightLayerPathAndPosition(const LayoutBoxModelObject&);
std::unique_ptr<WebContentLayer> content_layer_;
scoped_refptr<cc::PictureLayer> content_layer_;
std::unique_ptr<WebLayer> web_content_layer_; // Wraps |content_layer_|.
std::unique_ptr<WebLayer> clip_layer_;
Path path_;
......
......@@ -26,9 +26,9 @@
#include "third_party/blink/renderer/core/paint/link_highlight_impl.h"
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_content_layer.h"
#include "third_party/blink/public/platform/web_float_point.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_size.h"
......
......@@ -33,6 +33,7 @@
#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event_argument.h"
#include "cc/layers/layer.h"
#include "cc/layers/picture_layer.h"
#include "cc/paint/display_item_list.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_compositor_support.h"
......@@ -113,15 +114,17 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient& client)
#if DCHECK_IS_ON()
client.VerifyNotPainting();
#endif
layer_ = Platform::Current()->CompositorSupport()->CreateContentLayer(this);
layer_->Layer()->SetDrawsContent(draws_content_ && contents_visible_);
layer_->Layer()->SetLayerClient(weak_ptr_factory_.GetWeakPtr());
layer_ = cc::PictureLayer::Create(this);
web_layer_ = Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer(
layer_.get());
layer_->SetIsDrawable(draws_content_ && contents_visible_);
layer_->SetLayerClient(weak_ptr_factory_.GetWeakPtr());
UpdateTrackingRasterInvalidations();
}
GraphicsLayer::~GraphicsLayer() {
layer_->Layer()->SetLayerClient(nullptr);
layer_->SetLayerClient(nullptr);
SetContentsLayer(nullptr);
for (size_t i = 0; i < link_highlights_.size(); ++i)
link_highlights_[i]->ClearCurrentGraphicsLayer();
......@@ -149,17 +152,17 @@ LayoutRect GraphicsLayer::VisualRect() const {
void GraphicsLayer::SetHasWillChangeTransformHint(
bool has_will_change_transform) {
layer_->Layer()->SetHasWillChangeTransformHint(has_will_change_transform);
layer_->SetHasWillChangeTransformHint(has_will_change_transform);
}
void GraphicsLayer::SetOverscrollBehavior(
const cc::OverscrollBehavior& behavior) {
layer_->Layer()->SetOverscrollBehavior(behavior);
layer_->SetOverscrollBehavior(behavior);
}
void GraphicsLayer::SetSnapContainerData(
base::Optional<SnapContainerData> data) {
layer_->Layer()->SetSnapContainerData(std::move(data));
layer_->SetSnapContainerData(std::move(data));
}
void GraphicsLayer::SetIsResizedByBrowserControls(
......@@ -371,7 +374,7 @@ bool GraphicsLayer::Paint(const IntRect* interest_rect,
*this, std::move(record),
layer_state_ ? &layer_state_->state : nullptr);
// Ensure the compositor will raster the under-invalidation overlay.
layer_->Layer()->Invalidate();
layer_->SetNeedsDisplay();
}
}
......@@ -418,7 +421,7 @@ bool GraphicsLayer::PaintWithoutCommit(
}
void GraphicsLayer::UpdateChildList() {
WebLayer* child_host = layer_->Layer();
WebLayer* child_host = web_layer_.get();
child_host->RemoveAllChildren();
ClearContentsLayerIfUnregistered();
......@@ -445,12 +448,12 @@ void GraphicsLayer::UpdateLayerIsDrawable() {
// shouldn't receive the drawsContent flag, so it is only given
// contentsVisible.
layer_->Layer()->SetDrawsContent(draws_content_ && contents_visible_);
layer_->SetIsDrawable(draws_content_ && contents_visible_);
if (WebLayer* contents_layer = ContentsLayerIfRegistered())
contents_layer->SetDrawsContent(contents_visible_);
if (draws_content_) {
layer_->Layer()->Invalidate();
layer_->SetNeedsDisplay();
for (size_t i = 0; i < link_highlights_.size(); ++i)
link_highlights_[i]->Invalidate();
}
......@@ -533,7 +536,7 @@ void GraphicsLayer::SetupContentsLayer(WebLayer* contents_layer) {
// Insert the content layer first. Video elements require this, because they
// have shadow content that must display in front of the video.
layer_->Layer()->InsertChild(contents_layer_, 0);
layer_->InsertChild(contents_layer_->CcLayer(), 0);
WebLayer* border_web_layer =
contents_clipping_mask_layer_
? contents_clipping_mask_layer_->PlatformLayer()
......@@ -970,7 +973,7 @@ String GraphicsLayer::DebugName(cc::Layer* layer) const {
}
}
if (layer == CcLayerForWebLayer(layer_->Layer()))
if (layer == layer_.get())
return client_.DebugName(this);
NOTREACHED();
......@@ -1012,7 +1015,7 @@ void GraphicsLayer::SetSize(const FloatSize& size) {
// Invalidate the layer as a DisplayItemClient.
SetDisplayItemsUncached();
layer_->Layer()->SetBounds(static_cast<gfx::Size>(FlooredIntSize(size_)));
layer_->SetBounds(static_cast<gfx::Size>(FlooredIntSize(size_)));
// Note that we don't resize m_contentsLayer. It's up the caller to do that.
}
......@@ -1033,7 +1036,7 @@ void GraphicsLayer::SetShouldFlattenTransform(bool should_flatten) {
should_flatten_transform_ = should_flatten;
layer_->Layer()->SetShouldFlattenTransform(should_flatten);
layer_->SetShouldFlattenTransform(should_flatten);
}
void GraphicsLayer::SetRenderingContext(int context) {
......@@ -1041,18 +1044,18 @@ void GraphicsLayer::SetRenderingContext(int context) {
return;
rendering_context3d_ = context;
layer_->Layer()->SetRenderingContext(context);
layer_->Set3dSortingContextId(context);
if (contents_layer_)
contents_layer_->SetRenderingContext(rendering_context3d_);
}
bool GraphicsLayer::MasksToBounds() const {
return layer_->Layer()->MasksToBounds();
return layer_->masks_to_bounds();
}
void GraphicsLayer::SetMasksToBounds(bool masks_to_bounds) {
layer_->Layer()->SetMasksToBounds(masks_to_bounds);
layer_->SetMasksToBounds(masks_to_bounds);
}
void GraphicsLayer::SetDrawsContent(bool draws_content) {
......@@ -1084,12 +1087,12 @@ void GraphicsLayer::SetContentsVisible(bool contents_visible) {
void GraphicsLayer::SetClipParent(WebLayer* parent) {
has_clip_parent_ = !!parent;
layer_->Layer()->SetClipParent(parent);
layer_->SetClipParent(parent ? parent->CcLayer() : nullptr);
}
void GraphicsLayer::SetScrollParent(WebLayer* parent) {
has_scroll_parent_ = !!parent;
layer_->Layer()->SetScrollParent(parent);
layer_->SetScrollParent(parent ? parent->CcLayer() : nullptr);
}
void GraphicsLayer::SetBackgroundColor(const Color& color) {
......@@ -1097,12 +1100,12 @@ void GraphicsLayer::SetBackgroundColor(const Color& color) {
return;
background_color_ = color;
layer_->Layer()->SetBackgroundColor(background_color_.Rgb());
layer_->SetBackgroundColor(background_color_.Rgb());
}
void GraphicsLayer::SetContentsOpaque(bool opaque) {
contents_opaque_ = opaque;
layer_->Layer()->SetOpaque(contents_opaque_);
layer_->SetContentsOpaque(contents_opaque_);
ClearContentsLayerIfUnregistered();
if (contents_layer_ && !prevent_contents_opaque_changes_)
contents_layer_->SetOpaque(opaque);
......@@ -1113,9 +1116,8 @@ void GraphicsLayer::SetMaskLayer(GraphicsLayer* mask_layer) {
return;
mask_layer_ = mask_layer;
WebLayer* mask_web_layer =
mask_layer_ ? mask_layer_->PlatformLayer() : nullptr;
layer_->Layer()->SetMaskLayer(mask_web_layer);
layer_->SetMaskLayer(mask_layer_ ? mask_layer_->PlatformLayer()->CcLayer()
: nullptr);
}
void GraphicsLayer::SetContentsClippingMaskLayer(
......@@ -1181,7 +1183,7 @@ void GraphicsLayer::SetNeedsDisplay() {
// TODO(chrishtr): Stop invalidating the rects once
// FrameView::paintRecursively() does so.
layer_->Layer()->Invalidate();
layer_->SetNeedsDisplay();
for (size_t i = 0; i < link_highlights_.size(); ++i)
link_highlights_[i]->Invalidate();
GetPaintController().InvalidateAll();
......@@ -1208,7 +1210,7 @@ void GraphicsLayer::SetNeedsDisplayInRect(
void GraphicsLayer::SetNeedsDisplayInRectInternal(const IntRect& rect) {
DCHECK(DrawsContent());
layer_->Layer()->InvalidateRect(rect);
layer_->SetNeedsDisplayRect(rect);
for (auto* link_highlight : link_highlights_)
link_highlight->Invalidate();
}
......@@ -1267,7 +1269,7 @@ void GraphicsLayer::SetContentsToImage(
}
WebLayer* GraphicsLayer::PlatformLayer() const {
return layer_->Layer();
return web_layer_.get();
}
void GraphicsLayer::SetFilters(CompositorFilterOperations filters) {
......@@ -1280,7 +1282,7 @@ void GraphicsLayer::SetBackdropFilters(CompositorFilterOperations filters) {
void GraphicsLayer::SetStickyPositionConstraint(
const cc::LayerStickyPositionConstraint& sticky_constraint) {
layer_->Layer()->SetStickyPositionConstraint(sticky_constraint);
layer_->SetStickyPositionConstraint(sticky_constraint);
}
void GraphicsLayer::SetFilterQuality(SkFilterQuality filter_quality) {
......
......@@ -33,7 +33,6 @@
#include "cc/input/overscroll_behavior.h"
#include "cc/layers/content_layer_client.h"
#include "cc/layers/layer_client.h"
#include "third_party/blink/public/platform/web_content_layer.h"
#include "third_party/blink/public/platform/web_image_layer.h"
#include "third_party/blink/renderer/platform/geometry/float_point.h"
#include "third_party/blink/renderer/platform/geometry/float_point_3d.h"
......@@ -56,6 +55,10 @@
#include "third_party/skia/include/core/SkFilterQuality.h"
#include "third_party/skia/include/core/SkRefCnt.h"
namespace cc {
class PictureLayer;
}
namespace blink {
class CompositorFilterOperations;
......@@ -259,7 +262,7 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
void ScrollableAreaDisposed();
WebContentLayer* ContentLayer() const { return layer_.get(); }
cc::PictureLayer* ContentLayer() const { return layer_.get(); }
static void RegisterContentsLayer(WebLayer*);
static void UnregisterContentsLayer(WebLayer*);
......@@ -417,7 +420,8 @@ class PLATFORM_EXPORT GraphicsLayer : public cc::LayerClient,
int paint_count_;
std::unique_ptr<WebContentLayer> layer_;
scoped_refptr<cc::PictureLayer> layer_;
std::unique_ptr<WebLayer> web_layer_; // Wraps |layer_|.
std::unique_ptr<WebImageLayer> image_layer_;
WebLayer* contents_layer_;
// We don't have ownership of contents_layer_, but we do want to know if a
......
......@@ -41,7 +41,6 @@
#include "cc/blink/web_compositor_support_impl.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "third_party/blink/public/platform/interface_provider.h"
#include "third_party/blink/public/platform/web_content_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_runtime_features.h"
......@@ -98,11 +97,6 @@ std::unique_ptr<WebLayer> TestingCompositorSupport::CreateLayerFromCCLayer(
return nullptr;
}
std::unique_ptr<WebContentLayer> TestingCompositorSupport::CreateContentLayer(
cc::ContentLayerClient*) {
return nullptr;
}
std::unique_ptr<WebImageLayer> TestingCompositorSupport::CreateImageLayer() {
return nullptr;
}
......
......@@ -56,8 +56,6 @@ class WebThread;
class TestingCompositorSupport : public WebCompositorSupport {
std::unique_ptr<WebLayer> CreateLayer() override;
std::unique_ptr<WebLayer> CreateLayerFromCCLayer(cc::Layer*) override;
std::unique_ptr<WebContentLayer> CreateContentLayer(
cc::ContentLayerClient*) override;
std::unique_ptr<WebImageLayer> CreateImageLayer() override;
};
......
......@@ -189,6 +189,7 @@ _CONFIG = [
'cc::ContentLayerClient',
'cc::DisplayItemList',
'cc::DrawRecordOp',
'cc::PictureLayer',
],
},
{
......
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