Bug 191078 - [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
Summary: [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-10-30 13:13 PDT by zalan
Modified: 2018-11-09 22:39 PST (History)
9 users (show)

See Also:


Attachments
Patch (22.83 KB, patch)
2018-10-30 13:22 PDT, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.34 MB, application/zip)
2018-10-30 14:26 PDT, EWS Watchlist
no flags Details
Patch (25.38 KB, patch)
2018-11-01 11:36 PDT, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-sierra-wk2 (3.22 MB, application/zip)
2018-11-01 12:58 PDT, EWS Watchlist
no flags Details
Patch (25.27 KB, patch)
2018-11-06 12:59 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (24.06 KB, patch)
2018-11-09 13:36 PST, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.50 MB, application/zip)
2018-11-09 14:29 PST, EWS Watchlist
no flags Details
Patch (24.18 KB, patch)
2018-11-09 15:33 PST, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2 (3.11 MB, application/zip)
2018-11-09 19:41 PST, EWS Watchlist
no flags Details
Patch (24.07 KB, patch)
2018-11-09 21:59 PST, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2018-10-30 13:13:35 PDT
as opposed to waiting for 500ms with the initial paint.
Comment 1 zalan 2018-10-30 13:14:26 PDT
waiting 500ms that is.
Comment 2 zalan 2018-10-30 13:22:59 PDT
Created attachment 353403 [details]
Patch
Comment 3 EWS Watchlist 2018-10-30 13:26:32 PDT
Attachment 353403 [details] did not pass style-queue:


ERROR: Source/WebCore/page/ChromeClient.h:336:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
ERROR: Source/WebCore/page/FrameView.cpp:96:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 EWS Watchlist 2018-10-30 14:26:50 PDT
Comment on attachment 353403 [details]
Patch

Attachment 353403 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/9783488

New failing tests:
tiled-drawing/simple-document-with-margin-tiles.html
compositing/tiling/non-visible-window-tile-coverage.html
Comment 5 EWS Watchlist 2018-10-30 14:26:52 PDT
Created attachment 353408 [details]
Archive of layout-test-results from ews107 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 6 Simon Fraser (smfr) 2018-10-31 13:44:07 PDT
Comment on attachment 353403 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=353403&action=review

> Source/WebCore/ChangeLog:12
> +        1. Improve visuallyNoneEmpty milestone confidence
> +        2. Issue initial paint soon after the milestone fires
> +        3. Suspend optional style recalcs and layouts while painting is being throttled.

Will you break this into 3 patches?

> Source/WebCore/dom/Document.cpp:1810
> +    const Seconds styleRecalcDelay = 50_ms;

Would be nice to see all the throttling-related code in one place some day.

> Source/WebCore/page/FrameView.cpp:4415
> +        auto hasPendingScriptExecution = frame().document()->scriptRunner() && frame().document()->scriptRunner()->hasPendingScripts();
> +        if (auto* documentLoader = frame().loader().documentLoader()) {
> +            auto& resourceLoader = documentLoader->cachedResourceLoader();
> +            if (!resourceLoader.requestCount())
> +                return hasPendingScriptExecution;
> +
> +            auto& resources = resourceLoader.allCachedResources();
> +            for (auto& resource : resources) {
> +                if (resource.value->isLoaded())
> +                    continue;
> +                if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::Script || resource.value->type() == CachedResource::Type::FontResource)
> +                    return false;
> +            }
> +        }

Maybe pull this into a separate function.

> Source/WebCore/page/FrameView.h:396
> +    void incrementVisuallyNonEmptyCharacterCount(const String);

const String&

> Source/WebCore/page/FrameView.h:947
> +    auto whitespaceCheck = [](UChar character) {
> +        return character == ' ' || character == '\t' || character == '\n';
> +    };

Can you not share some existing code for this? What about   ?

> Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:117
> +    void initialDeferredPaint();

Hard to figure out what this means. Does it mean do the paint, or something else?
Comment 7 Radar WebKit Bug Importer 2018-11-01 11:31:18 PDT
<rdar://problem/45736178>
Comment 8 zalan 2018-11-01 11:36:59 PDT
Created attachment 353624 [details]
Patch
Comment 9 EWS Watchlist 2018-11-01 11:39:34 PDT
Attachment 353624 [details] did not pass style-queue:


ERROR: Source/WebCore/page/ChromeClient.h:336:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 zalan 2018-11-01 11:40:07 PDT
(In reply to Simon Fraser (smfr) from comment #6)
> Comment on attachment 353403 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=353403&action=review
> 
> > Source/WebCore/ChangeLog:12
> > +        1. Improve visuallyNoneEmpty milestone confidence
> > +        2. Issue initial paint soon after the milestone fires
> > +        3. Suspend optional style recalcs and layouts while painting is being throttled.
> 
> Will you break this into 3 patches?
Normally I would, but since the additional paint is certainly a perf regression, I'd rather have it together with the potential progression of suspending optional style recalcs/layouts.

> 
> > Source/WebCore/dom/Document.cpp:1810
> > +    const Seconds styleRecalcDelay = 50_ms;
> 
> Would be nice to see all the throttling-related code in one place some day.
> 
> > Source/WebCore/page/FrameView.cpp:4415
> > +        auto hasPendingScriptExecution = frame().document()->scriptRunner() && frame().document()->scriptRunner()->hasPendingScripts();
> > +        if (auto* documentLoader = frame().loader().documentLoader()) {
> > +            auto& resourceLoader = documentLoader->cachedResourceLoader();
> > +            if (!resourceLoader.requestCount())
> > +                return hasPendingScriptExecution;
> > +
> > +            auto& resources = resourceLoader.allCachedResources();
> > +            for (auto& resource : resources) {
> > +                if (resource.value->isLoaded())
> > +                    continue;
> > +                if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::Script || resource.value->type() == CachedResource::Type::FontResource)
> > +                    return false;
> > +            }
> > +        }
> 
> Maybe pull this into a separate function.
Done.

> 
> > Source/WebCore/page/FrameView.h:396
> > +    void incrementVisuallyNonEmptyCharacterCount(const String);
> 
> const String&
:(

> 
> > Source/WebCore/page/FrameView.h:947
> > +    auto whitespaceCheck = [](UChar character) {
> > +        return character == ' ' || character == '\t' || character == '\n';
> > +    };
> 
> Can you not share some existing code for this? What about &nbsp; ?
I actually did find something similar in parsing code.

> 
> > Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:117
> > +    void initialDeferredPaint();
> 
> Hard to figure out what this means. Does it mean do the paint, or something
> else?
Good point. Renamed.
Comment 11 Antti Koivisto 2018-11-01 12:14:41 PDT
Comment on attachment 353624 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=353624&action=review

r=me. Interesting to see how the perf bots like this.

> Source/WebCore/dom/Document.cpp:1810
> +    const auto styleRecalcDelay = 50_ms;

I suppose there is some deep science here?

> Source/WebCore/dom/Document.cpp:1811
> +    m_styleRecalcTimer.startOneShot(throttleStyleRecalc ? styleRecalcDelay : 0_s);

Maybe this change could be done separately?

> Source/WebCore/rendering/RenderText.cpp:203
> +    // FIXME: Find out how to increment the visually non empty character count when the font becomes available.

Maybe this stuff needs to move to RenderText::styleDidChange
Comment 12 zalan 2018-11-01 12:48:34 PDT
(In reply to Antti Koivisto from comment #11)
> Comment on attachment 353624 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=353624&action=review
> 
> r=me. Interesting to see how the perf bots like this.
> 
> > Source/WebCore/dom/Document.cpp:1810
> > +    const auto styleRecalcDelay = 50_ms;
> 
> I suppose there is some deep science here?
49ms seemed too short, while 51ms felt way too long.

> 
> > Source/WebCore/dom/Document.cpp:1811
> > +    m_styleRecalcTimer.startOneShot(throttleStyleRecalc ? styleRecalcDelay : 0_s);
> 
> Maybe this change could be done separately?
perf bots would see this patch as a net regression without that change.

> 
> > Source/WebCore/rendering/RenderText.cpp:203
> > +    // FIXME: Find out how to increment the visually non empty character count when the font becomes available.
> 
> Maybe this stuff needs to move to RenderText::styleDidChange
I was thinking about that too. Will probably do it in a a followup patch.
Comment 13 EWS Watchlist 2018-11-01 12:58:40 PDT
Comment on attachment 353624 [details]
Patch

Attachment 353624 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/9817559

New failing tests:
tiled-drawing/simple-document-with-margin-tiles.html
compositing/tiling/non-visible-window-tile-coverage.html
Comment 14 EWS Watchlist 2018-11-01 12:58:41 PDT
Created attachment 353636 [details]
Archive of layout-test-results from ews104 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 15 Simon Fraser (smfr) 2018-11-01 13:01:27 PDT
Also, what's the story on macOS? Do we do similar throttling?
Comment 16 zalan 2018-11-01 13:58:24 PDT
(In reply to Simon Fraser (smfr) from comment #15)
> Also, what's the story on macOS? Do we do similar throttling?
Geoff and I talked about it and agreed that it would be part of a followup patch.
Comment 17 zalan 2018-11-04 08:38:43 PST
Committed r237785: <https://trac.webkit.org/changeset/237785>
Comment 18 Ryan Haddad 2018-11-05 09:30:44 PST
(In reply to Build Bot from comment #13)
> Comment on attachment 353624 [details]
> Patch
> 
> Attachment 353624 [details] did not pass mac-wk2-ews (mac-wk2):
> Output: https://webkit-queues.webkit.org/results/9817559
> 
> New failing tests:
> tiled-drawing/simple-document-with-margin-tiles.html
> compositing/tiling/non-visible-window-tile-coverage.html

These tests are failing on the bots after <https://trac.webkit.org/changeset/237785>:
https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/r237785%20(12559)/results.html
Comment 19 zalan 2018-11-05 09:34:29 PST
(In reply to Ryan Haddad from comment #18)
> (In reply to Build Bot from comment #13)
> > Comment on attachment 353624 [details]
> > Patch
> > 
> > Attachment 353624 [details] did not pass mac-wk2-ews (mac-wk2):
> > Output: https://webkit-queues.webkit.org/results/9817559
> > 
> > New failing tests:
> > tiled-drawing/simple-document-with-margin-tiles.html
> > compositing/tiling/non-visible-window-tile-coverage.html
> 
> These tests are failing on the bots after
> <https://trac.webkit.org/changeset/237785>:
> https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/
> r237785%20(12559)/results.html
It looks to me a (In reply to Ryan Haddad from comment #18)
> (In reply to Build Bot from comment #13)
> > Comment on attachment 353624 [details]
> > Patch
> > 
> > Attachment 353624 [details] did not pass mac-wk2-ews (mac-wk2):
> > Output: https://webkit-queues.webkit.org/results/9817559
> > 
> > New failing tests:
> > tiled-drawing/simple-document-with-margin-tiles.html
> > compositing/tiling/non-visible-window-tile-coverage.html
> 
> These tests are failing on the bots after
> <https://trac.webkit.org/changeset/237785>:
> https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/
> r237785%20(12559)/results.html
I assume those tests need rebaselining but not 100% sure what values represent in this context. Let me check with Tim/Simon first.
Comment 20 Ryan Haddad 2018-11-05 09:36:22 PST
Other issues after this change:

These two API tests are timing out on macOS bots

    TestWebKitAPI.WebKit.LayoutMilestonesWithAllContentInFrame
    TestWebKitAPI.WebKit.FirstVisuallyNonEmptyLayoutAfterPageCacheRestore

https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK2%20%28Tests%29/builds/12559


Layout tests are exiting early and 5 API tests are failing the following assertion on iOS Simulator Debug bots:

ASSERTION FAILED: !m_layerFlushTimer.isActive()
/Volumes/Data/slave/ios-simulator-12-debug/build/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm(290) : virtual void WebKit::RemoteLayerTreeDrawingArea::scheduleInitialDeferredPaint()

https://build.webkit.org/builders/Apple%20iOS%2012%20Simulator%20Debug%20WK2%20(Tests)/builds/637
Comment 21 Ryan Haddad 2018-11-05 10:07:13 PST
Reverted r237785 for reason:

Introduced layout test and API test failures on macOS and iOS.

Committed r237813: <https://trac.webkit.org/changeset/237813>
Comment 22 Simon Fraser (smfr) 2018-11-05 11:31:28 PST
(In reply to zalan from comment #19)
> (In reply to Ryan Haddad from comment #18)
> > 
> > These tests are failing on the bots after
> > <https://trac.webkit.org/changeset/237785>:
> > https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/
> > r237785%20(12559)/results.html
> I assume those tests need rebaselining but not 100% sure what values
> represent in this context. Let me check with Tim/Simon first.

Those seem like real regressions.
Comment 23 zalan 2018-11-05 21:30:30 PST
(In reply to Ryan Haddad from comment #21)
> Reverted r237785 for reason:
> 
> Introduced layout test and API test failures on macOS and iOS.
> 
> Committed r237813: <https://trac.webkit.org/changeset/237813>
Both the API and the iOS failures are addressed now and I can't repro the mac-wk2 only failures locally. :(
Comment 24 zalan 2018-11-06 12:59:11 PST
Created attachment 353992 [details]
Patch
Comment 25 EWS Watchlist 2018-11-06 13:01:13 PST
Attachment 353992 [details] did not pass style-queue:


ERROR: Source/WebCore/page/ChromeClient.h:336:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 26 zalan 2018-11-09 13:36:34 PST
Created attachment 354380 [details]
Patch
Comment 27 EWS Watchlist 2018-11-09 13:37:46 PST
Attachment 354380 [details] did not pass style-queue:


ERROR: Source/WebCore/page/ChromeClient.h:336:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 28 EWS Watchlist 2018-11-09 14:29:35 PST
Comment on attachment 354380 [details]
Patch

Attachment 354380 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/9928487

New failing tests:
http/wpt/css/css-animations/start-animation-001.html
Comment 29 EWS Watchlist 2018-11-09 14:29:36 PST
Created attachment 354386 [details]
Archive of layout-test-results from ews103 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 30 zalan 2018-11-09 15:33:42 PST
Created attachment 354394 [details]
Patch
Comment 31 EWS Watchlist 2018-11-09 15:37:36 PST
Attachment 354394 [details] did not pass style-queue:


ERROR: Source/WebCore/page/ChromeClient.h:336:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 32 EWS Watchlist 2018-11-09 19:41:52 PST
Comment on attachment 354394 [details]
Patch

Attachment 354394 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/9932804

New failing tests:
accessibility/ios-simulator/form-control-validation-message.html
Comment 33 EWS Watchlist 2018-11-09 19:41:54 PST
Created attachment 354430 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 34 zalan 2018-11-09 21:59:59 PST
Created attachment 354441 [details]
Patch
Comment 35 EWS Watchlist 2018-11-09 22:02:58 PST
Attachment 354441 [details] did not pass style-queue:


ERROR: Source/WebCore/page/ChromeClient.h:336:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 36 WebKit Commit Bot 2018-11-09 22:39:27 PST
Comment on attachment 354441 [details]
Patch

Clearing flags on attachment: 354441

Committed r238064: <https://trac.webkit.org/changeset/238064>
Comment 37 WebKit Commit Bot 2018-11-09 22:39:29 PST
All reviewed patches have been landed.  Closing bug.