Commit 0d2f4351 authored by Tien-Ren Chen's avatar Tien-Ren Chen Committed by Commit Bot

[Blink] Make PaintLayer::AncestorDependentCompositingInputs in-place

Before this CL it was owned by PaintLayer through a std::unique_ptr.
This is probably because it was a rare data back in the age when we had
non-composited mode. Now every PaintLayer always have it.

BUG=818768

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ice8612a3cbe4a3da28e81f3d17f80cf5574ce17a
Reviewed-on: https://chromium-review.googlesource.com/959557
Commit-Queue: Tien-Ren Chen <trchen@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542668}
parent 1e54f71e
...@@ -101,7 +101,7 @@ static CompositingQueryMode g_compositing_query_mode = ...@@ -101,7 +101,7 @@ static CompositingQueryMode g_compositing_query_mode =
struct SameSizeAsPaintLayer : DisplayItemClient { struct SameSizeAsPaintLayer : DisplayItemClient {
int bit_fields; int bit_fields;
void* pointers[11]; void* pointers[10];
LayoutUnit layout_units[4]; LayoutUnit layout_units[4];
IntSize size; IntSize size;
Persistent<PaintLayerScrollableArea> scrollable_area; Persistent<PaintLayerScrollableArea> scrollable_area;
...@@ -109,6 +109,11 @@ struct SameSizeAsPaintLayer : DisplayItemClient { ...@@ -109,6 +109,11 @@ struct SameSizeAsPaintLayer : DisplayItemClient {
IntSize size; IntSize size;
LayoutRect rect; LayoutRect rect;
} previous_paint_status; } previous_paint_status;
struct {
void* pointers[10];
IntRect int_rects[2];
} ancestor_dependent_compositing_inputs;
}; };
static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer), static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer),
...@@ -1083,8 +1088,7 @@ void PaintLayer::SetNeedsCompositingInputsUpdateInternal() { ...@@ -1083,8 +1088,7 @@ void PaintLayer::SetNeedsCompositingInputsUpdateInternal() {
void PaintLayer::UpdateAncestorDependentCompositingInputs( void PaintLayer::UpdateAncestorDependentCompositingInputs(
const AncestorDependentCompositingInputs& compositing_inputs) { const AncestorDependentCompositingInputs& compositing_inputs) {
ancestor_dependent_compositing_inputs_ = ancestor_dependent_compositing_inputs_ = compositing_inputs;
std::make_unique<AncestorDependentCompositingInputs>(compositing_inputs);
needs_ancestor_dependent_compositing_inputs_update_ = false; needs_ancestor_dependent_compositing_inputs_update_ = false;
} }
......
...@@ -695,31 +695,19 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -695,31 +695,19 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
CompositingReason::kComboAllDirectStyleDeterminedReasons; CompositingReason::kComboAllDirectStyleDeterminedReasons;
} }
class AncestorDependentCompositingInputs { struct AncestorDependentCompositingInputs {
public: public:
AncestorDependentCompositingInputs() const PaintLayer* opacity_ancestor = nullptr;
: opacity_ancestor(nullptr), const PaintLayer* transform_ancestor = nullptr;
transform_ancestor(nullptr), const PaintLayer* filter_ancestor = nullptr;
filter_ancestor(nullptr), const PaintLayer* clip_path_ancestor = nullptr;
clip_path_ancestor(nullptr), const PaintLayer* mask_ancestor = nullptr;
mask_ancestor(nullptr),
ancestor_scrolling_layer(nullptr),
nearest_fixed_position_layer(nullptr),
scroll_parent(nullptr),
clip_parent(nullptr),
clipping_container(nullptr) {}
const PaintLayer* opacity_ancestor;
const PaintLayer* transform_ancestor;
const PaintLayer* filter_ancestor;
const PaintLayer* clip_path_ancestor;
const PaintLayer* mask_ancestor;
// The fist ancestor which can scroll. This is a subset of the // The fist ancestor which can scroll. This is a subset of the
// ancestorOverflowLayer chain where the scrolling layer is visible and // ancestorOverflowLayer chain where the scrolling layer is visible and
// has a larger scroll content than its bounds. // has a larger scroll content than its bounds.
const PaintLayer* ancestor_scrolling_layer; const PaintLayer* ancestor_scrolling_layer = nullptr;
const PaintLayer* nearest_fixed_position_layer; const PaintLayer* nearest_fixed_position_layer = nullptr;
// A scroll parent is a compositor concept. It's only needed in blink // A scroll parent is a compositor concept. It's only needed in blink
// because we need to use it as a promotion trigger. A layer has a // because we need to use it as a promotion trigger. A layer has a
...@@ -727,18 +715,18 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -727,18 +715,18 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
// other layer scrolled by this ancestor, is a stacking ancestor of this // other layer scrolled by this ancestor, is a stacking ancestor of this
// layer. Layers with scroll parents must be scrolled with the main // layer. Layers with scroll parents must be scrolled with the main
// scrolling layer by the compositor. // scrolling layer by the compositor.
const PaintLayer* scroll_parent; const PaintLayer* scroll_parent = nullptr;
// A clip parent is another compositor concept that has leaked into // A clip parent is another compositor concept that has leaked into
// blink so that it may be used as a promotion trigger. Layers with clip // blink so that it may be used as a promotion trigger. Layers with clip
// parents escape the clip of a stacking tree ancestor. The compositor // parents escape the clip of a stacking tree ancestor. The compositor
// needs to know about clip parents in order to circumvent its normal // needs to know about clip parents in order to circumvent its normal
// clipping logic. // clipping logic.
const PaintLayer* clip_parent; const PaintLayer* clip_parent = nullptr;
IntRect clipped_absolute_bounding_box; IntRect clipped_absolute_bounding_box;
IntRect unclipped_absolute_bounding_box; IntRect unclipped_absolute_bounding_box;
const LayoutBoxModelObject* clipping_container; const LayoutBoxModelObject* clipping_container = nullptr;
}; };
void SetNeedsCompositingInputsUpdate(); void SetNeedsCompositingInputsUpdate();
...@@ -756,82 +744,54 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -756,82 +744,54 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
const AncestorDependentCompositingInputs&); const AncestorDependentCompositingInputs&);
void DidUpdateCompositingInputs(); void DidUpdateCompositingInputs();
const IntRect& ClippedAbsoluteBoundingBox() const { const AncestorDependentCompositingInputs&
GetAncestorDependentCompositingInputs() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); DCHECK(!needs_ancestor_dependent_compositing_inputs_update_);
return ancestor_dependent_compositing_inputs_ return ancestor_dependent_compositing_inputs_;
->clipped_absolute_bounding_box; }
const IntRect& ClippedAbsoluteBoundingBox() const {
return GetAncestorDependentCompositingInputs()
.clipped_absolute_bounding_box;
} }
const IntRect& UnclippedAbsoluteBoundingBox() const { const IntRect& UnclippedAbsoluteBoundingBox() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs()
return ancestor_dependent_compositing_inputs_ .unclipped_absolute_bounding_box;
->unclipped_absolute_bounding_box;
} }
const PaintLayer* OpacityAncestor() const { const PaintLayer* OpacityAncestor() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().opacity_ancestor;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->opacity_ancestor
: nullptr;
} }
const PaintLayer* TransformAncestor() const { const PaintLayer* TransformAncestor() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().transform_ancestor;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->transform_ancestor
: nullptr;
} }
const PaintLayer& TransformAncestorOrRoot() const; const PaintLayer& TransformAncestorOrRoot() const;
const PaintLayer* FilterAncestor() const { const PaintLayer* FilterAncestor() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().filter_ancestor;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->filter_ancestor
: nullptr;
} }
const LayoutBoxModelObject* ClippingContainer() const { const LayoutBoxModelObject* ClippingContainer() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().clipping_container;
return ancestor_dependent_compositing_inputs_->clipping_container;
} }
const PaintLayer* AncestorOverflowLayer() const { const PaintLayer* AncestorOverflowLayer() const {
return ancestor_overflow_layer_; return ancestor_overflow_layer_;
} }
const PaintLayer* AncestorScrollingLayer() const { const PaintLayer* AncestorScrollingLayer() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().ancestor_scrolling_layer;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_
->ancestor_scrolling_layer
: nullptr;
} }
const PaintLayer* NearestFixedPositionLayer() const { const PaintLayer* NearestFixedPositionLayer() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().nearest_fixed_position_layer;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_
->nearest_fixed_position_layer
: nullptr;
} }
const PaintLayer* ScrollParent() const { const PaintLayer* ScrollParent() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().scroll_parent;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->scroll_parent
: nullptr;
} }
const PaintLayer* ClipParent() const { const PaintLayer* ClipParent() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().clip_parent;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->clip_parent
: nullptr;
} }
const PaintLayer* ClipPathAncestor() const { const PaintLayer* ClipPathAncestor() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().clip_path_ancestor;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->clip_path_ancestor
: nullptr;
} }
const PaintLayer* MaskAncestor() const { const PaintLayer* MaskAncestor() const {
DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return GetAncestorDependentCompositingInputs().mask_ancestor;
return ancestor_dependent_compositing_inputs_
? ancestor_dependent_compositing_inputs_->mask_ancestor
: nullptr;
} }
bool HasDescendantWithClipPath() const { bool HasDescendantWithClipPath() const {
DCHECK(!needs_descendant_dependent_flags_update_);
return has_descendant_with_clip_path_; return has_descendant_with_clip_path_;
} }
...@@ -1290,8 +1250,7 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -1290,8 +1250,7 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
// The first ancestor having a non visible overflow. // The first ancestor having a non visible overflow.
const PaintLayer* ancestor_overflow_layer_; const PaintLayer* ancestor_overflow_layer_;
std::unique_ptr<AncestorDependentCompositingInputs> AncestorDependentCompositingInputs ancestor_dependent_compositing_inputs_;
ancestor_dependent_compositing_inputs_;
Persistent<PaintLayerScrollableArea> scrollable_area_; Persistent<PaintLayerScrollableArea> scrollable_area_;
......
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