Changeset 213600 in webkit


Ignore:
Timestamp:
Mar 8, 2017, 2:53:20 PM (9 years ago)
Author:
Simon Fraser
Message:

Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
https://bugs.webkit.org/show_bug.cgi?id=169384

Reviewed by Zalan Bujtas.

Source/WebCore:

determineNonLayerDescendantsPaintedContent() would bail after depth 3, sibling count 20. However,
empirical testing shows that it would run to completion more often if the limit was based on the
number of nodes traversed (in particular, it's common to see fairly deep subtrees with few siblings).
Running to completion has huge memory advantages, because we can then be sure to have checked all the
renderers for smoothed text, allowing us, on some pages, to avoid the extra memory cost of using
layers that support subpixel-antialiased text.

Performance measurement shows that mean runtime of this function goes up from 0.30us to 0.34us
with a 200 renderer limit, which seems worthwhile.

Test: compositing/contents-format/subpixel-antialiased-text-traversal.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateClipRects):

LayoutTests:

Rebaseline an existing test which changes behavior, and add a new test that generates divs
on both sides of the threshold, in depth and breadth.

  • compositing/contents-format/subpixel-antialiased-text-traversal-expected.txt: Added.
  • compositing/contents-format/subpixel-antialiased-text-traversal.html: Added.
  • platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt:
  • platform/mac/compositing/contents-format/subpixel-antialiased-text-traversal-expected.txt: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r213598 r213600  
     12017-03-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
     4        https://bugs.webkit.org/show_bug.cgi?id=169384
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Rebaseline an existing test which changes behavior, and add a new test that generates divs
     9        on both sides of the threshold, in depth and breadth.
     10
     11        * compositing/contents-format/subpixel-antialiased-text-traversal-expected.txt: Added.
     12        * compositing/contents-format/subpixel-antialiased-text-traversal.html: Added.
     13        * platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt:
     14        * platform/mac/compositing/contents-format/subpixel-antialiased-text-traversal-expected.txt: Added.
     15
    1162017-03-08  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/LayoutTests/platform/mac/compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style-expected.txt

    r213466 r213600  
    112112          (position 352.00 357.00)
    113113          (bounds 162.00 162.00)
    114           (supports subpixel antialiased text 1)
    115114          (drawsContent 1)
    116115        )
  • trunk/Source/WebCore/ChangeLog

    r213598 r213600  
     12017-03-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
     4        https://bugs.webkit.org/show_bug.cgi?id=169384
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        determineNonLayerDescendantsPaintedContent() would bail after depth 3, sibling count 20. However,
     9        empirical testing shows that it would run to completion more often if the limit was based on the
     10        number of nodes traversed (in particular, it's common to see fairly deep subtrees with few siblings).
     11        Running to completion has huge memory advantages, because we can then be sure to have checked all the
     12        renderers for smoothed text, allowing us, on some pages, to avoid the extra memory cost of using
     13        layers that support subpixel-antialiased text.
     14
     15        Performance measurement shows that mean runtime of this function goes up from 0.30us to 0.34us
     16        with a 200 renderer limit, which seems worthwhile.
     17
     18        Test: compositing/contents-format/subpixel-antialiased-text-traversal.html
     19
     20        * rendering/RenderLayer.cpp:
     21        (WebCore::RenderLayer::calculateClipRects):
     22
    1232017-03-08  Youenn Fablet  <youenn@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r213466 r213600  
    65886588
    65896589// Constrain the depth and breadth of the search for performance.
    6590 static const int maxDescendentDepth = 3;
    6591 static const int maxSiblingCount = 20;
    6592 
    6593 static void determineNonLayerDescendantsPaintedContent(const RenderElement& renderer, int depth, RenderLayer::PaintedContentRequest& request)
    6594 {
    6595     if (depth > maxDescendentDepth) {
    6596         request.makeStatesUndetermined();
    6597         return;
    6598     }
    6599    
    6600     int siblingCount = 0;
     6590static const unsigned maxRendererTraversalCount = 200;
     6591
     6592static void determineNonLayerDescendantsPaintedContent(const RenderElement& renderer, unsigned& renderersTraversed, RenderLayer::PaintedContentRequest& request)
     6593{
    66016594    for (const auto& child : childrenOfType<RenderObject>(renderer)) {
    6602         if (++siblingCount > maxSiblingCount) {
     6595        if (++renderersTraversed > maxRendererTraversalCount) {
    66036596            request.makeStatesUndetermined();
    66046597            return;
     
    66526645        }
    66536646
    6654         determineNonLayerDescendantsPaintedContent(renderElementChild, depth + 1, request);
     6647        determineNonLayerDescendantsPaintedContent(renderElementChild, renderersTraversed, request);
    66556648        if (request.isSatisfied())
    66566649            return;
     
    66606653bool RenderLayer::hasNonEmptyChildRenderers(PaintedContentRequest& request) const
    66616654{
    6662     determineNonLayerDescendantsPaintedContent(renderer(), 0, request);
     6655    unsigned renderersTraversed = 0;
     6656    determineNonLayerDescendantsPaintedContent(renderer(), renderersTraversed, request);
    66636657    return request.probablyHasPaintedContent();
    66646658}
Note: See TracChangeset for help on using the changeset viewer.