Title: [237730] trunk/Source/WebCore
- Revision
- 237730
- Author
- [email protected]
- Date
- 2018-11-02 07:21:56 -0700 (Fri, 02 Nov 2018)
Log Message
[LFC][BFC] BlockFormattingContext::instrinsicWidthConstraints logic should look similar to ::layout
https://bugs.webkit.org/show_bug.cgi?id=191181
Reviewed by Antti Koivisto.
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (237729 => 237730)
--- trunk/Source/WebCore/ChangeLog 2018-11-02 13:41:05 UTC (rev 237729)
+++ trunk/Source/WebCore/ChangeLog 2018-11-02 14:21:56 UTC (rev 237730)
@@ -1,5 +1,15 @@
2018-11-02 Zalan Bujtas <[email protected]>
+ [LFC][BFC] BlockFormattingContext::instrinsicWidthConstraints logic should look similar to ::layout
+ https://bugs.webkit.org/show_bug.cgi?id=191181
+
+ Reviewed by Antti Koivisto.
+
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
+
+2018-11-02 Zalan Bujtas <[email protected]>
+
[LFC] Align shrink-to-fit width computation with the layout implementation.
https://bugs.webkit.org/show_bug.cgi?id=191179
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (237729 => 237730)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-11-02 13:41:05 UTC (rev 237729)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-11-02 14:21:56 UTC (rev 237730)
@@ -378,7 +378,6 @@
// 3. As we climb back on the tree, compute min/max intrinsic width
// (Any subtrees with new formatting contexts need to layout synchronously)
Vector<const Box*> queue;
- // Non-containers early return.
ASSERT(is<Container>(formattingRoot));
if (auto* firstChild = downcast<Container>(formattingRoot).firstInFlowOrFloatingChild())
queue.append(firstChild);
@@ -386,29 +385,23 @@
auto& formattingState = this->formattingState();
while (!queue.isEmpty()) {
while (true) {
- auto& childBox = *queue.last();
- // Already computed?
- auto instrinsicWidthConstraints = formattingState.instrinsicWidthConstraints(childBox);
- // Can we just compute them without checking the children?
- if (!instrinsicWidthConstraints && !Geometry::instrinsicWidthConstraintsNeedChildrenWidth(childBox))
- instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, childBox);
- // Is it a formatting context root?
- if (!instrinsicWidthConstraints && childBox.establishesFormattingContext())
- instrinsicWidthConstraints = formattingState.formattingContext(childBox)->instrinsicWidthConstraints();
- // Go to the next sibling (and skip the descendants) if this box's min/max width is computed.
- if (instrinsicWidthConstraints) {
- formattingState.setInstrinsicWidthConstraints(childBox, *instrinsicWidthConstraints);
+ auto& childBox = *queue.last();
+ auto skipDescendants = formattingState.instrinsicWidthConstraints(childBox) || !Geometry::instrinsicWidthConstraintsNeedChildrenWidth(childBox) || childBox.establishesFormattingContext();
+
+ if (skipDescendants) {
+ if (!Geometry::instrinsicWidthConstraintsNeedChildrenWidth(childBox))
+ formattingState.setInstrinsicWidthConstraints(childBox, Geometry::instrinsicWidthConstraints(layoutState, childBox));
+ else if (childBox.establishesFormattingContext())
+ formattingState.setInstrinsicWidthConstraints(childBox, formattingState.formattingContext(childBox)->instrinsicWidthConstraints());
+
+ ASSERT(formattingState.instrinsicWidthConstraints(childBox));
queue.removeLast();
if (!childBox.nextInFlowOrFloatingSibling())
break;
queue.append(childBox.nextInFlowOrFloatingSibling());
+ // Skip descendants
continue;
}
-
- if (!is<Container>(childBox) || !downcast<Container>(childBox).hasInFlowOrFloatingChild())
- break;
-
- queue.append(downcast<Container>(childBox).firstInFlowOrFloatingChild());
}
// Compute min/max intrinsic width bottom up.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes