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

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: Fix TestExpectation to ImageOnlyFailure 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
« no previous file with comments | « 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 1b836dfb9a0f72e3152c719035cf4033e05cae9e..7e1b350c8c1249e949c81d04aef1eb97e6bd1b41 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)
@@ -182,20 +194,13 @@ void TextAutosizer::recalculateMultipliers()
bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
{
TRACE_EVENT0("webkit", "TextAutosizer: check if needed");
- 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;
-
-
// Window area, in logical (density-independent) pixels.
windowInfo.windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
if (windowInfo.windowSize.isEmpty())
« no previous file with comments | « Source/core/rendering/TextAutosizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698