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

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

Issue 2683553002: Fix not autosizing ruby elements issue. (Closed)
Patch Set: Use MarkContainerChain for setPreferredLogicalWidthsDirty, when we skipped inline-block before 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
Index: third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp b/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp
index f60be84782e83130a34f20bae85a1a030b712912..6d99be31895d2042c4f7ca3c7bbfa00cfb3c6fc5 100644
--- a/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp
+++ b/third_party/WebKit/Source/core/layout/TextAutosizerTest.cpp
@@ -661,4 +661,57 @@ TEST_F(TextAutosizerTest, ChangingInheritedClusterTextInsideSuperCluster) {
EXPECT_FLOAT_EQ(16.f, shortText->style()->specifiedFontSize());
EXPECT_FLOAT_EQ(28.f, shortText->style()->computedFontSize());
}
+
+TEST_F(TextAutosizerTest, AutosizeInnerContentOfRuby) {
+ setBodyInnerHTML(
+ "<meta name='viewport' content='width=800'>"
+ "<style>"
+ " html { font-size: 16px; }"
+ " body { width: 800px; margin: 0; overflow-y: hidden; }"
+ "</style>"
+ "<div id='autosized'>"
+ " 東京特許許可局許可局長 今日"
+ " <ruby>"
+ " <rb id='rubyInline'>急遽</rb>"
+ " <rp>(</rp>"
+ " <rt>きゅうきょ</rt>"
+ " <rp>)</rp>"
+ " </ruby>"
+ " 許可却下、<br><br>"
+ " <span>"
+ " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec "
+ " sed diam facilisis, elementum elit at, elementum sem. Aliquam "
+ " consectetur leo at nisi fermentum, vitae maximus libero "
+ "sodales. Sed "
+ " laoreet congue ipsum, at tincidunt ante tempor sed. Cras eget "
+ "erat "
+ " mattis urna vestibulum porta. Sed tempus vitae dui et suscipit. "
+ " Curabitur laoreet accumsan pharetra. Nunc facilisis, elit sit "
+ "amet "
+ " sollicitudin condimentum, ipsum velit ultricies mi, eget "
+ "dapibus nunc "
+ " nulla nec sapien. Fusce dictum imperdiet aliquet."
+ " </span>"
+ " <ruby style='display:block'>"
+ " <rb id='rubyBlock'>拼音</rb>"
+ " <rt>pin yin</rt>"
+ " </ruby>"
+ "</div>");
+ document().view()->updateAllLifecyclePhases();
+
+ Element* rubyInline = document().getElementById("rubyInline");
+ EXPECT_FLOAT_EQ(16.f,
+ rubyInline->layoutObject()->style()->specifiedFontSize());
+ // (specified font-size = 16px) * (viewport width = 800px) /
+ // (window width = 320px) = 40px.
+ EXPECT_FLOAT_EQ(40.f,
+ rubyInline->layoutObject()->style()->computedFontSize());
+
+ Element* rubyBlock = document().getElementById("rubyBlock");
+ EXPECT_FLOAT_EQ(16.f,
+ rubyBlock->layoutObject()->style()->specifiedFontSize());
+ // (specified font-size = 16px) * (viewport width = 800px) /
+ // (window width = 320px) = 40px.
+ EXPECT_FLOAT_EQ(40.f, rubyBlock->layoutObject()->style()->computedFontSize());
+}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698