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

Unified Diff: third_party/WebKit/Source/core/layout/TextAutosizer.cpp

Issue 2817443003: Fix font-size shaking issue in some pages (Closed)
Patch Set: layout test failed Created 3 years, 8 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: third_party/WebKit/Source/core/layout/TextAutosizer.cpp
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
index 4af1f5c63a330a978ddfd12803140a7120f740e2..a0b98b2e73dab12fa4cc2cd0cb449dc8424d6744 100644
--- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
+++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -226,6 +226,10 @@ static LayoutObject* GetParent(const LayoutObject* object) {
return parent;
}
+static bool needMakeSelfAsWidthProvider(const LayoutBlock* block) {
+ return block->IsTable() || block->IsTableCell() || block->IsLayoutView();
+}
+
TextAutosizer::TextAutosizer(const Document* document)
: document_(document),
first_block_to_begin_layout_(nullptr),
@@ -911,9 +915,6 @@ float TextAutosizer::SuperclusterMultiplier(Cluster* cluster) {
const LayoutBlock* TextAutosizer::ClusterWidthProvider(
const LayoutBlock* root) const {
- if (root->IsTable() || root->IsTableCell())
- return root;
-
cathiechentx 2017/04/18 09:26:45 Conside of the inherit issuses. Move this check to
return DeepestBlockContainingAllText(root);
}
@@ -1009,6 +1010,9 @@ const LayoutBlock* TextAutosizer::DeepestBlockContainingAllText(
// FIXME: Refactor this to look more like TextAutosizer::deepestCommonAncestor.
const LayoutBlock* TextAutosizer::DeepestBlockContainingAllText(
const LayoutBlock* root) const {
+ if (needMakeSelfAsWidthProvider(root))
+ return root;
cathiechentx 2017/04/18 09:26:45 The special exceptions(table, td, html) check shou
+
size_t first_depth = 0;
const LayoutObject* first_text_leaf = FindTextLeaf(root, first_depth, kFirst);
if (!first_text_leaf)
@@ -1149,6 +1153,10 @@ bool TextAutosizer::IsWiderOrNarrowerDescendant(Cluster* cluster) {
const LayoutBlock* parent_deepest_block_containing_all_text =
DeepestBlockContainingAllText(cluster->parent_);
+ // Block that needMakeSelfAsWidthProvider shouldn't be inherited.
+ if (needMakeSelfAsWidthProvider(parent_deepest_block_containing_all_text))
+ return true;
cathiechentx 2017/04/18 09:26:45 These special exceptions(table, td, html) couldn't
+
#if DCHECK_IS_ON()
DCHECK(blocks_that_have_begun_layout_.Contains(cluster->root_));
DCHECK(blocks_that_have_begun_layout_.Contains(
« no previous file with comments | « third_party/WebKit/Source/core/layout/TextAutosizer.h ('k') | third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698