Changeset 245966 in webkit


Ignore:
Timestamp:
May 31, 2019 9:37:13 AM (5 years ago)
Author:
jh718.park@samsung.com
Message:

Always min-width should win over max-width.
https://bugs.webkit.org/show_bug.cgi?id=198032

Reviewed by Darin Adler.

In the spec, https://www.w3.org/TR/CSS21/visudet.html#min-max-widths,
the following algorithm describes how the two properties influence
the used value of the 'width' property.

  1. The tentative used width is calculated (without 'min-width' and 'max-width')

following the rules under "Calculating widths and margins" above.

  1. If the tentative used width is greater than 'max-width',

the rules above are applied again, but this time using the computed value of 'max-width'
as the computed value for 'width'.

  1. If the resulting width is smaller than 'min-width', the rules above are applied again,

but this time using the value of 'min-width' as the computed value for 'width'.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-sizing/min-width-max-width-precedence-expected.txt: Added.
  • web-platform-tests/css/css-sizing/min-width-max-width-precedence.html: Added.

Source/WebCore:

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computePreferredLogicalWidths):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r245877 r245966  
     12019-05-31  Joonghun Park  <jh718.park@samsung.com>
     2
     3        Always min-width should win over max-width.
     4        https://bugs.webkit.org/show_bug.cgi?id=198032
     5
     6        Reviewed by Darin Adler.
     7
     8        In the spec, https://www.w3.org/TR/CSS21/visudet.html#min-max-widths,
     9        the following algorithm describes how the two properties influence
     10        the used value of the 'width' property.
     11
     12        1. The tentative used width is calculated (without 'min-width' and 'max-width')
     13        following the rules under "Calculating widths and margins" above.
     14        2. If the tentative used width is greater than 'max-width',
     15        the rules above are applied again, but this time using the computed value of 'max-width'
     16        as the computed value for 'width'.
     17        3. If the resulting width is smaller than 'min-width', the rules above are applied again,
     18        but this time using the value of 'min-width' as the computed value for 'width'.
     19
     20        * web-platform-tests/css/css-sizing/min-width-max-width-precedence-expected.txt: Added.
     21        * web-platform-tests/css/css-sizing/min-width-max-width-precedence.html: Added.
     22
    1232019-05-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
    224
  • trunk/Source/WebCore/ChangeLog

    r245964 r245966  
     12019-05-31  Joonghun Park  <jh718.park@samsung.com>
     2
     3        Always min-width should win over max-width.
     4        https://bugs.webkit.org/show_bug.cgi?id=198032
     5
     6        Reviewed by Darin Adler.
     7
     8        In the spec, https://www.w3.org/TR/CSS21/visudet.html#min-max-widths,
     9        the following algorithm describes how the two properties influence
     10        the used value of the 'width' property.
     11
     12        1. The tentative used width is calculated (without 'min-width' and 'max-width')
     13        following the rules under "Calculating widths and margins" above.
     14        2. If the tentative used width is greater than 'max-width',
     15        the rules above are applied again, but this time using the computed value of 'max-width'
     16        as the computed value for 'width'.
     17        3. If the resulting width is smaller than 'min-width', the rules above are applied again,
     18        but this time using the value of 'min-width' as the computed value for 'width'.
     19
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::computePreferredLogicalWidths):
     22
    1232019-05-31  Ryan Haddad  <ryanhaddad@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r245543 r245966  
    22632263    else
    22642264        computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
     2265
     2266    if (styleToUse.logicalMaxWidth().isFixed()) {
     2267        m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
     2268        m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
     2269    }
    22652270   
    22662271    if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().value() > 0) {
    22672272        m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
    22682273        m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
    2269     }
    2270    
    2271     if (styleToUse.logicalMaxWidth().isFixed()) {
    2272         m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
    2273         m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
    22742274    }
    22752275   
Note: See TracChangeset for help on using the changeset viewer.