Changeset 276216 in webkit


Ignore:
Timestamp:
Apr 17, 2021 6:03:18 PM (15 months ago)
Author:
commit-queue@webkit.org
Message:

Add support for inline-{start/end} values to float & clear properties
https://bugs.webkit.org/show_bug.cgi?id=218087

Patch by Tim Nguyen <ntim@apple.com> on 2021-04-17
Reviewed by Antti Koivisto & Zalan Bujtas.

Imported reftests from: https://github.com/web-platform-tests/wpt/commit/47e7176242e2ca4ca68d6cfe032619ccf44d55a6
Enabled: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear.html

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-box/parsing/clear-computed-expected.txt:
  • web-platform-tests/css/css-box/parsing/clear-valid-expected.txt:
  • web-platform-tests/css/css-box/parsing/float-computed-expected.txt:
  • web-platform-tests/css/css-box/parsing/float-valid-expected.txt:
  • web-platform-tests/css/css-logical/logical-values-float-clear-1-expected.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-1.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-2-expected.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-2.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-3-expected.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-3.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-4-expected.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-4.html: Added.
  • web-platform-tests/css/css-logical/logical-values-float-clear-expected.txt:
  • web-platform-tests/css/css-logical/w3c-import.log:

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-1.html

imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-2.html
imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-3.html
imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-4.html

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Clear const):
(WebCore::CSSPrimitiveValue::operator Float const):

  • css/CSSValueKeywords.in:
  • css/parser/CSSParserFastPaths.cpp:

(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):

  • display/css/DisplayStyle.cpp:

(WebCore::Display::Style::Style):

  • layout/integration/LayoutIntegrationBoxTree.cpp:

(WebCore::LayoutIntegration::BoxTree::buildTree):

  • layout/layouttree/LayoutBox.cpp:

(WebCore::Layout::Box::isFloatingPositioned const):

  • layout/layouttree/LayoutTreeBuilder.cpp:

(WebCore::Layout::TreeBuilder::createLayoutBox):
(WebCore::Layout::TreeBuilder::buildTableStructure):

  • rendering/ComplexLineLayout.cpp:

(WebCore::ComplexLineLayout::layoutRunsAndFloats):
(WebCore::ComplexLineLayout::layoutRunsAndFloatsInRange):

  • rendering/FloatingObjects.cpp:

(WebCore::FloatingObject::FloatingObject):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock):
(WebCore::RenderBlockFlow::marginBeforeEstimateForChild const):
(WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
(WebCore::RenderBlockFlow::positionNewFloats):
(WebCore::RenderBlockFlow::clearFloats):
(WebCore::RenderBlockFlow::getClearDelta):
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):

  • rendering/RenderBlockFlow.h:
  • rendering/line/BreakingContext.h:

(WebCore::BreakingContext::handleBR):

  • rendering/line/LineBreaker.cpp:

(WebCore::LineBreaker::reset):

  • rendering/line/LineBreaker.h:

(WebCore::LineBreaker::usedClear):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::usedClear):
(WebCore::RenderStyle::usedFloat):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::isFloating const):
(WebCore::RenderStyle::initialFloating):

  • rendering/style/RenderStyleConstants.cpp:

(WebCore::operator<<):

  • rendering/style/RenderStyleConstants.h:
  • style/StyleAdjuster.cpp:

(WebCore::Style::Adjuster::adjust const):

LayoutTests:

Location:
trunk
Files:
8 added
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276215 r276216  
     12021-04-17  Tim Nguyen  <ntim@apple.com>
     2
     3        Add support for inline-{start/end} values to float & clear properties
     4        https://bugs.webkit.org/show_bug.cgi?id=218087
     5
     6        Reviewed by Antti Koivisto & Zalan Bujtas.
     7
     8        Imported reftests from: https://github.com/web-platform-tests/wpt/commit/47e7176242e2ca4ca68d6cfe032619ccf44d55a6
     9        Enabled: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear.html
     10
     11        * TestExpectations:
     12
    1132021-04-17  Diego Pino Garcia  <dpino@igalia.com>
    214
  • trunk/LayoutTests/TestExpectations

    r276208 r276216  
    29352935imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.https.any.html [ Pass Failure ]
    29362936imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.https.any.worker.html [ Pass Failure ]
     2937
     2938webkit.org/b/224104 imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-reftest.html [ ImageOnlyFailure ]
    29372939
    29382940# wpt css-shapes
     
    45774579webkit.org/b/214466 imported/w3c/web-platform-tests/css/css-values/ex-unit-004.html [ ImageOnlyFailure ]
    45784580webkit.org/b/214466 imported/w3c/web-platform-tests/css/css-shapes/shape-outside/formatting-context/shape-outside-formatting-context.tentative.html [ ImageOnlyFailure ]
    4579 webkit.org/b/214466 imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-reftest.html [ ImageOnlyFailure ]
    45804581webkit.org/b/214466 imported/w3c/web-platform-tests/css/css-display/display-first-line-002.html [ ImageOnlyFailure ]
    45814582
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r276209 r276216  
     12021-04-17  Tim Nguyen  <ntim@apple.com>
     2
     3        Add support for inline-{start/end} values to float & clear properties
     4        https://bugs.webkit.org/show_bug.cgi?id=218087
     5
     6        Reviewed by Antti Koivisto & Zalan Bujtas.
     7
     8        Imported reftests from: https://github.com/web-platform-tests/wpt/commit/47e7176242e2ca4ca68d6cfe032619ccf44d55a6
     9        Enabled: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear.html
     10
     11        * web-platform-tests/css/css-box/parsing/clear-computed-expected.txt:
     12        * web-platform-tests/css/css-box/parsing/clear-valid-expected.txt:
     13        * web-platform-tests/css/css-box/parsing/float-computed-expected.txt:
     14        * web-platform-tests/css/css-box/parsing/float-valid-expected.txt:
     15        * web-platform-tests/css/css-logical/logical-values-float-clear-1-expected.html: Added.
     16        * web-platform-tests/css/css-logical/logical-values-float-clear-1.html: Added.
     17        * web-platform-tests/css/css-logical/logical-values-float-clear-2-expected.html: Added.
     18        * web-platform-tests/css/css-logical/logical-values-float-clear-2.html: Added.
     19        * web-platform-tests/css/css-logical/logical-values-float-clear-3-expected.html: Added.
     20        * web-platform-tests/css/css-logical/logical-values-float-clear-3.html: Added.
     21        * web-platform-tests/css/css-logical/logical-values-float-clear-4-expected.html: Added.
     22        * web-platform-tests/css/css-logical/logical-values-float-clear-4.html: Added.
     23        * web-platform-tests/css/css-logical/logical-values-float-clear-expected.txt:
     24        * web-platform-tests/css/css-logical/w3c-import.log:
     25
    1262021-04-17  Tyler Wilcock  <twilco.o@protonmail.com>
    227
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/parsing/clear-computed-expected.txt

    r267650 r276216  
    44PASS Property clear value 'right'
    55PASS Property clear value 'both'
    6 FAIL Property clear value 'inline-start' assert_true: 'inline-start' is a supported value for clear. expected true got false
    7 FAIL Property clear value 'inline-end' assert_true: 'inline-end' is a supported value for clear. expected true got false
     6PASS Property clear value 'inline-start'
     7PASS Property clear value 'inline-end'
    88
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/parsing/clear-valid-expected.txt

    r267650 r276216  
    44PASS e.style['clear'] = "right" should set the property value
    55PASS e.style['clear'] = "both" should set the property value
    6 FAIL e.style['clear'] = "inline-start" should set the property value assert_not_equals: property should be set got disallowed value ""
    7 FAIL e.style['clear'] = "inline-end" should set the property value assert_not_equals: property should be set got disallowed value ""
     6PASS e.style['clear'] = "inline-start" should set the property value
     7PASS e.style['clear'] = "inline-end" should set the property value
    88
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/parsing/float-computed-expected.txt

    r267650 r276216  
    33PASS Property float value 'left'
    44PASS Property float value 'right'
    5 FAIL Property float value 'inline-start' assert_true: 'inline-start' is a supported value for float. expected true got false
    6 FAIL Property float value 'inline-end' assert_true: 'inline-end' is a supported value for float. expected true got false
     5PASS Property float value 'inline-start'
     6PASS Property float value 'inline-end'
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/parsing/float-valid-expected.txt

    r267650 r276216  
    33PASS e.style['float'] = "right" should set the property value
    44PASS e.style['float'] = "none" should set the property value
    5 FAIL e.style['float'] = "inline-start" should set the property value assert_not_equals: property should be set got disallowed value ""
    6 FAIL e.style['float'] = "inline-end" should set the property value assert_not_equals: property should be set got disallowed value ""
     5PASS e.style['float'] = "inline-start" should set the property value
     6PASS e.style['float'] = "inline-end" should set the property value
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-expected.txt

    r264522 r276216  
    11
    2 FAIL Test that 'clear: inline-start' is supported. assert_equals: logical values in inline style, clear expected "inline-start" but got ""
    3 FAIL Test that 'clear: inline-end' is supported. assert_equals: logical values in inline style, clear expected "inline-end" but got ""
    4 FAIL Test that 'float: inline-start' is supported. assert_equals: logical values in inline style, float expected "inline-start" but got ""
    5 FAIL Test that 'float: inline-end' is supported. assert_equals: logical values in inline style, float expected "inline-end" but got ""
     2PASS Test that 'clear: inline-start' is supported.
     3PASS Test that 'clear: inline-end' is supported.
     4PASS Test that 'float: inline-start' is supported.
     5PASS Test that 'float: inline-end' is supported.
    66
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/w3c-import.log

    r264522 r276216  
    3333/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-padding.html
    3434/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-box-size.html
     35/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-1-expected.html
     36/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-1.html
     37/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-2-expected.html
     38/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-2.html
     39/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-3-expected.html
     40/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-3.html
     41/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-4-expected.html
     42/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-4.html
    3543/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-reftest-expected.html
    3644/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-reftest.html
  • trunk/Source/WebCore/ChangeLog

    r276211 r276216  
     12021-04-17  Tim Nguyen  <ntim@apple.com>
     2
     3        Add support for inline-{start/end} values to float & clear properties
     4        https://bugs.webkit.org/show_bug.cgi?id=218087
     5
     6        Reviewed by Antti Koivisto & Zalan Bujtas.
     7
     8        Imported reftests from: https://github.com/web-platform-tests/wpt/commit/47e7176242e2ca4ca68d6cfe032619ccf44d55a6
     9        Enabled: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear.html
     10
     11        Tests: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-1.html
     12               imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-2.html
     13               imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-3.html
     14               imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-4.html
     15
     16        * css/CSSPrimitiveValueMappings.h:
     17        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     18        (WebCore::CSSPrimitiveValue::operator Clear const):
     19        (WebCore::CSSPrimitiveValue::operator Float const):
     20        * css/CSSValueKeywords.in:
     21        * css/parser/CSSParserFastPaths.cpp:
     22        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
     23        * display/css/DisplayStyle.cpp:
     24        (WebCore::Display::Style::Style):
     25        * layout/integration/LayoutIntegrationBoxTree.cpp:
     26        (WebCore::LayoutIntegration::BoxTree::buildTree):
     27        * layout/layouttree/LayoutBox.cpp:
     28        (WebCore::Layout::Box::isFloatingPositioned const):
     29        * layout/layouttree/LayoutTreeBuilder.cpp:
     30        (WebCore::Layout::TreeBuilder::createLayoutBox):
     31        (WebCore::Layout::TreeBuilder::buildTableStructure):
     32        * rendering/ComplexLineLayout.cpp:
     33        (WebCore::ComplexLineLayout::layoutRunsAndFloats):
     34        (WebCore::ComplexLineLayout::layoutRunsAndFloatsInRange):
     35        * rendering/FloatingObjects.cpp:
     36        (WebCore::FloatingObject::FloatingObject):
     37        * rendering/RenderBlock.cpp:
     38        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):
     39        * rendering/RenderBlockFlow.cpp:
     40        (WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock):
     41        (WebCore::RenderBlockFlow::marginBeforeEstimateForChild const):
     42        (WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
     43        (WebCore::RenderBlockFlow::positionNewFloats):
     44        (WebCore::RenderBlockFlow::clearFloats):
     45        (WebCore::RenderBlockFlow::getClearDelta):
     46        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
     47        * rendering/RenderBlockFlow.h:
     48        * rendering/line/BreakingContext.h:
     49        (WebCore::BreakingContext::handleBR):
     50        * rendering/line/LineBreaker.cpp:
     51        (WebCore::LineBreaker::reset):
     52        * rendering/line/LineBreaker.h:
     53        (WebCore::LineBreaker::usedClear):
     54        * rendering/style/RenderStyle.cpp:
     55        (WebCore::RenderStyle::usedClear):
     56        (WebCore::RenderStyle::usedFloat):
     57        * rendering/style/RenderStyle.h:
     58        (WebCore::RenderStyle::isFloating const):
     59        (WebCore::RenderStyle::initialFloating):
     60        * rendering/style/RenderStyleConstants.cpp:
     61        (WebCore::operator<<):
     62        * rendering/style/RenderStyleConstants.h:
     63        * style/StyleAdjuster.cpp:
     64        (WebCore::Style::Adjuster::adjust const):
     65
    1662021-04-17  Basuke Suzuki  <basuke.suzuki@sony.com>
    267
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r272987 r276216  
    11291129        m_value.valueID = CSSValueRight;
    11301130        break;
     1131    case Clear::InlineStart:
     1132        m_value.valueID = CSSValueInlineStart;
     1133        break;
     1134    case Clear::InlineEnd:
     1135        m_value.valueID = CSSValueInlineEnd;
     1136        break;
    11311137    case Clear::Both:
    11321138        m_value.valueID = CSSValueBoth;
     
    11461152    case CSSValueRight:
    11471153        return Clear::Right;
     1154    case CSSValueInlineStart:
     1155        return Clear::InlineStart;
     1156    case CSSValueInlineEnd:
     1157        return Clear::InlineEnd;
    11481158    case CSSValueBoth:
    11491159        return Clear::Both;
     
    15811591    setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID);
    15821592    switch (e) {
    1583     case Float::No:
     1593    case Float::None:
    15841594        m_value.valueID = CSSValueNone;
    15851595        break;
     
    15891599    case Float::Right:
    15901600        m_value.valueID = CSSValueRight;
     1601        break;
     1602    case Float::InlineStart:
     1603        m_value.valueID = CSSValueInlineStart;
     1604        break;
     1605    case Float::InlineEnd:
     1606        m_value.valueID = CSSValueInlineEnd;
    15911607        break;
    15921608    }
     
    16021618    case CSSValueRight:
    16031619        return Float::Right;
     1620    case CSSValueInlineStart:
     1621        return Float::InlineStart;
     1622    case CSSValueInlineEnd:
     1623        return Float::InlineEnd;
    16041624    case CSSValueNone:
    16051625    case CSSValueCenter: // Non-standard CSS value.
    1606         return Float::No;
    1607     default:
    1608         break;
    1609     }
    1610 
    1611     ASSERT_NOT_REACHED();
    1612     return Float::No;
     1626        return Float::None;
     1627    default:
     1628        break;
     1629    }
     1630
     1631    ASSERT_NOT_REACHED();
     1632    return Float::None;
    16131633}
    16141634
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r275826 r276216  
    349349distribute
    350350//
     351// CSS_PROP_CLEAR:
     352// CSS_PROP_FLOAT:
     353// none
     354// left
     355// right
     356inline-start
     357inline-end
     358//
    351359// CSS_PROP_LIST_STYLE_POSITION:
    352360//
  • trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp

    r276152 r276216  
    620620    case CSSPropertyCaptionSide: // top | bottom | left | right
    621621        return valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueTop || valueID == CSSValueBottom;
    622     case CSSPropertyClear: // none | left | right | both
    623         return valueID == CSSValueNone || valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueBoth;
     622    case CSSPropertyClear: // none | inline-start | inline-end | left | right | both
     623        return valueID == CSSValueNone || valueID == CSSValueInlineStart || valueID == CSSValueInlineEnd || valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueBoth;
    624624    case CSSPropertyClipRule:
    625625    case CSSPropertyFillRule:
     
    648648    case CSSPropertyEmptyCells: // show | hide
    649649        return valueID == CSSValueShow || valueID == CSSValueHide;
    650     case CSSPropertyFloat: // left | right | none
    651         return valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone;
     650    case CSSPropertyFloat: // inline-start | inline-end | left | right | none
     651        return valueID == CSSValueInlineStart || valueID == CSSValueInlineEnd || valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone;
    652652    case CSSPropertyImageOrientation: // from-image | none
    653653        return valueID == CSSValueFromImage || valueID == CSSValueNone;
  • trunk/Source/WebCore/display/css/DisplayStyle.cpp

    r271921 r276216  
    106106
    107107    setIsPositioned(style.position() != PositionType::Static);
    108     setIsFloating(style.floating() != Float::No);
     108    setIsFloating(style.floating() != Float::None);
    109109    setHasTransform(style.hasTransform());
    110110}
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp

    r272770 r276216  
    7373        if (childRenderer.isLineBreak()) {
    7474            style.setDisplay(DisplayType::Inline);
    75             style.setFloating(Float::No);
     75            style.setFloating(Float::None);
    7676            style.setPosition(PositionType::Static);
    7777            return makeUnique<Layout::LineBreakBox>(downcast<RenderLineBreak>(childRenderer).isWBR(), WTFMove(style));
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp

    r272781 r276216  
    164164    if (isOutOfFlowPositioned())
    165165        return false;
    166     return m_style.floating() != Float::No;
     166    return m_style.floating() != Float::None;
    167167}
    168168
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r273974 r276216  
    200200        if (is<RenderLineBreak>(renderer)) {
    201201            clonedStyle.setDisplay(DisplayType::Inline);
    202             clonedStyle.setFloating(Float::No);
     202            clonedStyle.setFloating(Float::None);
    203203            clonedStyle.setPosition(PositionType::Static);
    204204            childLayoutBox = &createLineBreakBox(downcast<RenderLineBreak>(childRenderer).isWBR(), WTFMove(clonedStyle));
     
    305305    auto tableBoxStyle = RenderStyle::clone(tableRenderer.style());
    306306    tableBoxStyle.setPosition(PositionType::Static);
    307     tableBoxStyle.setFloating(Float::No);
     307    tableBoxStyle.setFloating(Float::None);
    308308    tableBoxStyle.resetMargin();
    309309    // FIXME: Figure out where the spec says table width is like box-sizing: border-box;
  • trunk/Source/WebCore/rendering/ComplexLineLayout.cpp

    r275641 r276216  
    13601360                lastObject = &lastRootBox()->firstLeafDescendant()->renderer();
    13611361            if (lastObject->isBR()) {
    1362                 Clear clear = lastObject->style().clear();
    1363                 if (clear != Clear::None)
     1362                auto clear = RenderStyle::usedClear(*lastObject);
     1363                if (clear != UsedClear::None)
    13641364                    m_flow.clearFloats(clear);
    13651365            }
     
    15051505        if (!layoutState.lineInfo().isEmpty()) {
    15061506            layoutState.lineInfo().setFirstLine(false);
    1507             m_flow.clearFloats(lineBreaker.clear());
     1507            m_flow.clearFloats(lineBreaker.usedClear());
    15081508        }
    15091509
  • trunk/Source/WebCore/rendering/FloatingObjects.cpp

    r275668 r276216  
    5858#endif
    5959{
    60     Float type = renderer.style().floating();
    61     ASSERT(type != Float::No);
    62     if (type == Float::Left)
     60    UsedFloat type = RenderStyle::usedFloat(renderer);
     61    ASSERT(type != UsedFloat::None);
     62    if (type == UsedFloat::Left)
    6363        m_type = FloatLeft;
    64     else if (type == Float::Right)
     64    else if (type == UsedFloat::Right)
    6565        m_type = FloatRight;
    6666}
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r276182 r276216  
    23432343        if (child->isFloating() || (is<RenderBox>(*child) && downcast<RenderBox>(*child).avoidsFloats())) {
    23442344            LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth;
    2345             if (childStyle.clear() == Clear::Left || childStyle.clear() == Clear::Both) {
     2345            auto childUsedClear = RenderStyle::usedClear(*child);
     2346            if (childUsedClear == UsedClear::Left || childUsedClear == UsedClear::Both) {
    23462347                maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth);
    23472348                floatLeftWidth = 0;
    23482349            }
    2349             if (childStyle.clear() == Clear::Right || childStyle.clear() == Clear::Both) {
     2350            if (childUsedClear == UsedClear::Right || childUsedClear == UsedClear::Both) {
    23502351                maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth);
    23512352                floatRightWidth = 0;
     
    23722373        LayoutUnit w = childMinPreferredLogicalWidth + margin;
    23732374        minLogicalWidth = std::max(w, minLogicalWidth);
    2374        
     2375
    23752376        // IE ignores tables for calculation of nowrap. Makes some sense.
    23762377        if (nowrap && !child->isTable())
     
    23962397            floatLeftWidth = floatRightWidth = 0;
    23972398        }
    2398        
     2399
    23992400        if (child->isFloating()) {
    2400             if (childStyle.floating() == Float::Left)
     2401            if (RenderStyle::usedFloat(*child) == UsedFloat::Left)
    24012402                floatLeftWidth += w;
    24022403            else
     
    24042405        } else
    24052406            maxLogicalWidth = std::max(w, maxLogicalWidth);
    2406        
     2407
    24072408        child = child->nextSibling();
    24082409    }
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r276182 r276216  
    876876    ASSERT(isSelfCollapsingBlock());
    877877    RenderBlockFlow* parentBlock = downcast<RenderBlockFlow>(parent());
    878     if (parentBlock && style().clear() != Clear::None && parentBlock->getClearDelta(*this, logicalHeight()))
     878    if (parentBlock && RenderStyle::usedClear(*this) != UsedClear::None && parentBlock->getClearDelta(*this, logicalHeight()))
    879879        return marginValuesForChild(*this).positiveMarginBefore();
    880880    return 0_lu;
     
    13121312   
    13131313    // Give up if there is clearance on the box, since it probably won't collapse into us.
    1314     if (!grandchildBox || grandchildBox->style().clear() != Clear::None)
     1314    if (!grandchildBox || RenderStyle::usedClear(*grandchildBox) != UsedClear::None)
    13151315        return;
    13161316
     
    24422442        }
    24432443    }
    2444    
    2445     if (childBox.style().floating() == Float::Left) {
     2444
     2445    if (RenderStyle::usedFloat(childBox) == UsedFloat::Left) {
    24462446        LayoutUnit heightRemainingLeft = 1_lu;
    24472447        LayoutUnit heightRemainingRight = 1_lu;
     
    24772477        floatLogicalLeft -= logicalWidthForFloat(floatingObject);
    24782478    }
    2479    
     2479
    24802480    LayoutUnit childLogicalLeftMargin = style().isLeftToRightDirection() ? marginStartForChild(childBox) : marginEndForChild(childBox);
    24812481    LayoutUnit childBeforeMargin = marginBeforeForChild(childBox);
     
    25672567
    25682568        LayoutRect oldRect = childBox.frameRect();
    2569 
    2570         if (childBox.style().clear() == Clear::Left || childBox.style().clear() == Clear::Both)
     2569        auto childBoxUsedClear = RenderStyle::usedClear(childBox);
     2570        if (childBoxUsedClear == UsedClear::Left || childBoxUsedClear == UsedClear::Both)
    25712571            logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::FloatLeft), logicalTop);
    2572         if (childBox.style().clear() == Clear::Right || childBox.style().clear() == Clear::Both)
     2572        if (childBoxUsedClear == UsedClear::Right || childBoxUsedClear == UsedClear::Both)
    25732573            logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::FloatRight), logicalTop);
    25742574
     
    26252625}
    26262626
    2627 void RenderBlockFlow::clearFloats(Clear clear)
     2627void RenderBlockFlow::clearFloats(UsedClear usedClear)
    26282628{
    26292629    positionNewFloats();
    26302630    // set y position
    26312631    LayoutUnit newY;
    2632     switch (clear) {
    2633     case Clear::Left:
     2632    switch (usedClear) {
     2633    case UsedClear::Left:
    26342634        newY = lowestFloatLogicalBottom(FloatingObject::FloatLeft);
    26352635        break;
    2636     case Clear::Right:
     2636    case UsedClear::Right:
    26372637        newY = lowestFloatLogicalBottom(FloatingObject::FloatRight);
    26382638        break;
    2639     case Clear::Both:
     2639    case UsedClear::Both:
    26402640        newY = lowestFloatLogicalBottom();
    26412641        break;
    2642     case Clear::None:
     2642    case UsedClear::None:
    26432643        break;
    26442644    }
     
    28932893   
    28942894    // At least one float is present. We need to perform the clearance computation.
    2895     bool clearSet = child.style().clear() != Clear::None;
     2895    UsedClear usedClear = RenderStyle::usedClear(child);
     2896    bool clearSet = usedClear != UsedClear::None;
    28962897    LayoutUnit logicalBottom;
    2897     switch (child.style().clear()) {
    2898     case Clear::None:
     2898    switch (usedClear) {
     2899    case UsedClear::None:
    28992900        break;
    2900     case Clear::Left:
     2901    case UsedClear::Left:
    29012902        logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatLeft);
    29022903        break;
    2903     case Clear::Right:
     2904    case UsedClear::Right:
    29042905        logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatRight);
    29052906        break;
    2906     case Clear::Both:
     2907    case UsedClear::Both:
    29072908        logicalBottom = lowestFloatLogicalBottom();
    29082909        break;
     
    42304231        textIndent = minimumValueForLength(styleToUse.textIndent(), containingBlock->style().logicalWidth().value());
    42314232    }
    4232     RenderObject* prevFloat = 0;
     4233    RenderObject* previousFloat = 0;
    42334234    bool isPrevChildInlineFlow = false;
    42344235    bool shouldBreakLineAfterText = false;
     
    43224323                childMax += childMaxPreferredLogicalWidth.ceilToFloat();
    43234324
    4324                 bool clearPreviousFloat;
     4325                bool clearPreviousFloat = false;
    43254326                if (child->isFloating()) {
    4326                     clearPreviousFloat = (prevFloat
    4327                         && ((prevFloat->style().floating() == Float::Left && (childStyle.clear() == Clear::Left || childStyle.clear() == Clear::Both))
    4328                             || (prevFloat->style().floating() == Float::Right && (childStyle.clear() == Clear::Right || childStyle.clear() == Clear::Both))));
    4329                     prevFloat = child;
    4330                 } else
    4331                     clearPreviousFloat = false;
     4327                    auto childClearValue = RenderStyle::usedClear(*child);
     4328                    if (previousFloat) {
     4329                        auto previousFloatValue = RenderStyle::usedFloat(*previousFloat);
     4330                        clearPreviousFloat =
     4331                            (previousFloatValue == UsedFloat::Left && (childClearValue == UsedClear::Left || childClearValue == UsedClear::Both))
     4332                            || (previousFloatValue == UsedFloat::Right && (childClearValue == UsedClear::Right || childClearValue == UsedClear::Both));
     4333                    }
     4334                    previousFloat = child;
     4335                }
    43324336
    43334337                bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak;
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r275413 r276216  
    496496    // Returns true if and only if it has positioned any floats.
    497497    bool positionNewFloats();
    498     void clearFloats(Clear);
     498    void clearFloats(UsedClear);
    499499    FloatingObjects* floatingObjects() { return m_floatingObjects.get(); }
    500500
  • trunk/Source/WebCore/rendering/line/BreakingContext.h

    r276207 r276216  
    141141    void increment();
    142142
    143     void handleBR(Clear&);
     143    void handleBR(UsedClear&);
    144144    void handleOutOfFlowPositioned(Vector<RenderBox*>& positionedObjects);
    145145    void handleFloat();
     
    268268}
    269269
    270 inline void BreakingContext::handleBR(Clear& clear)
     270inline void BreakingContext::handleBR(UsedClear& usedClear)
    271271{
    272272    if (fitsOnLineOrHangsAtEnd()) {
     
    288288        // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a
    289289        // run for this object.
    290         if (m_ignoringSpaces && br.style().clear() != Clear::None)
     290        if (m_ignoringSpaces && RenderStyle::usedClear(br) != UsedClear::None)
    291291            m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(br);
    292292        // If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets
     
    297297
    298298        if (!m_lineInfo.isEmpty())
    299             clear = br.style().clear();
     299            usedClear = RenderStyle::usedClear(br);
    300300    }
    301301    m_atEnd = true;
  • trunk/Source/WebCore/rendering/line/LineBreaker.cpp

    r248846 r276216  
    3535    m_positionedObjects.clear();
    3636    m_hyphenated = false;
    37     m_clear = Clear::None;
     37    m_clear = UsedClear::None;
    3838}
    3939
  • trunk/Source/WebCore/rendering/line/LineBreaker.h

    r248528 r276216  
    5656    bool lineWasHyphenated() { return m_hyphenated; }
    5757    const Vector<RenderBox*>& positionedObjects() { return m_positionedObjects; }
    58     Clear clear() { return m_clear; }
     58    UsedClear usedClear() { return m_clear; }
    5959
    6060private:
     
    7272    RenderBlockFlow& m_block;
    7373    bool m_hyphenated;
    74     Clear m_clear;
     74    UsedClear m_clear;
    7575    Vector<RenderBox*> m_positionedObjects;
    7676};
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r276182 r276216  
    3737#include "Pagination.h"
    3838#include "QuotesData.h"
     39#include "RenderBlock.h"
    3940#include "RenderObject.h"
    4041#include "RenderTheme.h"
     
    26652666}
    26662667
     2668UsedClear RenderStyle::usedClear(const RenderObject& renderer)
     2669{
     2670    auto computedValue = renderer.style().clear();
     2671    switch (computedValue) {
     2672    case Clear::None:
     2673        return UsedClear::None;
     2674    case Clear::Left:
     2675        return UsedClear::Left;
     2676    case Clear::Right:
     2677        return UsedClear::Right;
     2678    case Clear::Both:
     2679        return UsedClear::Both;
     2680    case Clear::InlineStart:
     2681    case Clear::InlineEnd:
     2682        auto containingBlockDirection = renderer.containingBlock()->style().direction();
     2683        if (containingBlockDirection == TextDirection::RTL)
     2684            return computedValue == Clear::InlineStart ? UsedClear::Right : UsedClear::Left;
     2685        return computedValue == Clear::InlineStart ? UsedClear::Left : UsedClear::Right;
     2686    }
     2687}
     2688
     2689UsedFloat RenderStyle::usedFloat(const RenderObject& renderer)
     2690{
     2691    auto computedValue = renderer.style().floating();
     2692    switch (computedValue) {
     2693    case Float::None:
     2694        return UsedFloat::None;
     2695    case Float::Left:
     2696        return UsedFloat::Left;
     2697    case Float::Right:
     2698        return UsedFloat::Right;
     2699    case Float::InlineStart:
     2700    case Float::InlineEnd:
     2701        auto containingBlockDirection = renderer.containingBlock()->style().direction();
     2702        if (containingBlockDirection == TextDirection::RTL)
     2703            return computedValue == Float::InlineStart ? UsedFloat::Right : UsedFloat::Left;
     2704        return computedValue == Float::InlineStart ? UsedFloat::Left : UsedFloat::Right;
     2705    }
     2706}
    26672707} // namespace WebCore
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r276182 r276216  
    199199    void setColumnStylesFromPaginationMode(const Pagination::Mode&);
    200200   
    201     bool isFloating() const { return static_cast<Float>(m_nonInheritedFlags.floating) != Float::No; }
     201    bool isFloating() const { return static_cast<Float>(m_nonInheritedFlags.floating) != Float::None; }
    202202    bool hasMargin() const { return !m_surroundData->margin.isZero(); }
    203203    bool hasBorder() const { return m_surroundData->border.hasBorder(); }
     
    261261    bool hasViewportConstrainedPosition() const { return position() == PositionType::Fixed || position() == PositionType::Sticky; }
    262262    Float floating() const { return static_cast<Float>(m_nonInheritedFlags.floating); }
     263    static UsedFloat usedFloat(const RenderObject&);
    263264
    264265    const Length& width() const { return m_boxData->width(); }
     
    349350
    350351    Clear clear() const { return static_cast<Clear>(m_nonInheritedFlags.clear); }
     352    static UsedClear usedClear(const RenderObject&);
    351353    TableLayoutType tableLayout() const { return static_cast<TableLayoutType>(m_nonInheritedFlags.tableLayout); }
    352354
     
    15331535    static PositionType initialPosition() { return PositionType::Static; }
    15341536    static VerticalAlign initialVerticalAlign() { return VerticalAlign::Baseline; }
    1535     static Float initialFloating() { return Float::No; }
     1537    static Float initialFloating() { return Float::None; }
    15361538    static BreakBetween initialBreakBetween() { return BreakBetween::Auto; }
    15371539    static BreakInside initialBreakInside() { return BreakInside::Auto; }
     
    18701872        unsigned overflowY : 3; // Overflow
    18711873        unsigned verticalAlign : 4; // VerticalAlign
    1872         unsigned clear : 2; // Clear
     1874        unsigned clear : 3; // Clear
    18731875        unsigned position : 3; // PositionType
    18741876        unsigned unicodeBidi : 3; // EUnicodeBidi
    1875         unsigned floating : 2; // Float
     1877        unsigned floating : 3; // Float
    18761878        unsigned tableLayout : 1; // TableLayoutType
    18771879
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp

    r272987 r276216  
    281281    case Clear::Left: ts << "left"; break;
    282282    case Clear::Right: ts << "right"; break;
     283    case Clear::InlineStart : ts << "inline-start"; break;
     284    case Clear::InlineEnd : ts << "inline-end"; break;
    283285    case Clear::Both: ts << "both"; break;
     286    }
     287    return ts;
     288}
     289
     290TextStream& operator<<(TextStream& ts, UsedClear clear)
     291{
     292    switch (clear) {
     293    case UsedClear::None: ts << "none"; break;
     294    case UsedClear::Left: ts << "left"; break;
     295    case UsedClear::Right: ts << "right"; break;
     296    case UsedClear::Both: ts << "both"; break;
    284297    }
    285298    return ts;
     
    547560{
    548561    switch (floating) {
    549     case Float::No: ts << "none"; break;
     562    case Float::None: ts << "none"; break;
    550563    case Float::Left: ts << "left"; break;
    551564    case Float::Right: ts << "right"; break;
     565    case Float::InlineStart: ts << "inline-start"; break;
     566    case Float::InlineEnd: ts << "inline-end"; break;
     567    }
     568    return ts;
     569}
     570
     571TextStream& operator<<(TextStream& ts, UsedFloat floating)
     572{
     573    switch (floating) {
     574    case UsedFloat::None: ts << "none"; break;
     575    case UsedFloat::Left: ts << "left"; break;
     576    case UsedFloat::Right: ts << "right"; break;
    552577    }
    553578    return ts;
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r275199 r276216  
    238238
    239239enum class Float : uint8_t {
    240     No,
     240    None,
    241241    Left,
    242     Right
     242    Right,
     243    InlineStart,
     244    InlineEnd,
     245};
     246
     247enum class UsedFloat : uint8_t {
     248    None,
     249    Left,
     250    Right,
    243251};
    244252
     
    288296
    289297enum class Clear : uint8_t {
    290     None = 0,
    291     Left = 1,
    292     Right = 2,
    293     Both = 3
     298    None,
     299    Left,
     300    Right,
     301    InlineStart,
     302    InlineEnd,
     303    Both
     304};
     305
     306enum class UsedClear : uint8_t {
     307    None,
     308    Left,
     309    Right,
     310    Both
    294311};
    295312
     
    12371254WTF::TextStream& operator<<(WTF::TextStream&, CaptionSide);
    12381255WTF::TextStream& operator<<(WTF::TextStream&, Clear);
     1256WTF::TextStream& operator<<(WTF::TextStream&, UsedClear);
    12391257#if ENABLE(DARK_MODE_CSS)
    12401258WTF::TextStream& operator<<(WTF::TextStream&, ColorScheme);
     
    12611279WTF::TextStream& operator<<(WTF::TextStream&, FlexWrap);
    12621280WTF::TextStream& operator<<(WTF::TextStream&, Float);
     1281WTF::TextStream& operator<<(WTF::TextStream&, UsedFloat);
    12631282WTF::TextStream& operator<<(WTF::TextStream&, GridAutoFlow);
    12641283WTF::TextStream& operator<<(WTF::TextStream&, HangingPunctuation);
  • trunk/Source/WebCore/style/StyleAdjuster.cpp

    r275410 r276216  
    257257                if (m_element->hasTagName(tdTag)) {
    258258                    style.setEffectiveDisplay(DisplayType::TableCell);
    259                     style.setFloating(Float::No);
     259                    style.setFloating(Float::None);
    260260                } else if (is<HTMLTableElement>(*m_element))
    261261                    style.setEffectiveDisplay(style.isDisplayInlineType() ? DisplayType::InlineTable : DisplayType::Table);
     
    288288            if (m_element->hasTagName(rtTag)) {
    289289                style.setPosition(PositionType::Static);
    290                 style.setFloating(Float::No);
     290                style.setFloating(Float::None);
    291291            }
    292292
     
    335335        // "A parent with a grid or flex display value blockifies the box’s display type."
    336336        if (m_parentBoxStyle.isDisplayFlexibleOrGridBox()) {
    337             style.setFloating(Float::No);
     337            style.setFloating(Float::None);
    338338            style.setEffectiveDisplay(equivalentBlockDisplay(style, m_document));
    339339        }
Note: See TracChangeset for help on using the changeset viewer.