Commit ceb77086 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

Revert "Flex: Ensure child recalculates visual overflow when flex content size changes."

This reverts commit 7bc6e04a.

R=eae@chromium.org, pdr@chromium.org

Bug: 993476
Change-Id: Icd741e1a4d1383ccb486dcb2f27b432b3635a997
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1752527
Auto-Submit: vmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686569}
parent c8bf2e38
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "third_party/blink/renderer/core/layout/layout_flexible_box.h" #include "third_party/blink/renderer/core/layout/layout_flexible_box.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
...@@ -463,49 +462,4 @@ TEST_P(LayoutFlexibleBoxTest, GeometriesWithScrollbarsRTLRowReverseVRL) { ...@@ -463,49 +462,4 @@ TEST_P(LayoutFlexibleBoxTest, GeometriesWithScrollbarsRTLRowReverseVRL) {
ExpectSameAsRowVRL(); ExpectSameAsRowVRL();
} }
TEST_P(LayoutFlexibleBoxTest, ResizedFlexChildRequiresVisualOverflowRecalc) {
SetBodyInnerHTML(R"HTML(
<style>
#parent {
display: flex;
flex-direction: column;
width: 100px;
height: 1000px;
}
#child1 {
flex-grow: 1;
width: 100px;
will-change: transform;
}
#overflow-child {
width: 100px;
height: 950px;
box-shadow: 5px 10px;
}
#child2 {
width: 100px;
}
</style>
<div id="parent">
<div id="child1">
<div id="overflow-child"></div>
</div>
<div id="child2"></div>
</div>
)HTML");
auto* child1_element = GetElementById("child1");
auto* child2_element = GetElementById("child2");
child2_element->setAttribute(html_names::kStyleAttr, "height: 100px;");
GetDocument().View()->UpdateLifecycleToLayoutClean();
auto* child1_box = ToLayoutBox(child1_element->GetLayoutObject());
ASSERT_TRUE(child1_box->HasSelfPaintingLayer());
EXPECT_TRUE(child1_box->Layer()->NeedsVisualOverflowRecalcForTesting());
UpdateAllLifecyclePhasesForTest();
EXPECT_EQ(child1_box->PhysicalVisualOverflowRect(),
PhysicalRect(0, 0, 105, 960));
}
} // namespace blink } // namespace blink
...@@ -1028,7 +1028,9 @@ void LayoutObject::MarkContainerChainForLayout(bool schedule_relayout, ...@@ -1028,7 +1028,9 @@ void LayoutObject::MarkContainerChainForLayout(bool schedule_relayout,
DCHECK(!object->IsSetNeedsLayoutForbidden()); DCHECK(!object->IsSetNeedsLayoutForbidden());
#endif #endif
object->MarkSelfPaintingLayerForVisualOverflowRecalc(); if (object->HasLayer() &&
ToLayoutBoxModelObject(object)->Layer()->IsSelfPaintingLayer())
ToLayoutBoxModelObject(object)->Layer()->SetNeedsVisualOverflowRecalc();
if (layouter) { if (layouter) {
layouter->RecordObjectMarkedForLayout(object); layouter->RecordObjectMarkedForLayout(object);
...@@ -1036,6 +1038,7 @@ void LayoutObject::MarkContainerChainForLayout(bool schedule_relayout, ...@@ -1036,6 +1038,7 @@ void LayoutObject::MarkContainerChainForLayout(bool schedule_relayout,
if (object == layouter->Root()) { if (object == layouter->Root()) {
if (auto* painting_layer = PaintingLayer()) if (auto* painting_layer = PaintingLayer())
painting_layer->SetNeedsVisualOverflowRecalc(); painting_layer->SetNeedsVisualOverflowRecalc();
return; return;
} }
} }
...@@ -1943,7 +1946,12 @@ void LayoutObject::MarkContainerChainForOverflowRecalcIfNeeded() { ...@@ -1943,7 +1946,12 @@ void LayoutObject::MarkContainerChainForOverflowRecalcIfNeeded() {
: object->Container(); : object->Container();
if (object) { if (object) {
object->SetChildNeedsLayoutOverflowRecalc(); object->SetChildNeedsLayoutOverflowRecalc();
object->MarkSelfPaintingLayerForVisualOverflowRecalc();
if (object->HasLayer()) {
auto* box_model_object = ToLayoutBoxModelObject(object);
if (box_model_object->HasSelfPaintingLayer())
box_model_object->Layer()->SetNeedsVisualOverflowRecalc();
}
} }
} while (object); } while (object);
...@@ -1953,8 +1961,12 @@ void LayoutObject::SetNeedsOverflowRecalc() { ...@@ -1953,8 +1961,12 @@ void LayoutObject::SetNeedsOverflowRecalc() {
bool needed_recalc = SelfNeedsLayoutOverflowRecalc(); bool needed_recalc = SelfNeedsLayoutOverflowRecalc();
SetSelfNeedsLayoutOverflowRecalc(); SetSelfNeedsLayoutOverflowRecalc();
SetShouldCheckForPaintInvalidation(); SetShouldCheckForPaintInvalidation();
MarkSelfPaintingLayerForVisualOverflowRecalc();
if (HasLayer()) {
auto* box_model_object = ToLayoutBoxModelObject(this);
if (box_model_object->HasSelfPaintingLayer())
box_model_object->Layer()->SetNeedsVisualOverflowRecalc();
}
if (!needed_recalc) if (!needed_recalc)
MarkContainerChainForOverflowRecalcIfNeeded(); MarkContainerChainForOverflowRecalcIfNeeded();
} }
...@@ -4063,14 +4075,6 @@ LayoutUnit LayoutObject::FlipForWritingModeInternal( ...@@ -4063,14 +4075,6 @@ LayoutUnit LayoutObject::FlipForWritingModeInternal(
->FlipForWritingMode(position, width); ->FlipForWritingMode(position, width);
} }
void LayoutObject::MarkSelfPaintingLayerForVisualOverflowRecalc() {
if (HasLayer()) {
auto* box_model_object = ToLayoutBoxModelObject(this);
if (box_model_object->HasSelfPaintingLayer())
box_model_object->Layer()->SetNeedsVisualOverflowRecalc();
}
}
} // namespace blink } // namespace blink
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
......
...@@ -2033,10 +2033,8 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -2033,10 +2033,8 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
// Called when the previous visual rect(s) is no longer valid. // Called when the previous visual rect(s) is no longer valid.
virtual void ClearPreviousVisualRects(); virtual void ClearPreviousVisualRects();
void SetSelfNeedsLayoutForAvailableSpace(bool flag) { void SetSelfNeedsLayoutForAvailableSpace(bool b) {
bitfields_.SetSelfNeedsLayoutForAvailableSpace(flag); bitfields_.SetSelfNeedsLayoutForAvailableSpace(b);
if (flag)
MarkSelfPaintingLayerForVisualOverflowRecalc();
} }
PaintInvalidationReason FullPaintInvalidationReason() const { PaintInvalidationReason FullPaintInvalidationReason() const {
...@@ -2729,8 +2727,6 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -2729,8 +2727,6 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
LayoutUnit width, LayoutUnit width,
const LayoutBox* box_for_flipping) const; const LayoutBox* box_for_flipping) const;
void MarkSelfPaintingLayerForVisualOverflowRecalc();
// This is set by Set[Subtree]ShouldDoFullPaintInvalidation, and cleared // This is set by Set[Subtree]ShouldDoFullPaintInvalidation, and cleared
// during PrePaint in this object's InvalidatePaint(). It's different from // during PrePaint in this object's InvalidatePaint(). It's different from
// DisplayItemClient::GetPaintInvalidationReason() which is set during // DisplayItemClient::GetPaintInvalidationReason() which is set during
......
...@@ -1108,10 +1108,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient { ...@@ -1108,10 +1108,6 @@ class CORE_EXPORT PaintLayer : public DisplayItemClient {
void DirtyStackingContextZOrderLists(); void DirtyStackingContextZOrderLists();
bool NeedsVisualOverflowRecalcForTesting() const {
return needs_visual_overflow_recalc_;
}
PhysicalOffset OffsetForInFlowRelPosition() const { PhysicalOffset OffsetForInFlowRelPosition() const {
return rare_data_ ? rare_data_->offset_for_in_flow_rel_position return rare_data_ ? rare_data_->offset_for_in_flow_rel_position
: PhysicalOffset(); : PhysicalOffset();
......
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