Title: [253427] trunk/Source/WebCore
- Revision
- 253427
- Author
- [email protected]
- Date
- 2019-12-12 07:18:05 -0800 (Thu, 12 Dec 2019)
Log Message
REGRESSION(r252979): Avoid unnecessary work when searching for the flow when constructing line layout iteratorAvoid unnecessary work when searching for the flow when constructing line layout iterator
https://bugs.webkit.org/show_bug.cgi?id=205155
<rdar://problem/57846936>
Reviewed by Zalan Bujtas.
We unecessarily searched the ancestor chain flow the RenderFlow. We can avoid this
for now since we know only candidate it the direct parent.
* rendering/line/LineLayoutTraversal.cpp:
(WebCore::LineLayoutTraversal::lineLayoutSystemFlowForRenderer):
(WebCore::LineLayoutTraversal::firstTextBoxFor):
(WebCore::LineLayoutTraversal::firstTextBoxInTextOrderFor):
(WebCore::LineLayoutTraversal::elementBoxFor):
(WebCore::LineLayoutTraversal::flowForText): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253426 => 253427)
--- trunk/Source/WebCore/ChangeLog 2019-12-12 14:22:18 UTC (rev 253426)
+++ trunk/Source/WebCore/ChangeLog 2019-12-12 15:18:05 UTC (rev 253427)
@@ -1,3 +1,21 @@
+2019-12-12 Antti Koivisto <[email protected]>
+
+ REGRESSION(r252979): Avoid unnecessary work when searching for the flow when constructing line layout iteratorAvoid unnecessary work when searching for the flow when constructing line layout iterator
+ https://bugs.webkit.org/show_bug.cgi?id=205155
+ <rdar://problem/57846936>
+
+ Reviewed by Zalan Bujtas.
+
+ We unecessarily searched the ancestor chain flow the RenderFlow. We can avoid this
+ for now since we know only candidate it the direct parent.
+
+ * rendering/line/LineLayoutTraversal.cpp:
+ (WebCore::LineLayoutTraversal::lineLayoutSystemFlowForRenderer):
+ (WebCore::LineLayoutTraversal::firstTextBoxFor):
+ (WebCore::LineLayoutTraversal::firstTextBoxInTextOrderFor):
+ (WebCore::LineLayoutTraversal::elementBoxFor):
+ (WebCore::LineLayoutTraversal::flowForText): Deleted.
+
2019-12-12 youenn fablet <[email protected]>
Roll-out part of revision 253275 related to rotation handling
Modified: trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp (253426 => 253427)
--- trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp 2019-12-12 14:22:18 UTC (rev 253426)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp 2019-12-12 15:18:05 UTC (rev 253427)
@@ -70,24 +70,27 @@
});
}
-static const RenderBlockFlow& flowForText(const RenderText& text)
+static const RenderBlockFlow* lineLayoutSystemFlowForRenderer(const RenderObject& renderer)
{
- return downcast<RenderBlockFlow>(*text.containingBlockForObjectInFlow());
+ // In currently supported cases the renderer is always direct child of the flow.
+ if (!is<RenderBlockFlow>(*renderer.parent()))
+ return nullptr;
+ return downcast<RenderBlockFlow>(renderer.parent());
}
TextBoxIterator firstTextBoxFor(const RenderText& text)
{
- auto& flow = flowForText(text);
+ if (auto* flow = lineLayoutSystemFlowForRenderer(text)) {
+ if (auto* simpleLineLayout = flow->simpleLineLayout()) {
+ auto range = simpleLineLayout->runResolver().rangeForRenderer(text);
+ return { SimplePath { range.begin(), range.end() } };
+ }
- if (auto* simpleLineLayout = flow.simpleLineLayout()) {
- auto range = simpleLineLayout->runResolver().rangeForRenderer(text);
- return { SimplePath { range.begin(), range.end() } };
- }
-
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (auto* layoutFormattingContextLineLayout = flow.layoutFormattingContextLineLayout())
- return layoutFormattingContextLineLayout->textBoxesFor(text);
+ if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
+ return layoutFormattingContextLineLayout->textBoxesFor(text);
#endif
+ }
return { ComplexPath { text.firstTextBox() } };
}
@@ -94,9 +97,7 @@
TextBoxIterator firstTextBoxInTextOrderFor(const RenderText& text)
{
- auto& flow = flowForText(text);
-
- if (flow.complexLineLayout() && text.containsReversedText() && text.firstTextBox()) {
+ if (text.firstTextBox() && text.containsReversedText()) {
Vector<const InlineTextBox*> sortedTextBoxes;
for (auto* textBox = text.firstTextBox(); textBox; textBox = textBox->nextTextBox())
sortedTextBoxes.append(textBox);
@@ -127,21 +128,17 @@
ElementBoxIterator elementBoxFor(const RenderLineBreak& renderElement)
{
- auto* containingBlock = renderElement.containingBlock();
- if (!is<RenderBlockFlow>(containingBlock))
- return { };
+ if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
+ if (auto* simpleLineLayout = flow->simpleLineLayout()) {
+ auto range = simpleLineLayout->runResolver().rangeForRenderer(renderElement);
+ return { SimplePath(range.begin(), range.end()) };
+ }
- auto& flow = downcast<RenderBlockFlow>(*containingBlock);
-
- if (auto* simpleLineLayout = flow.simpleLineLayout()) {
- auto range = simpleLineLayout->runResolver().rangeForRenderer(renderElement);
- return { SimplePath(range.begin(), range.end()) };
- }
-
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (auto* layoutFormattingContextLineLayout = flow.layoutFormattingContextLineLayout())
- return layoutFormattingContextLineLayout->elementBoxFor(renderElement);
+ if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
+ return layoutFormattingContextLineLayout->elementBoxFor(renderElement);
#endif
+ }
return { ComplexPath(renderElement.inlineBoxWrapper()) };
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes