Bug 187578 - Make it easier to hit the significant rendered text layout milestone on pages with main article elements
Summary: Make it easier to hit the significant rendered text layout milestone on pages...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-07-11 21:17 PDT by Wenson Hsieh
Modified: 2018-07-12 23:22 PDT (History)
12 users (show)

See Also:


Attachments
Patch (29.77 KB, patch)
2018-07-11 21:38 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Patch (29.77 KB, patch)
2018-07-11 22:31 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Address feedback. (30.28 KB, patch)
2018-07-12 15:14 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Move registration logic to HTMLElement. (31.53 KB, patch)
2018-07-12 17:58 PDT, Wenson Hsieh
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.02 MB, application/zip)
2018-07-12 19:08 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews102 for mac-sierra (2.36 MB, application/zip)
2018-07-12 19:11 PDT, EWS Watchlist
no flags Details
Move registration logic to HTMLElement (v2) (31.48 KB, patch)
2018-07-12 19:58 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Patch for landing (30.24 KB, patch)
2018-07-12 22:43 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2018-07-11 21:17:19 PDT
Our current heuristics are very conservative, with the intention of avoiding false positives.

We can probably relax some of these constraints when we've detected the presence of a main article element on the page. (e.g. NYTimes)
Comment 1 Wenson Hsieh 2018-07-11 21:38:49 PDT
Created attachment 344822 [details]
Patch
Comment 2 Daniel Bates 2018-07-11 21:46:54 PDT
Comment on attachment 344822 [details]
Patch

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

I have not checked this patch for correctness or read through it as I am tired. Just noticed some very minor issues.

> Source/WebCore/ChangeLog:8
> +        Our current heuristics for triggering the signficant rendered text layout milestone are very conservative, with

signficant => significant

> Source/WebCore/dom/Document.cpp:7715
> +    static unsigned maxNumberOfArticlesBeforeIgnoringMainContentArticle = 10;

static  => const

> Source/WebCore/dom/Document.cpp:7720
> +    static float mainContentArticleHeightFactor = 4;

Ditto.

> Source/WebCore/dom/Document.cpp:7721
> +    static float mainContentArticleMinimumHeight = 1000;

Ditto.
Comment 3 Wenson Hsieh 2018-07-11 22:31:31 PDT
Created attachment 344827 [details]
Patch
Comment 4 Wenson Hsieh 2018-07-11 22:31:39 PDT
Comment on attachment 344822 [details]
Patch

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

>> Source/WebCore/ChangeLog:8
>> +        Our current heuristics for triggering the signficant rendered text layout milestone are very conservative, with
> 
> signficant => significant

Good catch!

>> Source/WebCore/dom/Document.cpp:7715
>> +    static unsigned maxNumberOfArticlesBeforeIgnoringMainContentArticle = 10;
> 
> static  => const

Changed to const.
Comment 5 Radar WebKit Bug Importer 2018-07-11 22:34:39 PDT
<rdar://problem/42104637>
Comment 6 Ryosuke Niwa 2018-07-12 12:58:55 PDT
Comment on attachment 344827 [details]
Patch

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

I think we need another iteration since this keeping track of elements in a document is really trickily.
I can't r+ this until I see the final patch.

> Source/WebCore/dom/Document.cpp:7721
> +    const float mainContentArticleMinimumHeight = 1000;

This should probably a factor of the viewport size or width.
A hard coded height in px doesn't make much sense.

> Source/WebCore/dom/Element.cpp:1756
> +    if (UNLIKELY(hasTagName(articleTag) && newDocument))

Don't do this in Element::insertedIntoAncestor. Add HTMLArticleElement::insertedIntoAncestor instead.

> Source/WebCore/dom/Element.cpp:1806
> +            if (UNLIKELY(hasTagName(articleTag)))

Ditto.
Comment 7 Wenson Hsieh 2018-07-12 13:00:04 PDT
Comment on attachment 344827 [details]
Patch

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

>> Source/WebCore/dom/Document.cpp:7721
>> +    const float mainContentArticleMinimumHeight = 1000;
> 
> This should probably a factor of the viewport size or width.
> A hard coded height in px doesn't make much sense.

Will fix!

>> Source/WebCore/dom/Element.cpp:1756
>> +    if (UNLIKELY(hasTagName(articleTag) && newDocument))
> 
> Don't do this in Element::insertedIntoAncestor. Add HTMLArticleElement::insertedIntoAncestor instead.

HTMLArticleElement doesn't exist. Should I introduce it?
Comment 8 Ryosuke Niwa 2018-07-12 13:24:15 PDT
Comment on attachment 344827 [details]
Patch

Hm... okay. I guess we'd have to keep it in HTMLElement in that case.
Comment 9 Wenson Hsieh 2018-07-12 15:14:18 PDT
Created attachment 344889 [details]
Address feedback.
Comment 10 Wenson Hsieh 2018-07-12 17:58:11 PDT
Created attachment 344909 [details]
Move registration logic to HTMLElement.
Comment 11 EWS Watchlist 2018-07-12 19:08:31 PDT
Comment on attachment 344909 [details]
Move registration logic to HTMLElement.

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

New failing tests:
accessibility/roles-exposed.html
Comment 12 EWS Watchlist 2018-07-12 19:08:33 PDT
Created attachment 344914 [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 13 EWS Watchlist 2018-07-12 19:11:43 PDT
Comment on attachment 344909 [details]
Move registration logic to HTMLElement.

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

New failing tests:
accessibility/roles-exposed.html
Comment 14 EWS Watchlist 2018-07-12 19:11:45 PDT
Created attachment 344915 [details]
Archive of layout-test-results from ews102 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 15 Wenson Hsieh 2018-07-12 19:58:58 PDT
Created attachment 344920 [details]
Move registration logic to HTMLElement (v2)
Comment 16 Wenson Hsieh 2018-07-12 21:25:50 PDT
(In reply to Ryosuke Niwa from comment #8)
> Comment on attachment 344827 [details]
> Patch
> 
> Hm... okay. I guess we'd have to keep it in HTMLElement in that case.

@Ryosuke — does https://bugs.webkit.org/attachment.cgi?id=344920&action=review look reasonable? If so, I'll send it off to commit queue.
Comment 17 Ryosuke Niwa 2018-07-12 22:18:01 PDT
Comment on attachment 344920 [details]
Move registration logic to HTMLElement (v2)

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

> Source/WebCore/html/HTMLElement.cpp:404
> +Node::InsertedIntoAncestorResult HTMLElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)

I think we should just go with the check in Element. This patch introduces an extra function call.
Comment 18 Wenson Hsieh 2018-07-12 22:20:57 PDT
(In reply to Ryosuke Niwa from comment #17)
> Comment on attachment 344920 [details]
> Move registration logic to HTMLElement (v2)
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=344920&action=review
> 
> > Source/WebCore/html/HTMLElement.cpp:404
> > +Node::InsertedIntoAncestorResult HTMLElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
> 
> I think we should just go with the check in Element. This patch introduces
> an extra function call.

👍 Will do.
Comment 19 Wenson Hsieh 2018-07-12 22:43:59 PDT
Created attachment 344927 [details]
Patch for landing
Comment 20 WebKit Commit Bot 2018-07-12 23:22:41 PDT
Comment on attachment 344927 [details]
Patch for landing

Clearing flags on attachment: 344927

Committed r233794: <https://trac.webkit.org/changeset/233794>
Comment 21 WebKit Commit Bot 2018-07-12 23:22:43 PDT
All reviewed patches have been landed.  Closing bug.