Bug 187412

Summary: Introduce a layout milestone to track when the document contains a large number of rendered characters
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: WebKit Misc.Assignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, bdakin, commit-queue, ews-watchlist, koivisto, rniwa, thorton, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
rniwa: review+, ews-watchlist: commit-queue-
v2
none
Archive of layout-test-results from ews201 for win-future
none
Archive of layout-test-results from ews201 for win-future none

Wenson Hsieh
Reported 2018-07-06 14:28:12 PDT
Attachments
Patch (29.65 KB, patch)
2018-07-06 14:54 PDT, Wenson Hsieh
rniwa: review+
ews-watchlist: commit-queue-
v2 (29.58 KB, patch)
2018-07-06 20:51 PDT, Wenson Hsieh
no flags
Archive of layout-test-results from ews201 for win-future (12.89 MB, application/zip)
2018-07-06 20:54 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews201 for win-future (12.77 MB, application/zip)
2018-07-07 05:38 PDT, EWS Watchlist
no flags
Wenson Hsieh
Comment 1 2018-07-06 14:54:09 PDT
Ryosuke Niwa
Comment 2 2018-07-06 19:21:05 PDT
Comment on attachment 344462 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344462&action=review > Source/WebCore/ChangeLog:9 > + Implements a new layout milestone: `DidReachSignificantRenderedTextThreshold`. This is similar to the existing Why not DidReachSignificantAmoutOfTextRenderedThreshold or DidRenderedSignificantAmoutOfText? I don't think "Threshold" adds much value here since everything is heuristics based. > Source/WebCore/page/FrameView.cpp:4364 > + if (!m_numberOfTextRenderers || m_visuallyNonEmptyCharacterCount / (float)m_numberOfTextRenderers < significantRenderedTextMeanLength) Use static_cast<float> > Source/WebCore/page/FrameView.h:934 > + ++m_numberOfTextRenderers; I think more canonical way of naming this variable would be m_renderTextCount. But this is the total number of render text ever created since FrameView::reset() is last called so that's not quite right either. How about m_renderTextCountForVisuallyNonEmptyCharacters?
Wenson Hsieh
Comment 3 2018-07-06 19:26:16 PDT
Comment on attachment 344462 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344462&action=review >> Source/WebCore/ChangeLog:9 >> + Implements a new layout milestone: `DidReachSignificantRenderedTextThreshold`. This is similar to the existing > > Why not DidReachSignificantAmoutOfTextRenderedThreshold or DidRenderedSignificantAmoutOfText? > I don't think "Threshold" adds much value here since everything is heuristics based. Sounds good — I'll go with DidRenderSignificantAmountOfText >> Source/WebCore/page/FrameView.cpp:4364 >> + if (!m_numberOfTextRenderers || m_visuallyNonEmptyCharacterCount / (float)m_numberOfTextRenderers < significantRenderedTextMeanLength) > > Use static_cast<float> 👍 >> Source/WebCore/page/FrameView.h:934 >> + ++m_numberOfTextRenderers; > > I think more canonical way of naming this variable would be m_renderTextCount. > But this is the total number of render text ever created since FrameView::reset() is last called > so that's not quite right either. > How about m_renderTextCountForVisuallyNonEmptyCharacters? Sounds good — I'll go with m_renderTextCountForVisuallyNonEmptyCharacters.
zalan
Comment 4 2018-07-06 19:56:58 PDT
Comment on attachment 344462 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344462&action=review > Source/WebCore/ChangeLog:16 > + being capable of Reader mode. In many article-like pages, the average length of an uninterrupted text node is page is capable of being capable of > Source/WebCore/ChangeLog:17 > + significantly longer than other types of pages; thus, on pages where the average length of a text node is very What's an uninterrupted text node? > Source/WebCore/ChangeLog:19 > + Safari reader mode on watchOS. Is this a watchOS only feature? > Source/WebCore/ChangeLog:38 > + layout, this milestone is never guaranteed to fire. What if an iframe fires this milestone and not the main frame? The page is still considered Reader like? > Source/WebCore/page/FrameView.cpp:4315 > + return snappedIntRect(element.renderBox()->layoutOverflowRect()).height() >= documentHeightThreshold; on trunk it is guaranteed that element.renderBox != nullptr since qualifiesAsVisuallyNonEmpty early returns, but now I can just call this function when element->renderer() is nullptr.
Wenson Hsieh
Comment 5 2018-07-06 20:50:56 PDT
Comment on attachment 344462 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=344462&action=review >> Source/WebCore/ChangeLog:16 >> + being capable of Reader mode. In many article-like pages, the average length of an uninterrupted text node is > > page is capable of being capable of Oops! Fixed. >> Source/WebCore/ChangeLog:17 >> + significantly longer than other types of pages; thus, on pages where the average length of a text node is very > > What's an uninterrupted text node? I really just meant "text node" here — the "uninterrupted" part should've just been omitted. >> Source/WebCore/ChangeLog:19 >> + Safari reader mode on watchOS. > > Is this a watchOS only feature? It'll fire on iOS and macOS as well if the SPI client opts into the milestone (the API test included in this patch even exercises this using the iOS simulator). That being said, Safari on watchOS is the only client that might make use of this layout milestone at the moment. >> Source/WebCore/ChangeLog:38 >> + layout, this milestone is never guaranteed to fire. > > What if an iframe fires this milestone and not the main frame? The page is still considered Reader like? That's...an interesting point. At the moment, an iframe isn't capable of firing this milestone (since FrameView::fireLayoutRelatedMilestonesIfNeeded limits firing layout milestones to the main frame). I'm not certain what our eventual policy should be regarding layout milestones for subframes. FWIW, we disable cross-origin subframes altogether on watchOS, so I don't think this will matter much for the time being. >> Source/WebCore/page/FrameView.cpp:4315 >> + return snappedIntRect(element.renderBox()->layoutOverflowRect()).height() >= documentHeightThreshold; > > on trunk it is guaranteed that element.renderBox != nullptr since qualifiesAsVisuallyNonEmpty early returns, but now I can just call this function when element->renderer() is nullptr. Fair point. I'll make this robust when `!element.renderBox()`.
Wenson Hsieh
Comment 6 2018-07-06 20:51:06 PDT
EWS Watchlist
Comment 7 2018-07-06 20:54:00 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 8 2018-07-06 20:54:13 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 9 2018-07-07 05:38:42 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 10 2018-07-07 05:38:53 PDT Comment hidden (obsolete)
WebKit Commit Bot
Comment 11 2018-07-07 14:05:52 PDT
Comment on attachment 344507 [details] v2 Clearing flags on attachment: 344507 Committed r233623: <https://trac.webkit.org/changeset/233623>
Note You need to log in before you can comment on or make changes to this bug.