WebKit Bugzilla
Attachment 360164 Details for
Bug 193842
: Remove FrameView::m_significantRenderedTextMilestonePending
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193842-20190125142725.patch (text/plain), 8.37 KB, created by
zalan
on 2019-01-25 14:27:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-01-25 14:27:31 PST
Size:
8.37 KB
patch
obsolete
>Subversion Revision: 240497 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 949d6d16b9cf66150ddc066b09ef79582a598047..9394d785f8f377e45b371746cec0c3720fb12cba 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-25 Zalan Bujtas <zalan@apple.com> >+ >+ Remove FrameView::m_significantRenderedTextMilestonePending >+ https://bugs.webkit.org/show_bug.cgi?id=193842 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Currently we keep processing the incoming text content until after the "SignificantRenderedTextMilestone" has been reached. >+ We can actually stop doing it right when the text content is above the threshold (regardless of whether all the conditions are met for the milestone). >+ This patch also ensures that we don't update Document::m_mainArticleElement once the threshold is reached. >+ >+ * page/FrameView.cpp: >+ (WebCore::FrameView::resetLayoutMilestones): >+ (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount): >+ (WebCore::FrameView::hasReachedSignificantRenderedTextThreashold): >+ (WebCore::FrameView::qualifiesAsSignificantRenderedText const): >+ (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded): >+ (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded): Deleted. >+ * page/FrameView.h: >+ > 2019-01-25 Zalan Bujtas <zalan@apple.com> > > Remove FrameView::m_firstVisuallyNonEmptyLayoutCallbackPending >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index 4e37baa5c9ed4311f42ff40ac43cb2bb4991f026..c93b04eb6a943bc62474ea4fe59b52bd54ed9a5d 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -293,7 +293,7 @@ void FrameView::resetLayoutMilestones() > { > m_firstLayoutCallbackPending = false; > m_isVisuallyNonEmpty = false; >- m_significantRenderedTextMilestonePending = true; >+ m_hasReachedSignificantRenderedTextThreshold = false; > m_renderedSignificantAmountOfText = false; > m_visuallyNonEmptyCharacterCount = 0; > m_visuallyNonEmptyPixelCount = 0; >@@ -3307,8 +3307,7 @@ void FrameView::performPostLayoutTasks() > { > // FIXME: We should not run any JavaScript code in this function. > LOG(Layout, "FrameView %p performPostLayoutTasks", this); >- >- frame().document()->updateMainArticleElementAfterLayout(); >+ updateHasReachedSignificantRenderedTextThreshold(); > frame().selection().updateAppearanceAfterLayout(); > > flushPostLayoutTasksQueue(); >@@ -4387,11 +4386,9 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive() > > void FrameView::incrementVisuallyNonEmptyCharacterCount(const String& inlineText) > { >- if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold && m_renderedSignificantAmountOfText) >+ if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold && m_hasReachedSignificantRenderedTextThreshold) > return; > >- ++m_textRendererCountForVisuallyNonEmptyCharacters; >- > auto nonWhitespaceLength = [](auto& inlineText) { > auto length = inlineText.length(); > for (unsigned i = 0; i < inlineText.length(); ++i) { >@@ -4402,9 +4399,7 @@ void FrameView::incrementVisuallyNonEmptyCharacterCount(const String& inlineText > return length; > }; > m_visuallyNonEmptyCharacterCount += nonWhitespaceLength(inlineText); >- >- if (!m_renderedSignificantAmountOfText) >- updateSignificantRenderedTextMilestoneIfNeeded(); >+ ++m_textRendererCountForVisuallyNonEmptyCharacters; > } > > static bool elementOverflowRectIsLargerThanThreshold(const Element& element) >@@ -4418,6 +4413,42 @@ static bool elementOverflowRectIsLargerThanThreshold(const Element& element) > return false; > } > >+void FrameView::updateHasReachedSignificantRenderedTextThreshold() >+{ >+ if (m_hasReachedSignificantRenderedTextThreshold) >+ return; >+ >+ auto* document = frame().document(); >+ if (!document) >+ return; >+ >+ document->updateMainArticleElementAfterLayout(); >+ auto hasMainArticleElement = document->hasMainArticleElement(); >+ auto characterThreshold = hasMainArticleElement ? mainArticleSignificantRenderedTextCharacterThreshold : defaultSignificantRenderedTextCharacterThreshold; >+ if (m_visuallyNonEmptyCharacterCount < characterThreshold) >+ return; >+ >+ auto meanLength = hasMainArticleElement ? mainArticleSignificantRenderedTextMeanLength : defaultSignificantRenderedTextMeanLength; >+ if (!m_textRendererCountForVisuallyNonEmptyCharacters || m_visuallyNonEmptyCharacterCount / static_cast<float>(m_textRendererCountForVisuallyNonEmptyCharacters) < meanLength) >+ return; >+ >+ m_hasReachedSignificantRenderedTextThreshold = true; >+} >+ >+bool FrameView::qualifiesAsSignificantRenderedText() const >+{ >+ ASSERT(!m_renderedSignificantAmountOfText); >+ auto* document = frame().document(); >+ if (!document || document->styleScope().hasPendingSheetsBeforeBody()) >+ return false; >+ >+ auto* documentElement = document->documentElement(); >+ if (!documentElement || !elementOverflowRectIsLargerThanThreshold(*documentElement)) >+ return false; >+ >+ return m_hasReachedSignificantRenderedTextThreshold; >+} >+ > bool FrameView::qualifiesAsVisuallyNonEmpty() const > { > // No content yet. >@@ -4490,31 +4521,6 @@ bool FrameView::qualifiesAsVisuallyNonEmpty() const > return false; > } > >-void FrameView::updateSignificantRenderedTextMilestoneIfNeeded() >-{ >- if (m_renderedSignificantAmountOfText) >- return; >- >- auto* document = frame().document(); >- if (!document || document->styleScope().hasPendingSheetsBeforeBody()) >- return; >- >- auto* documentElement = document->documentElement(); >- if (!documentElement || !elementOverflowRectIsLargerThanThreshold(*documentElement)) >- return; >- >- auto characterThreshold = document->hasMainArticleElement() ? mainArticleSignificantRenderedTextCharacterThreshold : defaultSignificantRenderedTextCharacterThreshold; >- auto meanLength = document->hasMainArticleElement() ? mainArticleSignificantRenderedTextMeanLength : defaultSignificantRenderedTextMeanLength; >- >- if (m_visuallyNonEmptyCharacterCount < characterThreshold) >- return; >- >- if (!m_textRendererCountForVisuallyNonEmptyCharacters || m_visuallyNonEmptyCharacterCount / static_cast<float>(m_textRendererCountForVisuallyNonEmptyCharacters) < meanLength) >- return; >- >- m_renderedSignificantAmountOfText = true; >-} >- > bool FrameView::isViewForDocumentInFrame() const > { > RenderView* renderView = this->renderView(); >@@ -5136,7 +5142,6 @@ void FrameView::fireLayoutRelatedMilestonesIfNeeded() > if (frame().isMainFrame()) > page->startCountingRelevantRepaintedObjects(); > } >- updateSignificantRenderedTextMilestoneIfNeeded(); > > if (!m_isVisuallyNonEmpty && qualifiesAsVisuallyNonEmpty()) { > m_isVisuallyNonEmpty = true; >@@ -5145,8 +5150,8 @@ void FrameView::fireLayoutRelatedMilestonesIfNeeded() > milestonesAchieved.add(DidFirstVisuallyNonEmptyLayout); > } > >- if (m_renderedSignificantAmountOfText && m_significantRenderedTextMilestonePending) { >- m_significantRenderedTextMilestonePending = false; >+ if (!m_renderedSignificantAmountOfText && qualifiesAsSignificantRenderedText()) { >+ m_renderedSignificantAmountOfText = true; > if (requestedMilestones & DidRenderSignificantAmountOfText) > milestonesAchieved.add(DidRenderSignificantAmountOfText); > } >diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h >index e89bd8e97b2b786c558852583e684944ed64a4c4..1b2fe100b5c7e5e9a41bd1bed18b101978ef6950 100644 >--- a/Source/WebCore/page/FrameView.h >+++ b/Source/WebCore/page/FrameView.h >@@ -793,6 +793,9 @@ private: > void markRootOrBodyRendererDirty() const; > > bool qualifiesAsVisuallyNonEmpty() const; >+ bool qualifiesAsSignificantRenderedText() const; >+ void updateHasReachedSignificantRenderedTextThreshold(); >+ > bool isViewForDocumentInFrame() const; > > AXObjectCache* axObjectCache() const; >@@ -883,8 +886,8 @@ private: > unsigned m_visuallyNonEmptyPixelCount { 0 }; > > unsigned m_textRendererCountForVisuallyNonEmptyCharacters { 0 }; >- bool m_renderedSignificantAmountOfText; >- bool m_significantRenderedTextMilestonePending; >+ bool m_renderedSignificantAmountOfText { false }; >+ bool m_hasReachedSignificantRenderedTextThreshold { false }; > > bool m_needsDeferredScrollbarsUpdate { false }; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193842
:
360152
|
360160
| 360164