Title: [257952] trunk/Source/WebCore
Revision
257952
Author
[email protected]
Date
2020-03-05 15:43:58 -0800 (Thu, 05 Mar 2020)

Log Message

[First paint] Fixed sized SVG content should taken into account when computing VNE status
https://bugs.webkit.org/show_bug.cgi?id=208663
<rdar://problem/60096896>

Reviewed by Simon Fraser.

Let's add fixed sized SVG to the list of content we track as VNE pixel count.
It helps to reach VNE status sooner on youtube.com.

* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::reportVisuallyNonEmptyContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (257951 => 257952)


--- trunk/Source/WebCore/ChangeLog	2020-03-05 23:13:45 UTC (rev 257951)
+++ trunk/Source/WebCore/ChangeLog	2020-03-05 23:43:58 UTC (rev 257952)
@@ -1,3 +1,17 @@
+2020-03-05  Zalan Bujtas  <[email protected]>
+
+        [First paint] Fixed sized SVG content should taken into account when computing VNE status
+        https://bugs.webkit.org/show_bug.cgi?id=208663
+        <rdar://problem/60096896>
+
+        Reviewed by Simon Fraser.
+
+        Let's add fixed sized SVG to the list of content we track as VNE pixel count.
+        It helps to reach VNE status sooner on youtube.com.
+
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::reportVisuallyNonEmptyContent):
+
 2020-03-05  Yusuke Suzuki  <[email protected]>
 
         Put all generated JSCells in WebCore into IsoSubspace

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (257951 => 257952)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2020-03-05 23:13:45 UTC (rev 257951)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2020-03-05 23:43:58 UTC (rev 257952)
@@ -934,6 +934,24 @@
         m_view.frameView().incrementVisuallyNonEmptyPixelCount(roundedIntSize(replacedRenderer.intrinsicSize()));
         return;
     }
+    if (is<RenderSVGRoot>(child)) {
+        auto fixedSize = [] (const auto& renderer) -> Optional<IntSize> {
+            auto& style = renderer.style();
+            if (!style.width().isFixed() || !style.height().isFixed())
+                return { };
+            return makeOptional(IntSize { style.width().intValue(), style.height().intValue() });
+        };
+        // SVG content tends to have a fixed size construct. However this is known to be inaccurate in certain cases (box-sizing: border-box) or especially when the parent box is oversized.
+        auto candidateSize = IntSize { };
+        if (auto size = fixedSize(child))
+            candidateSize = *size;
+        else if (auto size = fixedSize(parent))
+            candidateSize = *size;
+
+        if (!candidateSize.isEmpty())
+            m_view.frameView().incrementVisuallyNonEmptyPixelCount(candidateSize);
+        return;
+    }
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to