Commit c4218521 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Remove the special DisplayItemClient for ForeignLayerDisplayItem

It was to return the visual rect calculated from the cc::Layer's bounds.
It has been doing nothing since we removed DisplayItemClient::VisualRect().

Change-Id: I9104ab23fdd58b4b9362e0c6f4babeef2680e24e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346993Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796576}
parent 6cb76ac6
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h" #include "third_party/blink/renderer/platform/graphics/paint/foreign_layer_display_item.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_recorder.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_recorder.h"
#include "third_party/blink/renderer/platform/graphics/paint/scoped_display_item_fragment.h"
#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h"
#include "third_party/blink/renderer/platform/web_test_support.h" #include "third_party/blink/renderer/platform/web_test_support.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
...@@ -282,9 +283,10 @@ void LinkHighlightImpl::Paint(GraphicsContext& context) { ...@@ -282,9 +283,10 @@ void LinkHighlightImpl::Paint(GraphicsContext& context) {
->GetMockGestureTapHighlightsEnabled() && ->GetMockGestureTapHighlightsEnabled() &&
!object->FirstFragment().NextFragment(); !object->FirstFragment().NextFragment();
size_t index = 0; wtf_size_t index = 0;
for (const auto* fragment = &object->FirstFragment(); fragment; for (const auto* fragment = &object->FirstFragment(); fragment;
fragment = fragment->NextFragment(), ++index) { fragment = fragment->NextFragment(), ++index) {
ScopedDisplayItemFragment scoped_fragment(context, index);
auto rects = object->OutlineRects( auto rects = object->OutlineRects(
fragment->PaintOffset(), NGOutlineType::kIncludeBlockVisualOverflow); fragment->PaintOffset(), NGOutlineType::kIncludeBlockVisualOverflow);
if (rects.size() > 1) if (rects.size() > 1)
......
...@@ -16,55 +16,22 @@ ...@@ -16,55 +16,22 @@
namespace blink { namespace blink {
namespace {
// It uses DebugName and OwnerNodeId of the input DisplayItemClient, while
// calculate VisualRect from the layer's offset and bounds.
class ForeignLayerDisplayItemClient final : public DisplayItemClient {
public:
ForeignLayerDisplayItemClient(const DisplayItemClient& client,
scoped_refptr<cc::Layer> layer)
: client_(client), layer_(std::move(layer)) {
DCHECK(layer_);
Invalidate(PaintInvalidationReason::kUncacheable);
}
String DebugName() const final { return client_.DebugName(); }
DOMNodeId OwnerNodeId() const final { return client_.OwnerNodeId(); }
cc::Layer* GetLayer() const { return layer_.get(); }
private:
const DisplayItemClient& client_;
scoped_refptr<cc::Layer> layer_;
};
} // anonymous namespace
ForeignLayerDisplayItem::ForeignLayerDisplayItem( ForeignLayerDisplayItem::ForeignLayerDisplayItem(
const DisplayItemClient& client, const DisplayItemClient& client,
Type type, Type type,
scoped_refptr<cc::Layer> layer, scoped_refptr<cc::Layer> layer,
const IntPoint& offset) const IntPoint& offset)
: DisplayItem(*new ForeignLayerDisplayItemClient(client, layer), : DisplayItem(client,
type, type,
sizeof(*this), sizeof(*this),
IntRect(offset, IntSize(layer->bounds()))), IntRect(offset, IntSize(layer->bounds()))),
offset_(offset) { offset_(offset),
layer_(std::move(layer)) {
DCHECK(IsForeignLayerType(type)); DCHECK(IsForeignLayerType(type));
DCHECK(!IsCacheable());
}
ForeignLayerDisplayItem::~ForeignLayerDisplayItem() {
delete &Client();
}
cc::Layer* ForeignLayerDisplayItem::GetLayer() const {
return static_cast<const ForeignLayerDisplayItemClient&>(Client()).GetLayer();
} }
bool ForeignLayerDisplayItem::Equals(const DisplayItem& other) const { bool ForeignLayerDisplayItem::Equals(const DisplayItem& other) const {
return GetType() == other.GetType() && return DisplayItem::Equals(other) &&
GetLayer() == GetLayer() ==
static_cast<const ForeignLayerDisplayItem&>(other).GetLayer(); static_cast<const ForeignLayerDisplayItem&>(other).GetLayer();
} }
......
...@@ -26,9 +26,8 @@ class PLATFORM_EXPORT ForeignLayerDisplayItem : public DisplayItem { ...@@ -26,9 +26,8 @@ class PLATFORM_EXPORT ForeignLayerDisplayItem : public DisplayItem {
Type, Type,
scoped_refptr<cc::Layer>, scoped_refptr<cc::Layer>,
const IntPoint& offset); const IntPoint& offset);
~ForeignLayerDisplayItem() override;
cc::Layer* GetLayer() const; cc::Layer* GetLayer() const { return layer_.get(); }
// DisplayItem // DisplayItem
bool Equals(const DisplayItem&) const final; bool Equals(const DisplayItem&) const final;
...@@ -40,6 +39,7 @@ class PLATFORM_EXPORT ForeignLayerDisplayItem : public DisplayItem { ...@@ -40,6 +39,7 @@ class PLATFORM_EXPORT ForeignLayerDisplayItem : public DisplayItem {
private: private:
IntPoint offset_; IntPoint offset_;
scoped_refptr<cc::Layer> layer_;
}; };
// When a foreign layer's debug name is a literal string, define a instance of // When a foreign layer's debug name is a literal string, define a instance of
......
...@@ -30,7 +30,7 @@ GraphicsLayerDisplayItem::GraphicsLayerDisplayItem( ...@@ -30,7 +30,7 @@ GraphicsLayerDisplayItem::GraphicsLayerDisplayItem(
graphics_layer_(graphics_layer) {} graphics_layer_(graphics_layer) {}
bool GraphicsLayerDisplayItem::Equals(const DisplayItem& other) const { bool GraphicsLayerDisplayItem::Equals(const DisplayItem& other) const {
return GetType() == other.GetType() && return DisplayItem::Equals(other) &&
GetGraphicsLayer() == GetGraphicsLayer() ==
static_cast<const GraphicsLayerDisplayItem&>(other) static_cast<const GraphicsLayerDisplayItem&>(other)
.GetGraphicsLayer(); .GetGraphicsLayer();
......
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