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

Unified Diff: Source/core/page/Page.cpp

Issue 215503003: Reland text autosizing changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/core/page/Page.cpp
diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp
index a5986abd7e881ebf5f3bb49056b6105c65251e86..2530af92a517b260752070675d004691affc9c68 100644
--- a/Source/core/page/Page.cpp
+++ b/Source/core/page/Page.cpp
@@ -51,6 +51,7 @@
#include "core/page/StorageClient.h"
#include "core/page/ValidationMessageClient.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/rendering/FastTextAutosizer.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/TextAutosizer.h"
#include "core/storage/StorageNamespace.h"
@@ -488,20 +489,19 @@ void Page::settingsChanged(SettingsDelegate::ChangeType changeType)
}
break;
case SettingsDelegate::TextAutosizingChange:
- // FTA needs both setNeedsRecalcStyle and setNeedsLayout after a setting change.
- if (RuntimeEnabledFeatures::fastTextAutosizingEnabled()) {
- setNeedsRecalcStyleInAllFrames();
+ if (!mainFrame())
+ break;
+ if (FastTextAutosizer* textAutosizer = mainFrame()->document()->fastTextAutosizer()) {
+ textAutosizer->updatePageInfoInAllFrames();
} else {
- // FIXME: I wonder if this needs to traverse frames like in WebViewImpl::resize, or whether there is only one document per Settings instance?
for (LocalFrame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
- TextAutosizer* textAutosizer = frame->document()->textAutosizer();
- if (textAutosizer)
+ if (TextAutosizer* textAutosizer = frame->document()->textAutosizer())
textAutosizer->recalculateMultipliers();
}
+ // TextAutosizing updates RenderStyle during layout phase (via TextAutosizer::processSubtree).
+ // We should invoke setNeedsLayout here.
+ setNeedsLayoutInAllFrames();
}
- // TextAutosizing updates RenderStyle during layout phase (via TextAutosizer::processSubtree).
- // We should invoke setNeedsLayout here.
- setNeedsLayoutInAllFrames();
break;
case SettingsDelegate::ScriptEnableChange:
m_inspectorController->scriptsEnabled(settings().scriptEnabled());

Powered by Google App Engine
This is Rietveld 408576698