Title: [266437] branches/safari-610-branch/Source/WebCore
Revision
266437
Author
[email protected]
Date
2020-09-01 18:19:32 -0700 (Tue, 01 Sep 2020)

Log Message

Cherry-pick r266291. rdar://problem/68177666

    No need to run full can-use-for (fast inline layout codepath) check on every style change.
    https://bugs.webkit.org/show_bug.cgi?id=215937
    <rdar://problem/67951360>

    Reviewed by Antti Koivisto.

    Let's use the StyleDifference to figure out how extensive the can-use-for check should be.
    We can certainly skip some relatively expensive content checks when we know that the style change only triggers repaint or positioned-movement-only changes.

    * layout/integration/LayoutIntegrationLineLayout.cpp:
    (WebCore::LayoutIntegration::LineLayout::canUseForAfterStyleChange):
    * layout/integration/LayoutIntegrationLineLayout.h:
    * rendering/RenderBlockFlow.cpp:
    (WebCore::RenderBlockFlow::styleDidChange):
    * rendering/SimpleLineLayout.cpp:
    (WebCore::SimpleLineLayout::canUseForAfterStyleChange):
    * rendering/SimpleLineLayout.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (266436 => 266437)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-02 01:19:30 UTC (rev 266436)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-02 01:19:32 UTC (rev 266437)
@@ -1,5 +1,50 @@
 2020-09-01  Alan Coon  <[email protected]>
 
+        Cherry-pick r266291. rdar://problem/68177666
+
+    No need to run full can-use-for (fast inline layout codepath) check on every style change.
+    https://bugs.webkit.org/show_bug.cgi?id=215937
+    <rdar://problem/67951360>
+    
+    Reviewed by Antti Koivisto.
+    
+    Let's use the StyleDifference to figure out how extensive the can-use-for check should be.
+    We can certainly skip some relatively expensive content checks when we know that the style change only triggers repaint or positioned-movement-only changes.
+    
+    * layout/integration/LayoutIntegrationLineLayout.cpp:
+    (WebCore::LayoutIntegration::LineLayout::canUseForAfterStyleChange):
+    * layout/integration/LayoutIntegrationLineLayout.h:
+    * rendering/RenderBlockFlow.cpp:
+    (WebCore::RenderBlockFlow::styleDidChange):
+    * rendering/SimpleLineLayout.cpp:
+    (WebCore::SimpleLineLayout::canUseForAfterStyleChange):
+    * rendering/SimpleLineLayout.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-28  Zalan Bujtas  <[email protected]>
+
+            No need to run full can-use-for (fast inline layout codepath) check on every style change.
+            https://bugs.webkit.org/show_bug.cgi?id=215937
+            <rdar://problem/67951360>
+
+            Reviewed by Antti Koivisto.
+
+            Let's use the StyleDifference to figure out how extensive the can-use-for check should be.
+            We can certainly skip some relatively expensive content checks when we know that the style change only triggers repaint or positioned-movement-only changes.
+
+            * layout/integration/LayoutIntegrationLineLayout.cpp:
+            (WebCore::LayoutIntegration::LineLayout::canUseForAfterStyleChange):
+            * layout/integration/LayoutIntegrationLineLayout.h:
+            * rendering/RenderBlockFlow.cpp:
+            (WebCore::RenderBlockFlow::styleDidChange):
+            * rendering/SimpleLineLayout.cpp:
+            (WebCore::SimpleLineLayout::canUseForAfterStyleChange):
+            * rendering/SimpleLineLayout.h:
+
+2020-09-01  Alan Coon  <[email protected]>
+
         Cherry-pick r266281. rdar://problem/68177575
 
     Remove adopted node from TextManipulationController

Modified: branches/safari-610-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (266436 => 266437)


--- branches/safari-610-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-09-02 01:19:30 UTC (rev 266436)
+++ branches/safari-610-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-09-02 01:19:32 UTC (rev 266437)
@@ -83,6 +83,12 @@
     return true;
 }
 
+bool LineLayout::canUseForAfterStyleChange(const RenderBlockFlow& flow, StyleDifference diff)
+{
+    ASSERT(RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled());
+    return SimpleLineLayout::canUseForAfterStyleChange(flow, diff);
+}
+
 void LineLayout::updateStyle()
 {
     auto& root = rootLayoutBox();

Modified: branches/safari-610-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (266436 => 266437)


--- branches/safari-610-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-09-02 01:19:30 UTC (rev 266436)
+++ branches/safari-610-branch/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-09-02 01:19:32 UTC (rev 266437)
@@ -60,6 +60,7 @@
     ~LineLayout();
 
     static bool canUseFor(const RenderBlockFlow&, Optional<bool> couldUseSimpleLineLayout = { });
+    static bool canUseForAfterStyleChange(const RenderBlockFlow&, StyleDifference);
 
     void updateStyle();
     void layout();

Modified: branches/safari-610-branch/Source/WebCore/rendering/RenderBlockFlow.cpp (266436 => 266437)


--- branches/safari-610-branch/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-09-02 01:19:30 UTC (rev 266436)
+++ branches/safari-610-branch/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-09-02 01:19:32 UTC (rev 266437)
@@ -2107,11 +2107,10 @@
         auto shouldInvalidateLineLayoutPath = [&] {
             if (selfNeedsLayout() || complexLineLayout())
                 return true;
-            // FIXME: This could use a cheaper style-only test instead of SimpleLineLayout::canUseFor.
-            if (simpleLineLayout() && !SimpleLineLayout::canUseFor(*this))
+            if (simpleLineLayout() && !SimpleLineLayout::canUseForAfterStyleChange(*this, diff))
                 return true;
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-            if (layoutFormattingContextLineLayout() && !LayoutIntegration::LineLayout::canUseFor(*this))
+            if (layoutFormattingContextLineLayout() && !LayoutIntegration::LineLayout::canUseForAfterStyleChange(*this, diff))
                 return true;
 #endif
             return false;

Modified: branches/safari-610-branch/Source/WebCore/rendering/SimpleLineLayout.cpp (266436 => 266437)


--- branches/safari-610-branch/Source/WebCore/rendering/SimpleLineLayout.cpp	2020-09-02 01:19:30 UTC (rev 266436)
+++ branches/safari-610-branch/Source/WebCore/rendering/SimpleLineLayout.cpp	2020-09-02 01:19:32 UTC (rev 266437)
@@ -359,6 +359,30 @@
     return canUseForWithReason(flow, IncludeReasons::First) == NoReason;
 }
 
+bool canUseForAfterStyleChange(const RenderBlockFlow& blockContainer, StyleDifference diff)
+{
+    switch (diff) {
+    case StyleDifference::Equal:
+    case StyleDifference::RecompositeLayer:
+        return true;
+    case StyleDifference::Repaint:
+    case StyleDifference::RepaintIfTextOrBorderOrOutline:
+    case StyleDifference::RepaintLayer:
+        // FIXME: We could do a more focused style check by matching RendererStyle::changeRequiresRepaint&co.
+        return canUseForStyle(blockContainer.style(), IncludeReasons::First) == NoReason;
+    case StyleDifference::LayoutPositionedMovementOnly:
+        return true;
+    case StyleDifference::SimplifiedLayout:
+    case StyleDifference::SimplifiedLayoutAndPositionedMovement:
+        return canUseForStyle(blockContainer.style(), IncludeReasons::First) == NoReason;
+    case StyleDifference::Layout:
+    case StyleDifference::NewStyle:
+        return canUseFor(blockContainer);
+    }
+    ASSERT_NOT_REACHED();
+    return canUseFor(blockContainer);
+}
+
 static void revertAllRunsOnCurrentLine(Layout::RunVector& runs)
 {
     while (!runs.isEmpty() && !runs.last().isEndOfLine)

Modified: branches/safari-610-branch/Source/WebCore/rendering/SimpleLineLayout.h (266436 => 266437)


--- branches/safari-610-branch/Source/WebCore/rendering/SimpleLineLayout.h	2020-09-02 01:19:30 UTC (rev 266436)
+++ branches/safari-610-branch/Source/WebCore/rendering/SimpleLineLayout.h	2020-09-02 01:19:32 UTC (rev 266437)
@@ -45,6 +45,7 @@
 class RunResolver;
 
 bool canUseFor(const RenderBlockFlow&);
+bool canUseForAfterStyleChange(const RenderBlockFlow&, StyleDifference);
 AvoidanceReasonFlags canUseForWithReason(const RenderBlockFlow&, IncludeReasons);
 
 struct Run {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to