Changeset 245768 in webkit


Ignore:
Timestamp:
May 24, 2019 6:42:17 PM (5 years ago)
Author:
jh718.park@samsung.com
Message:

Make computed width of non-replaced inline return computed style.
https://bugs.webkit.org/show_bug.cgi?id=197814

Reviewed by Antti Koivisto.

Currently, Computed width of non-replaced inline incorrectly returns "auto"
instead of the computed value.
This patch changes the behavior according to
https://drafts.csswg.org/cssom/#resolved-value as below.

'If the property applies to the element or pseudo-element
and the resolved value of the display property is not none or contents,
then the resolved value is the used value.
Otherwise the resolved value is the computed value.'

LayoutTests/imported/w3c:

  • web-platform-tests/html/semantics/embedded-content/the-object-element/object-attributes-expected.txt:

Source/WebCore:

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::valueForPropertyinStyle):

LayoutTests:

  • fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt:
  • fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt:
  • fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html:
  • legacy-animation-engine/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt:
  • legacy-animation-engine/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245759 r245768  
     12019-05-24  Joonghun Park  <jh718.park@samsung.com>
     2
     3        Make computed width of non-replaced inline return computed style.
     4        https://bugs.webkit.org/show_bug.cgi?id=197814
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Currently, Computed width of non-replaced inline incorrectly returns "auto"
     9        instead of the computed value.
     10        This patch changes the behavior according to
     11        https://drafts.csswg.org/cssom/#resolved-value as below.
     12
     13        'If the property applies to the element or pseudo-element
     14        and the resolved value of the display property is not none or contents,
     15        then the resolved value is the used value.
     16        Otherwise the resolved value is the computed value.'
     17
     18        * fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt:
     19        * fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt:
     20        * fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html:
     21        * legacy-animation-engine/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt:
     22        * legacy-animation-engine/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html:
     23
    1242019-05-24  Myles C. Maxfield  <mmaxfield@apple.com>
    225
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt

    r155253 r245768  
    1717Resolved values for element "fixed" with display "inline":
    1818line-height: 30px
    19 width: auto
    20 height: auto
     19width: 150px
     20height: 100px
    2121margin-top: 15px
    2222margin-right: 30px
     
    7070Resolved values for element "percents" with display "inline":
    7171line-height: 36px
    72 width: auto
    73 height: auto
     72width: 50%
     73height: 25%
    7474margin-top: 10%
    7575margin-right: 5%
     
    123123Resolved values for element "ems" with display "inline":
    124124line-height: 24px
    125 width: auto
     125width: 240px
     126height: 120px
     127margin-top: 24px
     128margin-right: 12px
     129margin-bottom: 36px
     130margin-left: 48px
     131padding-top: 18px
     132padding-right: 18px
     133padding-bottom: 18px
     134padding-left: 18px
     135
     136Resolved values for element "ems" with display "inline-block":
     137line-height: 24px
     138width: 240px
     139height: 120px
     140margin-top: 24px
     141margin-right: 12px
     142margin-bottom: 36px
     143margin-left: 48px
     144padding-top: 18px
     145padding-right: 18px
     146padding-bottom: 18px
     147padding-left: 18px
     148
     149Resolved values for element "ems" with display "none":
     150line-height: 24px
     151width: 240px
     152height: 120px
     153margin-top: 24px
     154margin-right: 12px
     155margin-bottom: 36px
     156margin-left: 48px
     157padding-top: 18px
     158padding-right: 18px
     159padding-bottom: 18px
     160padding-left: 18px
     161
     162
     163Resolved values for element "auto" with display "block":
     164line-height: 30px
     165width: 200px
     166height: 30px
     167margin-top: 0px
     168margin-right: 126px
     169margin-bottom: 0px
     170margin-left: 126px
     171padding-top: 0px
     172padding-right: 0px
     173padding-bottom: 0px
     174padding-left: 0px
     175
     176Resolved values for element "auto" with display "inline":
     177line-height: 30px
     178width: 200px
    126179height: auto
    127 margin-top: 24px
    128 margin-right: 12px
    129 margin-bottom: 36px
    130 margin-left: 48px
    131 padding-top: 18px
    132 padding-right: 18px
    133 padding-bottom: 18px
    134 padding-left: 18px
    135 
    136 Resolved values for element "ems" with display "inline-block":
    137 line-height: 24px
    138 width: 240px
    139 height: 120px
    140 margin-top: 24px
    141 margin-right: 12px
    142 margin-bottom: 36px
    143 margin-left: 48px
    144 padding-top: 18px
    145 padding-right: 18px
    146 padding-bottom: 18px
    147 padding-left: 18px
    148 
    149 Resolved values for element "ems" with display "none":
    150 line-height: 24px
    151 width: 240px
    152 height: 120px
    153 margin-top: 24px
    154 margin-right: 12px
    155 margin-bottom: 36px
    156 margin-left: 48px
    157 padding-top: 18px
    158 padding-right: 18px
    159 padding-bottom: 18px
    160 padding-left: 18px
    161 
    162 
    163 Resolved values for element "auto" with display "block":
     180margin-top: 0px
     181margin-right: auto
     182margin-bottom: 0px
     183margin-left: auto
     184padding-top: 0px
     185padding-right: 0px
     186padding-bottom: 0px
     187padding-left: 0px
     188
     189Resolved values for element "auto" with display "inline-block":
    164190line-height: 30px
    165191width: 200px
    166192height: 30px
    167193margin-top: 0px
    168 margin-right: 126px
    169 margin-bottom: 0px
    170 margin-left: 126px
    171 padding-top: 0px
    172 padding-right: 0px
    173 padding-bottom: 0px
    174 padding-left: 0px
    175 
    176 Resolved values for element "auto" with display "inline":
    177 line-height: 30px
    178 width: auto
     194margin-right: 0px
     195margin-bottom: 0px
     196margin-left: 0px
     197padding-top: 0px
     198padding-right: 0px
     199padding-bottom: 0px
     200padding-left: 0px
     201
     202Resolved values for element "auto" with display "none":
     203line-height: 30px
     204width: 200px
    179205height: auto
    180206margin-top: 0px
     
    187213padding-left: 0px
    188214
    189 Resolved values for element "auto" with display "inline-block":
    190 line-height: 30px
    191 width: 200px
    192 height: 30px
    193 margin-top: 0px
    194 margin-right: 0px
    195 margin-bottom: 0px
    196 margin-left: 0px
    197 padding-top: 0px
    198 padding-right: 0px
    199 padding-bottom: 0px
    200 padding-left: 0px
    201 
    202 Resolved values for element "auto" with display "none":
    203 line-height: 30px
    204 width: 200px
    205 height: auto
    206 margin-top: 0px
    207 margin-right: auto
    208 margin-bottom: 0px
    209 margin-left: auto
    210 padding-top: 0px
    211 padding-right: 0px
    212 padding-bottom: 0px
    213 padding-left: 0px
    214 
    215215
    216216Resolved values for element "mixed" with display "block":
     
    229229Resolved values for element "mixed" with display "inline":
    230230line-height: 48px
    231 width: auto
    232 height: auto
     231width: 30%
     232height: 20%
    233233margin-top: 72px
    234234margin-right: 0px
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt

    r221542 r245768  
    4444PASS Expected '5px solid rgb(255, 0, 0)' for border in the computed style for element with id testBeforeAfterTable and pseudo-element :before and got '5px solid rgb(255, 0, 0)'
    4545PASS Expected '10px dotted rgb(0, 0, 255)' for border in the computed style for element with id testBeforeAfterTable and pseudo-element :after and got '10px dotted rgb(0, 0, 255)'
    46 PASS Expected 'auto' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got 'auto'
    47 PASS Expected 'auto' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got 'auto'
    48 PASS Expected 'auto' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got 'auto'
    49 PASS Expected 'auto' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got 'auto'
     46PASS Expected '250px' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '250px'
     47PASS Expected '350px' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '350px'
     48PASS Expected '200px' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got '200px'
     49PASS Expected '300px' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got '300px'
    5050PASS Expected '10px 20px 30px 40px' for margin in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '10px 20px 30px 40px'
    5151PASS Expected '0px' for padding in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '0px'
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html

    r221542 r245768  
    161161        { 'elementId' : 'testBeforeAfterTable', 'pseudoElement' : ':before', 'property' : 'border', 'expectedValue' : '5px solid rgb(255, 0, 0)' },
    162162        { 'elementId' : 'testBeforeAfterTable', 'pseudoElement' : ':after', 'property' : 'border', 'expectedValue' : '10px dotted rgb(0, 0, 255)' },
    163         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'height', 'expectedValue' : 'auto' },
    164         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'width', 'expectedValue' : 'auto' },
    165         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'height', 'expectedValue' : 'auto' },
    166         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'width', 'expectedValue' : 'auto' },
     163        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'height', 'expectedValue' : '250px' },
     164        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'width', 'expectedValue' : '350px' },
     165        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'height', 'expectedValue' : '200px' },
     166        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'width', 'expectedValue' : '300px' },
    167167        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'margin', 'expectedValue' : '10px 20px 30px 40px' },
    168168        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'padding', 'expectedValue' : '0px' },
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r245642 r245768  
     12019-05-24  Joonghun Park  <jh718.park@samsung.com>
     2
     3        Make computed width of non-replaced inline return computed style.
     4        https://bugs.webkit.org/show_bug.cgi?id=197814
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Currently, Computed width of non-replaced inline incorrectly returns "auto"
     9        instead of the computed value.
     10        This patch changes the behavior according to
     11        https://drafts.csswg.org/cssom/#resolved-value as below.
     12
     13        'If the property applies to the element or pseudo-element
     14        and the resolved value of the display property is not none or contents,
     15        then the resolved value is the used value.
     16        Otherwise the resolved value is the computed value.'
     17
     18        * web-platform-tests/html/semantics/embedded-content/the-object-element/object-attributes-expected.txt:
     19
    1202019-05-22  Ali Juma  <ajuma@chromium.org>
    221
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-object-element/object-attributes-expected.txt

    r243638 r245768  
    11
    22FAIL object.contentWindow assert_equals: The contentWindow's name of the object element should be 'o1'. expected "o1" but got "o"
    3 FAIL object.width assert_equals: The width should be 100px. expected "100px" but got "auto"
    4 FAIL object.height assert_equals: The height should be 50px. expected "50px" but got "auto"
     3PASS object.width
     4PASS object.height
    55 
  • trunk/LayoutTests/legacy-animation-engine/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt

    r230471 r245768  
    4444PASS Expected '5px solid rgb(255, 0, 0)' for border in the computed style for element with id testBeforeAfterTable and pseudo-element :before and got '5px solid rgb(255, 0, 0)'
    4545PASS Expected '10px dotted rgb(0, 0, 255)' for border in the computed style for element with id testBeforeAfterTable and pseudo-element :after and got '10px dotted rgb(0, 0, 255)'
    46 PASS Expected 'auto' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got 'auto'
    47 PASS Expected 'auto' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got 'auto'
    48 PASS Expected 'auto' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got 'auto'
    49 PASS Expected 'auto' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got 'auto'
     46PASS Expected '250px' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '250px'
     47PASS Expected '350px' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '350px'
     48PASS Expected '200px' for height in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got '200px'
     49PASS Expected '300px' for width in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got '300px'
    5050PASS Expected '10px 20px 30px 40px' for margin in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '10px 20px 30px 40px'
    5151PASS Expected '0px' for padding in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '0px'
  • trunk/LayoutTests/legacy-animation-engine/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html

    r235960 r245768  
    161161        { 'elementId' : 'testBeforeAfterTable', 'pseudoElement' : ':before', 'property' : 'border', 'expectedValue' : '5px solid rgb(255, 0, 0)' },
    162162        { 'elementId' : 'testBeforeAfterTable', 'pseudoElement' : ':after', 'property' : 'border', 'expectedValue' : '10px dotted rgb(0, 0, 255)' },
    163         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'height', 'expectedValue' : 'auto' },
    164         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'width', 'expectedValue' : 'auto' },
    165         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'height', 'expectedValue' : 'auto' },
    166         { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'width', 'expectedValue' : 'auto' },
     163        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'height', 'expectedValue' : '250px' },
     164        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'width', 'expectedValue' : '350px' },
     165        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'height', 'expectedValue' : '200px' },
     166        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'width', 'expectedValue' : '300px' },
    167167        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'margin', 'expectedValue' : '10px 20px 30px 40px' },
    168168        { 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'padding', 'expectedValue' : '0px' },
  • trunk/Source/WebCore/ChangeLog

    r245759 r245768  
     12019-05-24  Joonghun Park  <jh718.park@samsung.com>
     2
     3        Make computed width of non-replaced inline return computed style.
     4        https://bugs.webkit.org/show_bug.cgi?id=197814
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Currently, Computed width of non-replaced inline incorrectly returns "auto"
     9        instead of the computed value.
     10        This patch changes the behavior according to
     11        https://drafts.csswg.org/cssom/#resolved-value as below.
     12
     13        'If the property applies to the element or pseudo-element
     14        and the resolved value of the display property is not none or contents,
     15        then the resolved value is the used value.
     16        Otherwise the resolved value is the computed value.'
     17
     18        * css/CSSComputedStyleDeclaration.cpp:
     19        (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
     20
    1212019-05-24  Myles C. Maxfield  <mmaxfield@apple.com>
    222
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r244906 r245768  
    31913191                // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property,
    31923192                // the "height" property does not apply for non-replaced inline elements.
    3193                 if (isNonReplacedInline(*renderer))
    3194                     return cssValuePool.createIdentifierValue(CSSValueAuto);
    3195                 return zoomAdjustedPixelValue(sizingBox(*renderer).height(), style);
     3193                if (!isNonReplacedInline(*renderer))
     3194                    return zoomAdjustedPixelValue(sizingBox(*renderer).height(), style);
    31963195            }
    31973196            return zoomAdjustedPixelValueForLength(style.height(), style);
     
    35143513                // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
    35153514                // the "width" property does not apply for non-replaced inline elements.
    3516                 if (isNonReplacedInline(*renderer))
    3517                     return cssValuePool.createIdentifierValue(CSSValueAuto);
    3518                 return zoomAdjustedPixelValue(sizingBox(*renderer).width(), style);
     3515                if (!isNonReplacedInline(*renderer))
     3516                    return zoomAdjustedPixelValue(sizingBox(*renderer).width(), style);
    35193517            }
    35203518            return zoomAdjustedPixelValueForLength(style.width(), style);
Note: See TracChangeset for help on using the changeset viewer.