diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc | 203 |
1 files changed, 104 insertions, 99 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc b/chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc index 6bf81b4f8ef..fde0c2e10ff 100644 --- a/chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc +++ b/chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc @@ -78,11 +78,11 @@ TEST_F(TextAutosizerTest, SimpleParagraph) { )HTML"); Element* autosized = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. EXPECT_FLOAT_EQ(40.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, TextSizeAdjustDisablesAutosizing) { @@ -121,16 +121,16 @@ TEST_F(TextAutosizerTest, TextSizeAdjustDisablesAutosizing) { )HTML"); LayoutObject* text_size_adjust_auto = GetDocument().getElementById("textSizeAdjustAuto")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_auto->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(40.f, text_size_adjust_auto->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_auto->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(40.f, text_size_adjust_auto->StyleRef().ComputedFontSize()); LayoutObject* text_size_adjust_none = GetDocument().getElementById("textSizeAdjustNone")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_none->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_none->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_none->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_none->StyleRef().ComputedFontSize()); LayoutObject* text_size_adjust100 = GetDocument().getElementById("textSizeAdjust100")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust100->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(16.f, text_size_adjust100->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust100->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust100->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ParagraphWithChangingTextSizeAdjustment) { @@ -154,37 +154,37 @@ TEST_F(TextAutosizerTest, ParagraphWithChangingTextSizeAdjustment) { )HTML"); Element* autosized_div = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ( - 16.f, autosized_div->GetLayoutObject()->Style()->SpecifiedFontSize()); + 16.f, autosized_div->GetLayoutObject()->StyleRef().SpecifiedFontSize()); EXPECT_FLOAT_EQ( - 40.f, autosized_div->GetLayoutObject()->Style()->ComputedFontSize()); + 40.f, autosized_div->GetLayoutObject()->StyleRef().ComputedFontSize()); autosized_div->setAttribute(HTMLNames::classAttr, "none"); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_FLOAT_EQ( - 16.f, autosized_div->GetLayoutObject()->Style()->SpecifiedFontSize()); + 16.f, autosized_div->GetLayoutObject()->StyleRef().SpecifiedFontSize()); EXPECT_FLOAT_EQ( - 16.f, autosized_div->GetLayoutObject()->Style()->ComputedFontSize()); + 16.f, autosized_div->GetLayoutObject()->StyleRef().ComputedFontSize()); autosized_div->setAttribute(HTMLNames::classAttr, "small"); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_FLOAT_EQ( - 16.f, autosized_div->GetLayoutObject()->Style()->SpecifiedFontSize()); + 16.f, autosized_div->GetLayoutObject()->StyleRef().SpecifiedFontSize()); EXPECT_FLOAT_EQ( - 8.f, autosized_div->GetLayoutObject()->Style()->ComputedFontSize()); + 8.f, autosized_div->GetLayoutObject()->StyleRef().ComputedFontSize()); autosized_div->setAttribute(HTMLNames::classAttr, "large"); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_FLOAT_EQ( - 16.f, autosized_div->GetLayoutObject()->Style()->SpecifiedFontSize()); + 16.f, autosized_div->GetLayoutObject()->StyleRef().SpecifiedFontSize()); EXPECT_FLOAT_EQ( - 24.f, autosized_div->GetLayoutObject()->Style()->ComputedFontSize()); + 24.f, autosized_div->GetLayoutObject()->StyleRef().ComputedFontSize()); autosized_div->removeAttribute(HTMLNames::classAttr); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_FLOAT_EQ( - 16.f, autosized_div->GetLayoutObject()->Style()->SpecifiedFontSize()); + 16.f, autosized_div->GetLayoutObject()->StyleRef().SpecifiedFontSize()); EXPECT_FLOAT_EQ( - 40.f, autosized_div->GetLayoutObject()->Style()->ComputedFontSize()); + 40.f, autosized_div->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ZeroTextSizeAdjustment) { @@ -205,8 +205,8 @@ TEST_F(TextAutosizerTest, ZeroTextSizeAdjustment) { )HTML"); LayoutObject* text_size_adjust_zero = GetDocument().getElementById("textSizeAdjustZero")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_zero->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(0.f, text_size_adjust_zero->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_zero->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(0.f, text_size_adjust_zero->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, NegativeTextSizeAdjustment) { @@ -228,8 +228,9 @@ TEST_F(TextAutosizerTest, NegativeTextSizeAdjustment) { LayoutObject* text_size_adjust_negative = GetDocument().getElementById("textSizeAdjustNegative")->GetLayoutObject(); EXPECT_FLOAT_EQ(16.f, - text_size_adjust_negative->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(40.f, text_size_adjust_negative->Style()->ComputedFontSize()); + text_size_adjust_negative->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(40.f, + text_size_adjust_negative->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, TextSizeAdjustmentPixelUnits) { @@ -250,8 +251,9 @@ TEST_F(TextAutosizerTest, TextSizeAdjustmentPixelUnits) { "</div>"); LayoutObject* text_size_adjust_pixels = GetDocument().getElementById("textSizeAdjustPixels")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_pixels->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(40.f, text_size_adjust_pixels->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, + text_size_adjust_pixels->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(40.f, text_size_adjust_pixels->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, NestedTextSizeAdjust) { @@ -281,14 +283,14 @@ TEST_F(TextAutosizerTest, NestedTextSizeAdjust) { )HTML"); LayoutObject* text_size_adjust_a = GetDocument().getElementById("textSizeAdjustA")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_a->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_a->StyleRef().SpecifiedFontSize()); // 16px * 47% = 7.52 - EXPECT_FLOAT_EQ(7.52f, text_size_adjust_a->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(7.52f, text_size_adjust_a->StyleRef().ComputedFontSize()); LayoutObject* text_size_adjust_b = GetDocument().getElementById("textSizeAdjustB")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust_b->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_b->StyleRef().SpecifiedFontSize()); // 16px * 53% = 8.48 - EXPECT_FLOAT_EQ(8.48f, text_size_adjust_b->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(8.48f, text_size_adjust_b->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, PrefixedTextSizeAdjustIsAlias) { @@ -309,10 +311,10 @@ TEST_F(TextAutosizerTest, PrefixedTextSizeAdjustIsAlias) { )HTML"); LayoutObject* text_size_adjust = GetDocument().getElementById("textSizeAdjust")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(8.f, text_size_adjust->Style()->ComputedFontSize()); - EXPECT_FLOAT_EQ(.5f, - text_size_adjust->Style()->GetTextSizeAdjust().Multiplier()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(8.f, text_size_adjust->StyleRef().ComputedFontSize()); + EXPECT_FLOAT_EQ( + .5f, text_size_adjust->StyleRef().GetTextSizeAdjust().Multiplier()); } TEST_F(TextAutosizerTest, AccessibilityFontScaleFactor) { @@ -334,11 +336,11 @@ TEST_F(TextAutosizerTest, AccessibilityFontScaleFactor) { )HTML"); Element* autosized = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // 1.5 * (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 60px. EXPECT_FLOAT_EQ(60.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, AccessibilityFontScaleFactorWithTextSizeAdjustNone) { @@ -371,19 +373,19 @@ TEST_F(TextAutosizerTest, AccessibilityFontScaleFactorWithTextSizeAdjustNone) { )HTML"); Element* autosized = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // 1.5 * (specified font-size = 16px) = 24px. EXPECT_FLOAT_EQ(24.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); // Because this does not autosize (due to the width), no accessibility font // scale factor should be applied. Element* not_autosized = GetDocument().getElementById("notAutosized"); EXPECT_FLOAT_EQ( - 16.f, not_autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + 16.f, not_autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // specified font-size = 16px. EXPECT_FLOAT_EQ( - 16.f, not_autosized->GetLayoutObject()->Style()->ComputedFontSize()); + 16.f, not_autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ChangingAccessibilityFontScaleFactor) { @@ -405,21 +407,21 @@ TEST_F(TextAutosizerTest, ChangingAccessibilityFontScaleFactor) { )HTML"); Element* autosized = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // 1.0 * (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. EXPECT_FLOAT_EQ(40.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); GetDocument().GetSettings()->SetAccessibilityFontScaleFactor(2); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // 2.0 * (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 80px. EXPECT_FLOAT_EQ(80.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, TextSizeAdjustDoesNotDisableAccessibility) { @@ -452,21 +454,21 @@ TEST_F(TextAutosizerTest, TextSizeAdjustDoesNotDisableAccessibility) { GetDocument().getElementById("textSizeAdjustNone"); EXPECT_FLOAT_EQ( 16.f, - text_size_adjust_none->GetLayoutObject()->Style()->SpecifiedFontSize()); + text_size_adjust_none->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // 1.5 * (specified font-size = 16px) = 24px. EXPECT_FLOAT_EQ( 24.f, - text_size_adjust_none->GetLayoutObject()->Style()->ComputedFontSize()); + text_size_adjust_none->GetLayoutObject()->StyleRef().ComputedFontSize()); Element* text_size_adjust_double = GetDocument().getElementById("textSizeAdjustDouble"); - EXPECT_FLOAT_EQ( - 16.f, - text_size_adjust_double->GetLayoutObject()->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_double->GetLayoutObject() + ->StyleRef() + .SpecifiedFontSize()); // 1.5 * (specified font-size = 16px) * (text size adjustment = 2) = 48px. - EXPECT_FLOAT_EQ( - 48.f, - text_size_adjust_double->GetLayoutObject()->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(48.f, text_size_adjust_double->GetLayoutObject() + ->StyleRef() + .ComputedFontSize()); // Changing the accessibility font scale factor should change the adjusted // size. @@ -475,19 +477,19 @@ TEST_F(TextAutosizerTest, TextSizeAdjustDoesNotDisableAccessibility) { EXPECT_FLOAT_EQ( 16.f, - text_size_adjust_none->GetLayoutObject()->Style()->SpecifiedFontSize()); + text_size_adjust_none->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // 2.0 * (specified font-size = 16px) = 32px. EXPECT_FLOAT_EQ( 32.f, - text_size_adjust_none->GetLayoutObject()->Style()->ComputedFontSize()); + text_size_adjust_none->GetLayoutObject()->StyleRef().ComputedFontSize()); - EXPECT_FLOAT_EQ( - 16.f, - text_size_adjust_double->GetLayoutObject()->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust_double->GetLayoutObject() + ->StyleRef() + .SpecifiedFontSize()); // 2.0 * (specified font-size = 16px) * (text size adjustment = 2) = 64px. - EXPECT_FLOAT_EQ( - 64.f, - text_size_adjust_double->GetLayoutObject()->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(64.f, text_size_adjust_double->GetLayoutObject() + ->StyleRef() + .ComputedFontSize()); } // https://crbug.com/646237 @@ -506,10 +508,10 @@ TEST_F(TextAutosizerTest, DISABLED_TextSizeAdjustWithoutNeedingAutosizing) { LayoutObject* text_size_adjust = GetDocument().getElementById("textSizeAdjust")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, text_size_adjust->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(24.f, text_size_adjust->Style()->ComputedFontSize()); - EXPECT_FLOAT_EQ(1.5f, - text_size_adjust->Style()->GetTextSizeAdjust().Multiplier()); + EXPECT_FLOAT_EQ(16.f, text_size_adjust->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(24.f, text_size_adjust->StyleRef().ComputedFontSize()); + EXPECT_FLOAT_EQ( + 1.5f, text_size_adjust->StyleRef().GetTextSizeAdjust().Multiplier()); } TEST_F(TextAutosizerTest, DeviceScaleAdjustmentWithViewport) { @@ -536,23 +538,23 @@ TEST_F(TextAutosizerTest, DeviceScaleAdjustmentWithViewport) { Element* autosized = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. // The device scale adjustment of 1.5 is ignored. EXPECT_FLOAT_EQ(40.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); GetDocument().GetSettings()->SetViewportMetaEnabled(false); GetDocument().View()->UpdateAllLifecyclePhases(); autosized = GetDocument().getElementById("autosized"); EXPECT_FLOAT_EQ(16.f, - autosized->GetLayoutObject()->Style()->SpecifiedFontSize()); + autosized->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // (device scale adjustment = 1.5) * (specified font-size = 16px) * // (viewport width = 800px) / (window width = 320px) = 60px. EXPECT_FLOAT_EQ(60.f, - autosized->GetLayoutObject()->Style()->ComputedFontSize()); + autosized->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ChangingSuperClusterFirstText) { @@ -590,14 +592,14 @@ TEST_F(TextAutosizerTest, ChangingSuperClusterFirstText) { LayoutObject* long_text = GetDocument().getElementById("longText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, long_text->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, long_text->StyleRef().SpecifiedFontSize()); //(specified font-size = 16px) * (block width = 560px) / // (window width = 320px) = 28px. - EXPECT_FLOAT_EQ(28.f, long_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(28.f, long_text->StyleRef().ComputedFontSize()); LayoutObject* short_text = GetDocument().getElementById("shortText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, short_text->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(28.f, short_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, short_text->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(28.f, short_text->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ChangingSuperClusterSecondText) { @@ -635,14 +637,14 @@ TEST_F(TextAutosizerTest, ChangingSuperClusterSecondText) { LayoutObject* long_text = GetDocument().getElementById("longText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, long_text->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, long_text->StyleRef().SpecifiedFontSize()); //(specified font-size = 16px) * (block width = 560px) / // (window width = 320px) = 28px. - EXPECT_FLOAT_EQ(28.f, long_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(28.f, long_text->StyleRef().ComputedFontSize()); LayoutObject* short_text = GetDocument().getElementById("shortText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, short_text->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(28.f, short_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, short_text->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(28.f, short_text->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, AddingSuperCluster) { @@ -682,14 +684,14 @@ TEST_F(TextAutosizerTest, AddingSuperCluster) { LayoutObject* long_text = GetDocument().getElementById("longText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, long_text->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, long_text->StyleRef().SpecifiedFontSize()); //(specified font-size = 16px) * (block width = 560px) / // (window width = 320px) = 28px. - EXPECT_FLOAT_EQ(28.f, long_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(28.f, long_text->StyleRef().ComputedFontSize()); LayoutObject* short_text = GetDocument().getElementById("shortText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, short_text->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(28.f, short_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, short_text->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(28.f, short_text->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ChangingInheritedClusterTextInsideSuperCluster) { @@ -728,14 +730,14 @@ TEST_F(TextAutosizerTest, ChangingInheritedClusterTextInsideSuperCluster) { LayoutObject* long_text = GetDocument().getElementById("longText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, long_text->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ(16.f, long_text->StyleRef().SpecifiedFontSize()); //(specified font-size = 16px) * (block width = 560px) / // (window width = 320px) = 28px. - EXPECT_FLOAT_EQ(28.f, long_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(28.f, long_text->StyleRef().ComputedFontSize()); LayoutObject* short_text = GetDocument().getElementById("shortText")->GetLayoutObject(); - EXPECT_FLOAT_EQ(16.f, short_text->Style()->SpecifiedFontSize()); - EXPECT_FLOAT_EQ(28.f, short_text->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, short_text->StyleRef().SpecifiedFontSize()); + EXPECT_FLOAT_EQ(28.f, short_text->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, AutosizeInnerContentOfRuby) { @@ -777,20 +779,20 @@ TEST_F(TextAutosizerTest, AutosizeInnerContentOfRuby) { GetDocument().View()->UpdateAllLifecyclePhases(); Element* ruby_inline = GetDocument().getElementById("rubyInline"); - EXPECT_FLOAT_EQ(16.f, - ruby_inline->GetLayoutObject()->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ( + 16.f, ruby_inline->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. - EXPECT_FLOAT_EQ(40.f, - ruby_inline->GetLayoutObject()->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ( + 40.f, ruby_inline->GetLayoutObject()->StyleRef().ComputedFontSize()); Element* ruby_block = GetDocument().getElementById("rubyBlock"); - EXPECT_FLOAT_EQ(16.f, - ruby_block->GetLayoutObject()->Style()->SpecifiedFontSize()); + EXPECT_FLOAT_EQ( + 16.f, ruby_block->GetLayoutObject()->StyleRef().SpecifiedFontSize()); // (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. EXPECT_FLOAT_EQ(40.f, - ruby_block->GetLayoutObject()->Style()->ComputedFontSize()); + ruby_block->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ResizeAndGlyphOverflowChanged) { @@ -868,7 +870,7 @@ TEST_F(TextAutosizerTest, narrowContentInsideNestedWideBlock) { //(content width = 200px) / (window width = 320px) < 1.0f, multiplier = 1.0, // font-size = 16px; EXPECT_FLOAT_EQ(16.f, - content->GetLayoutObject()->Style()->ComputedFontSize()); + content->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, LayoutViewWidthProvider) { @@ -900,7 +902,7 @@ TEST_F(TextAutosizerTest, LayoutViewWidthProvider) { // (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. EXPECT_FLOAT_EQ(40.f, - content->GetLayoutObject()->Style()->ComputedFontSize()); + content->GetLayoutObject()->StyleRef().ComputedFontSize()); GetDocument().getElementById("panel")->SetInnerHTMLFromString("insert text"); content->SetInnerHTMLFromString(content->InnerHTMLAsString()); @@ -909,7 +911,7 @@ TEST_F(TextAutosizerTest, LayoutViewWidthProvider) { // (specified font-size = 16px) * (viewport width = 800px) / // (window width = 320px) = 40px. EXPECT_FLOAT_EQ(40.f, - content->GetLayoutObject()->Style()->ComputedFontSize()); + content->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, MultiColumns) { @@ -942,7 +944,8 @@ TEST_F(TextAutosizerTest, MultiColumns) { Element* target = GetDocument().getElementById("target"); // (specified font-size = 16px) * ( thread flow layout width = 800px / 3) / // (window width = 320px) < 16px. - EXPECT_FLOAT_EQ(16.f, target->GetLayoutObject()->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(16.f, + target->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ScaledbyDSF) { @@ -970,7 +973,7 @@ TEST_F(TextAutosizerTest, ScaledbyDSF) { // (specified font-size = 16px) * (thread flow layout width = 800px) / // (window width = 320px) * (device scale factor) = 40px * device_scale. EXPECT_FLOAT_EQ(40.0f * device_scale, - target->GetLayoutObject()->Style()->ComputedFontSize()); + target->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, ClusterHasNotEnoughTextToAutosizeForZoomDSF) { @@ -992,7 +995,8 @@ TEST_F(TextAutosizerTest, ClusterHasNotEnoughTextToAutosizeForZoomDSF) { // minimum_text_length_to_autosize < length. Thus, ClusterMultiplier() // returns 1 (not multiplied by the accessibility font scale factor). // computed font-size = specified font-size = 8px. - EXPECT_FLOAT_EQ(8.0f, target->GetLayoutObject()->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(8.0f, + target->GetLayoutObject()->StyleRef().ComputedFontSize()); } // TODO(jaebaek): Unit tests ClusterHasNotEnoughTextToAutosizeForZoomDSF and @@ -1029,7 +1033,7 @@ TEST_F(TextAutosizerTest, ClusterHasEnoughTextToAutosizeForZoomDSF) { // ClusterHasEnoughTextToAutosize() returns true and both accessibility font // scale factor and device scale factor are multiplied. EXPECT_FLOAT_EQ(20.0f * device_scale, - target->GetLayoutObject()->Style()->ComputedFontSize()); + target->GetLayoutObject()->StyleRef().ComputedFontSize()); } TEST_F(TextAutosizerTest, AfterPrint) { @@ -1051,11 +1055,12 @@ TEST_F(TextAutosizerTest, AfterPrint) { )HTML"); Element* target = GetDocument().getElementById("target"); EXPECT_FLOAT_EQ(20.0f * device_scale, - target->GetLayoutObject()->Style()->ComputedFontSize()); + target->GetLayoutObject()->StyleRef().ComputedFontSize()); GetDocument().GetFrame()->StartPrinting(print_size, print_size, 1.0); - EXPECT_FLOAT_EQ(8.0f, target->GetLayoutObject()->Style()->ComputedFontSize()); + EXPECT_FLOAT_EQ(8.0f, + target->GetLayoutObject()->StyleRef().ComputedFontSize()); GetDocument().GetFrame()->EndPrinting(); EXPECT_FLOAT_EQ(20.0f * device_scale, - target->GetLayoutObject()->Style()->ComputedFontSize()); + target->GetLayoutObject()->StyleRef().ComputedFontSize()); } } // namespace blink |