Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1315)

Unified Diff: Source/core/rendering/TextAutosizer.cpp

Issue 189113014: TextAutosizer: unlock multipliers on DOMContentLoaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: similarity=90 Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Source/core/dom/Document.cpp ('K') | « Source/core/rendering/TextAutosizer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/TextAutosizer.cpp
diff --git a/Source/core/rendering/TextAutosizer.cpp b/Source/core/rendering/TextAutosizer.cpp
index c1bb64adf55906929daf5c51977c38ed551cf51d..99fe26cc91ea94fce907c018ffeaf3f1aca591da 100644
--- a/Source/core/rendering/TextAutosizer.cpp
+++ b/Source/core/rendering/TextAutosizer.cpp
@@ -169,8 +169,20 @@ unsigned TextAutosizer::getCachedHash(const RenderObject* renderer, bool putInCa
return combinedHashValue;
}
+bool TextAutosizer::isApplicable() const
+{
+ return m_document->settings()
+ && m_document->settings()->textAutosizingEnabled()
+ && m_document->page()
+ && m_document->page()->mainFrame()
+ && m_document->page()->mainFrame()->loader().stateMachine()->committedFirstRealDocumentLoad();
+}
+
void TextAutosizer::recalculateMultipliers()
{
+ if (!isApplicable())
+ return;
+
RenderObject* renderer = m_document->renderer();
while (renderer) {
if (renderer->style() && renderer->style()->textAutosizingMultiplier() != 1)
@@ -183,19 +195,12 @@ bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
{
TRACE_EVENT0("webkit", "TextAutosizer::processSubtree");
- if (!m_document->settings() || layoutRoot->view()->document().printing() || !m_document->page())
- return false;
-
- bool textAutosizingEnabled = m_document->settings()->textAutosizingEnabled();
- if (!textAutosizingEnabled)
+ if (!isApplicable() || layoutRoot->view()->document().printing())
return false;
LocalFrame* mainFrame = m_document->page()->mainFrame();
TextAutosizingWindowInfo windowInfo;
- if (!mainFrame->loader().stateMachine()->committedFirstRealDocumentLoad())
- return false;
-
InspectorInstrumentation::willAutosizeText(layoutRoot);
// Window area, in logical (density-independent) pixels.
« Source/core/dom/Document.cpp ('K') | « Source/core/rendering/TextAutosizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698