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

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

Issue 2817443003: Fix font-size shaking issue in some pages (Closed)
Patch Set: rebaseline layout-after-append.html 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();
pdr. 2017/04/20 06:25:46 I don't think it'll be correct to move the IsTable
cathiechentx 2017/04/27 10:51:42 yes, table and td have the same inherit issues. I
+}
+
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;
-
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;
+
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))
pdr. 2017/04/20 06:25:46 I think this change is just making child clusters
cathiechentx 2017/04/27 10:51:42 If we choose to fix the general case, here is the
cathiechentx 2017/05/25 11:36:38 We had a misunderstanding here. Sorry for my bad E
+ return true;
+
#if DCHECK_IS_ON()
DCHECK(blocks_that_have_begun_layout_.Contains(cluster->root_));
DCHECK(blocks_that_have_begun_layout_.Contains(

Powered by Google App Engine
This is Rietveld 408576698