⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176490 in webkit


Ignore:
Timestamp:
Nov 21, 2014, 5:22:41 PM (12 years ago)
Author:
Chris Dumez
Message:

[iOS] Regression(r176202): line-height is wrong on marco.org
https://bugs.webkit.org/show_bug.cgi?id=138970

Reviewed by Simon Fraser.

Source/WebCore:

After r176202, on iOS with IOS_TEXT_AUTOSIZING enabled, we would
multiply the lineHeight by RenderStyle::textSizeAdjust()::multiplier()
unconditionally. However, we're only supposed to do so if
RenderStyle::textSizeAdjust()::isPercentage() returns true. This
patch reintroduces the textSizeAdjust().isPercentage() check that was
inadvertently dropped when refactoring the code to be shared between
iOS and OS X.

Additionally, the multiplier is only supposed the be applied if the
input CSSPrimitiveValue is a Length or a Number. However, after
r176202, we would apply the multiplier if the CSSPrimitiveValue is
a Percentage or a Number. This patch updates the code to match the
behavior prior to r176202.

Test: fast/css/line-height-text-autosizing.html

  • css/StyleBuilderCustom.h:

(WebCore::StyleBuilderFunctions::convertLineHeight):
(WebCore::StyleBuilderFunctions::applyValueLineHeight):

LayoutTests:

Add layout test to cover line-height CSS property and its interaction
with -webkit-text-size-adjust.

  • fast/css/line-height-text-autosizing-expected.txt: Added.
  • fast/css/line-height-text-autosizing.html: Added.
  • platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r176481 r176490  
     12014-11-21  Chris Dumez  <cdumez@apple.com>
     2
     3        [iOS] Regression(r176202): line-height is wrong on marco.org
     4        https://bugs.webkit.org/show_bug.cgi?id=138970
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add layout test to cover line-height CSS property and its interaction
     9        with -webkit-text-size-adjust.
     10
     11        * fast/css/line-height-text-autosizing-expected.txt: Added.
     12        * fast/css/line-height-text-autosizing.html: Added.
     13        * platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt: Added.
     14
    1152014-11-21  Chris Fleizach  <cfleizach@apple.com>
    216
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r176433 r176490  
    152152userscripts
    153153webarchive
     154
     155###
     156# Mark as passing specific tests in folders that were skipped temporarily above.
     157##
     158webkit.org/b/138970 fast/css/line-height-text-autosizing.html [ Pass ]
  • trunk/Source/WebCore/ChangeLog

    r176484 r176490  
     12014-11-21  Chris Dumez  <cdumez@apple.com>
     2
     3        [iOS] Regression(r176202): line-height is wrong on marco.org
     4        https://bugs.webkit.org/show_bug.cgi?id=138970
     5
     6        Reviewed by Simon Fraser.
     7
     8        After r176202, on iOS with IOS_TEXT_AUTOSIZING enabled, we would
     9        multiply the lineHeight by RenderStyle::textSizeAdjust()::multiplier()
     10        unconditionally. However, we're only supposed to do so if
     11        RenderStyle::textSizeAdjust()::isPercentage() returns true. This
     12        patch reintroduces the textSizeAdjust().isPercentage() check that was
     13        inadvertently dropped when refactoring the code to be shared between
     14        iOS and OS X.
     15
     16        Additionally, the multiplier is only supposed the be applied if the
     17        input CSSPrimitiveValue is a Length or a Number. However, after
     18        r176202, we would apply the multiplier if the CSSPrimitiveValue is
     19        a Percentage or a Number. This patch updates the code to match the
     20        behavior prior to r176202.
     21
     22        Test: fast/css/line-height-text-autosizing.html
     23
     24        * css/StyleBuilderCustom.h:
     25        (WebCore::StyleBuilderFunctions::convertLineHeight):
     26        (WebCore::StyleBuilderFunctions::applyValueLineHeight):
     27
    1282014-11-21  Chris Fleizach  <cfleizach@apple.com>
    229
  • trunk/Source/WebCore/css/StyleBuilderCustom.h

    r176383 r176490  
    522522    if (primitiveValue.isLength()) {
    523523        length = primitiveValue.computeLength<Length>(csstoLengthConversionDataWithTextZoomFactor(styleResolver));
     524        if (multiplier != 1.f)
     525            length = Length(length.value() * multiplier, Fixed);
    524526        return true;
    525527    }
    526528    if (primitiveValue.isPercentage()) {
    527529        // FIXME: percentage should not be restricted to an integer here.
    528         length = Length((styleResolver.style()->computedFontSize() * primitiveValue.getIntValue()) * multiplier / 100, Fixed);
     530        length = Length((styleResolver.style()->computedFontSize() * primitiveValue.getIntValue()) / 100, Fixed);
    529531        return true;
    530532    }
     
    572574{
    573575    Length lineHeight;
    574     if (!convertLineHeight(styleResolver, value, lineHeight, styleResolver.style()->textSizeAdjust().multiplier()))
     576    float multiplier = styleResolver.style()->textSizeAdjust().isPercentage() ? styleResolver.style()->textSizeAdjust().multiplier() : 1.f;
     577    if (!convertLineHeight(styleResolver, value, lineHeight, multiplier))
    575578        return;
    576579
Note: See TracChangeset for help on using the changeset viewer.