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

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

Issue 2683553002: Fix not autosizing ruby elements issue. (Closed)
Patch Set: update comments Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 af61f4ee062355a2a97ee95ee8ea791af24cea91..6625049ebe3fbb41ab3738e7d61ca4767eb195b8 100644
--- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
+++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -30,6 +30,7 @@
#include "core/layout/TextAutosizer.h"
+#include <memory>
mstensho (USE GERRIT) 2017/02/07 10:32:36 Shouldn't have to move this up here.
pdr. 2017/02/08 04:45:33 I think it's okay, it seems to be the new clang fo
cathiechentx 2017/02/08 07:07:41 yes, "git cl format" did this:)
#include "core/dom/Document.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
@@ -41,6 +42,7 @@
#include "core/layout/LayoutInline.h"
#include "core/layout/LayoutListItem.h"
#include "core/layout/LayoutListMarker.h"
+#include "core/layout/LayoutRubyRun.h"
#include "core/layout/LayoutTable.h"
#include "core/layout/LayoutTableCell.h"
#include "core/layout/LayoutView.h"
@@ -48,7 +50,6 @@
#include "core/layout/api/LayoutViewItem.h"
#include "core/page/Page.h"
#include "wtf/PtrUtil.h"
-#include <memory>
#ifdef AUTOSIZING_DOM_DEBUG_INFO
#include "core/dom/ExecutionContextTask.h"
@@ -400,6 +401,10 @@ void TextAutosizer::beginLayout(LayoutBlock* block,
if (prepareForLayout(block) == StopLayout)
return;
+ // Skip ruby's inner blocks, cause these blocks already be inflated.
mstensho (USE GERRIT) 2017/02/07 10:32:36 "because these blocks are already inflated"?
cathiechentx 2017/02/08 07:07:41 Done.
+ if (block->isRubyRun() || block->isRubyBase() || block->isRubyText())
+ return;
+
ASSERT(!m_clusterStack.isEmpty() || block->isLayoutView());
if (Cluster* cluster = maybeCreateCluster(block))
@@ -470,8 +475,15 @@ float TextAutosizer::inflate(LayoutObject* parent,
bool hasTextChild = false;
LayoutObject* child = nullptr;
- if (parent->isLayoutBlock() &&
- (parent->childrenInline() || behavior == DescendToInnerBlocks))
+ if (parent->isRuby()) {
+ // Skip layoutRubyRun which is inline-block.
+ // Inflate rubyRun's inner blocks.
+ if (parent->slowFirstChild() && parent->slowFirstChild()->isRubyRun()) {
mstensho (USE GERRIT) 2017/02/07 10:32:36 Might want to store parent->slowFirstChild() as a
cathiechentx 2017/02/08 07:07:41 Done.
+ child = toLayoutRubyRun(parent->slowFirstChild())->firstChild();
+ behavior = DescendToInnerBlocks;
+ }
+ } else if (parent->isLayoutBlock() &&
+ (parent->childrenInline() || behavior == DescendToInnerBlocks))
pdr. 2017/02/08 04:45:33 style nit: because curly braces were added for the
cathiechentx 2017/02/08 07:07:41 Done.
child = toLayoutBlock(parent)->firstChild();
else if (parent->isLayoutInline())
child = toLayoutInline(parent)->firstChild();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698