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..51acaf84d3df3fab59941b969ea97e83af84652c 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> |
#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> inner blocks. |
+ 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()) { |
cathiechentx
2017/02/07 08:35:54
Cause ruby could be block or inline, deal with rub
|
+ // Skip layoutRubyRun which is inline-block. |
+ // Inflate ruby's inner blocks. |
+ if (parent->slowFirstChild() && parent->slowFirstChild()->isRubyRun()) { |
+ child = toLayoutRubyRun(parent->slowFirstChild())->firstChild(); |
+ behavior = DescendToInnerBlocks; |
+ } |
+ } else if (parent->isLayoutBlock() && |
+ (parent->childrenInline() || behavior == DescendToInnerBlocks)) |
child = toLayoutBlock(parent)->firstChild(); |
else if (parent->isLayoutInline()) |
child = toLayoutInline(parent)->firstChild(); |