Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Unified Diff: Source/core/layout/LayoutMultiColumnFlowThread.cpp

Issue 1229983004: May need to insert or remove column sets when out-of-flow objects get their containing block change… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Transforms need to be handled too. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/multicol/dynamic/untransformed-becomes-transformed-has-abspos-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutMultiColumnFlowThread.cpp
diff --git a/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index 1920f4ebd5175cbcdc2ae89e139e801bdef49a2e..5fcce7ce7d4b6d71ffa5e9e405cff180dbecf4cd 100644
--- a/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -754,9 +754,32 @@ void LayoutMultiColumnFlowThread::flowThreadDescendantWillBeRemoved(LayoutObject
columnSetToRemove->destroy();
}
+static inline bool needsToReinsertIntoFlowThread(const ComputedStyle& oldStyle, const ComputedStyle& newStyle)
+{
+ // If we've become (or are about to become) a container for absolutely positioned descendants,
leviw_travelin_and_unemployed 2015/07/14 19:43:42 This comment seems to imply we only care if we're
mstensho (USE GERRIT) 2015/07/14 19:49:25 Done. The code was right, the comment was inaccur
+ // we need to re-evaluate the need for column sets. There may be out-of-flow descendants
+ // further down that become part of the flow thread, or cease to be part of the flow thread,
+ // because of this change.
+ if (oldStyle.hasTransformRelatedProperty() != newStyle.hasTransformRelatedProperty())
+ return true;
+ return (oldStyle.hasInFlowPosition() && newStyle.position() == StaticPosition)
+ || (newStyle.hasInFlowPosition() && oldStyle.position() == StaticPosition);
+}
+
+static inline bool needsToRemoveFromFlowThread(const ComputedStyle& oldStyle, const ComputedStyle& newStyle)
+{
+ // If an in-flow descendant goes out-of-flow, we may have to remove column sets and spanner placeholders.
+ return (newStyle.hasOutOfFlowPosition() && !oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle);
+}
+
+static inline bool needsToInsertIntoFlowThread(const ComputedStyle& oldStyle, const ComputedStyle& newStyle)
+{
+ // If an out-of-flow descendant goes in-flow, we may have to insert column sets and spanner placeholders.
+ return (!newStyle.hasOutOfFlowPosition() && oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle);
+}
+
void LayoutMultiColumnFlowThread::flowThreadDescendantStyleWillChange(LayoutObject* descendant, StyleDifference diff, const ComputedStyle& newStyle)
{
- // If an in-flow descendant goes out-of-flow, we may have to remove a column set.
if (descendant->isText()) {
// Text nodes inherit all properties from the parent node (including non-inheritable
// ones). We don't care what its 'position' is. In fact, we _must_ ignore it, since the
@@ -764,13 +787,12 @@ void LayoutMultiColumnFlowThread::flowThreadDescendantStyleWillChange(LayoutObje
// of the multicol is bad.
return;
}
- if (newStyle.hasOutOfFlowPosition() && !styleRef().hasOutOfFlowPosition())
+ if (needsToRemoveFromFlowThread(descendant->styleRef(), newStyle))
flowThreadDescendantWillBeRemoved(descendant);
}
void LayoutMultiColumnFlowThread::flowThreadDescendantStyleDidChange(LayoutObject* descendant, StyleDifference diff, const ComputedStyle& oldStyle)
{
- // If an out-of-flow descendant goes in-flow, we may have to insert a column set.
if (descendant->isText()) {
// Text nodes inherit all properties from the parent node (including non-inheritable
// ones). We don't care what its 'position' is. In fact, we _must_ ignore it, since the
@@ -778,13 +800,7 @@ void LayoutMultiColumnFlowThread::flowThreadDescendantStyleDidChange(LayoutObjec
// of the multicol is bad.
return;
}
- if (styleRef().hasOutOfFlowPosition())
- return;
-
- // We're not out of flow.
- if (oldStyle.hasOutOfFlowPosition()) {
- // ... but we used to be out of flow. So we might need to insert a column set (or
- // spanner placeholder, in case this descendant is now a valid column spanner).
+ if (needsToInsertIntoFlowThread(oldStyle, descendant->styleRef())) {
flowThreadDescendantWasInserted(descendant);
return;
}
« no previous file with comments | « LayoutTests/fast/multicol/dynamic/untransformed-becomes-transformed-has-abspos-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698