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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp

Issue 2571893002: [css-flexbox] Only cache m_hasDefiniteHeight if we're inside of layoutBlock() (Closed)
Patch Set: Switch back to computePercentageLogicalHeight from hasDefiniteLogicalHeight to fix test failures Created 4 years 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 | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index 648ff5a06290b99b0985eaf66b91a6a6f91a9dca..0a17cb941f084358815e3a8f712bf5c04a26330a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -39,6 +39,7 @@
#include "core/paint/PaintLayer.h"
#include "core/style/ComputedStyle.h"
#include "platform/LengthFunctions.h"
+#include "wtf/AutoReset.h"
#include "wtf/MathExtras.h"
#include <limits>
@@ -68,7 +69,8 @@ LayoutFlexibleBox::LayoutFlexibleBox(Element* element)
: LayoutBlock(element),
m_orderIterator(this),
m_numberOfInFlowChildrenOnFirstLine(-1),
- m_hasDefiniteHeight(SizeDefiniteness::Unknown) {
+ m_hasDefiniteHeight(SizeDefiniteness::Unknown),
+ m_inLayout(false) {
DCHECK(!childrenInline());
if (!isAnonymous())
UseCounter::count(document(), UseCounter::CSSFlexibleBox);
@@ -353,6 +355,8 @@ void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) {
return;
m_relaidOutChildren.clear();
+ WTF::AutoReset<bool> reset1(&m_inLayout, true);
+ DCHECK_EQ(m_hasDefiniteHeight, SizeDefiniteness::Unknown);
if (updateLogicalWidthAndColumnWidth())
relayoutChildren = true;
@@ -391,15 +395,16 @@ void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) {
updateLayerTransformAfterLayout();
+ // We have to reset this, because changes to our ancestors' style can affect
+ // this value. Also, this needs to be before we call updateAfterLayout, as
+ // that function may re-enter this one.
+ m_hasDefiniteHeight = SizeDefiniteness::Unknown;
+
// Update our scroll information if we're overflow:auto/scroll/hidden now
// that we know if we overflow or not.
updateAfterLayout();
clearNeedsLayout();
-
- // We have to reset this, because changes to our ancestors' style can affect
- // this value.
- m_hasDefiniteHeight = SizeDefiniteness::Unknown;
}
void LayoutFlexibleBox::paintChildren(const PaintInfo& paintInfo,
@@ -832,8 +837,12 @@ bool LayoutFlexibleBox::mainAxisLengthIsDefinite(
if (m_hasDefiniteHeight == SizeDefiniteness::Indefinite)
return false;
bool definite = child.computePercentageLogicalHeight(flexBasis) != -1;
- m_hasDefiniteHeight =
- definite ? SizeDefiniteness::Definite : SizeDefiniteness::Indefinite;
+ if (m_inLayout) {
+ // We can reach this code even while we're not laying ourselves out, such
+ // as from mainSizeForPercentageResolution.
+ m_hasDefiniteHeight =
+ definite ? SizeDefiniteness::Definite : SizeDefiniteness::Indefinite;
+ }
return definite;
}
return true;
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698