Title: [254568] trunk/Source/WebCore
Revision
254568
Author
an...@apple.com
Date
2020-01-15 07:46:09 -0800 (Wed, 15 Jan 2020)

Log Message

[LFC][Integration] Call SimpleLineLayout::canUseFor only once
https://bugs.webkit.org/show_bug.cgi?id=206281

Reviewed by Sam Weinig.

It can be somewhat costly.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::canUseFor):
* layout/integration/LayoutIntegrationLineLayout.h:
(WebCore::LayoutIntegration::LineLayout::canUseFor):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutInlineChildren):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (254567 => 254568)


--- trunk/Source/WebCore/ChangeLog	2020-01-15 14:44:06 UTC (rev 254567)
+++ trunk/Source/WebCore/ChangeLog	2020-01-15 15:46:09 UTC (rev 254568)
@@ -1,3 +1,19 @@
+2020-01-15  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Call SimpleLineLayout::canUseFor only once
+        https://bugs.webkit.org/show_bug.cgi?id=206281
+
+        Reviewed by Sam Weinig.
+
+        It can be somewhat costly.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::canUseFor):
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        (WebCore::LayoutIntegration::LineLayout::canUseFor):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::layoutInlineChildren):
+
 2020-01-15  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK] Turn off antialiasing when rendering with Ahem

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (254567 => 254568)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-01-15 14:44:06 UTC (rev 254567)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-01-15 15:46:09 UTC (rev 254568)
@@ -58,13 +58,17 @@
 
 LineLayout::~LineLayout() = default;
 
-bool LineLayout::canUseFor(const RenderBlockFlow& flow)
+bool LineLayout::canUseFor(const RenderBlockFlow& flow, Optional<bool> couldUseSimpleLineLayout)
 {
     if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled())
         return false;
 
     // Initially only a subset of SLL features is supported.
-    if (!SimpleLineLayout::canUseFor(flow))
+    auto passesSimpleLineLayoutTest = valueOrCompute(couldUseSimpleLineLayout, [&] {
+        return SimpleLineLayout::canUseFor(flow);
+    });
+
+    if (!passesSimpleLineLayoutTest)
         return false;
 
     if (flow.containsFloats())

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (254567 => 254568)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-01-15 14:44:06 UTC (rev 254567)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-01-15 15:46:09 UTC (rev 254568)
@@ -58,7 +58,7 @@
     LineLayout(const RenderBlockFlow&);
     ~LineLayout();
 
-    static bool canUseFor(const RenderBlockFlow&);
+    static bool canUseFor(const RenderBlockFlow&, Optional<bool> couldUseSimpleLineLayout = { });
 
     void updateStyle();
     void layout();

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (254567 => 254568)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-01-15 14:44:06 UTC (rev 254567)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-01-15 15:46:09 UTC (rev 254568)
@@ -669,12 +669,14 @@
 void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
 {
     auto computeLineLayoutPath = [&] {
+        bool canUseSimpleLines = SimpleLineLayout::canUseFor(*this);
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-        if (LayoutIntegration::LineLayout::canUseFor(*this))
+        if (LayoutIntegration::LineLayout::canUseFor(*this, canUseSimpleLines))
             return LayoutFormattingContextPath;
 #endif
-        if (SimpleLineLayout::canUseFor(*this))
+        if (canUseSimpleLines)
             return SimpleLinesPath;
+
         return LineBoxesPath;
     };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to