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

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

Issue 2683553002: Fix not autosizing ruby elements issue. (Closed)
Patch Set: delete unused include 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..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();
« 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