Ignore:
Timestamp:
Mar 30, 2017, 2:27:09 PM (8 years ago)
Author:
[email protected]
Message:

[css-align] Adapt content-alignment properties to the new baseline syntax
https://bugs.webkit.org/show_bug.cgi?id=170262

Reviewed by David Hyatt.

Source/WebCore:

The baseline-position syntax has changed recently, so we need to update
the CSS properties using the old syntax. This patch address only the
content-alignment (align-content and justify-content).

I used this patch to adapt the implementation of the parsing logic for
these properties to the new Blink's CSS Parsing Design.

The new baseline syntax is "[first | last ]? baseline" which implies
modifying the parsing and computed value logic.

There are several layout tests affected by this change, so I'll update
them accordingly.

No new tests, just added/modified some cases to the tests we
already have using the new baseline values.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):

  • css/CSSContentDistributionValue.cpp:

(WebCore::CSSContentDistributionValue::customCSSText):

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::operator ItemPosition):
(WebCore::CSSPrimitiveValue::operator ContentPosition):

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

(WebCore::isBaselineKeyword):
(WebCore::consumeBaselineKeyword):
(WebCore::consumeContentDistributionOverflowPosition):
(WebCore::consumeSelfPositionOverflowPosition):

LayoutTests:

Added new cases to the alignment properties parsing tests so that we can verify the new
baseline-alignment syntax is parsed as expected.
Additionally, I modified the tests so that they use the testharness format.

  • css3/parse-align-content-expected.txt:
  • css3/parse-align-content.html:
  • css3/parse-justify-content-expected.txt:
  • css3/parse-justify-content.html:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSContentDistributionValue.cpp

    r200626 r214624  
    4646String CSSContentDistributionValue::customCSSText() const
    4747{
     48    auto& cssValuePool = CSSValuePool::singleton();
    4849    auto list = CSSValueList::createSpaceSeparated();
    4950    if (m_distribution != CSSValueInvalid)
    5051        list->append(distribution());
    51     if (m_position != CSSValueInvalid)
    52         list->append(position());
     52    if (m_position != CSSValueInvalid) {
     53        if (m_position == CSSValueFirstBaseline || m_position == CSSValueLastBaseline) {
     54            CSSValueID preference = m_position == CSSValueFirstBaseline ? CSSValueFirst : CSSValueLast;
     55            list->append(cssValuePool.createIdentifierValue(preference));
     56            list->append(cssValuePool.createIdentifierValue(CSSValueBaseline));
     57        } else
     58            list->append(position());
     59    }
    5360    if (m_overflow != CSSValueInvalid)
    5461        list->append(overflow());
Note: See TracChangeset for help on using the changeset viewer.