Ignore:
Timestamp:
Mar 24, 2017, 11:23:48 AM (8 years ago)
Author:
[email protected]
Message:

font-style needs a new CSSValue to make CSSRule.cssText work correctly
https://bugs.webkit.org/show_bug.cgi?id=169258

Reviewed by David Hyatt.

Source/WebCore:

With variation fonts, font-style's value can't be captured in a CSSPrimitiveValue (nor any other subclass
off CSSValue) any more. Instead, we need to create two new CSSValues which represent the grammar that font-
style and it's associated @font-face descriptor accept.

The grammar of the font-style property is "normal | italic | oblique [ <<angle>> ]?"
The grammar of the font-style descriptor is "normal | italic | oblique [ <<angle>> | <<angle>> <<angle>> ]?"

We currently still support numbers in place of the <<angle>> value (contrary to the spec). We will remove
this support in https://bugs.webkit.org/show_bug.cgi?id=169357.

Tests: fast/text/font-selection-font-face-parse.html:

fast/text/font-style-parse.html:

  • CMakeLists.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • css/CSSAllInOne.cpp:
  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::fontStyleFromStyle):
(WebCore::fontShorthandValueForSelectionProperties):

  • css/CSSFontFace.cpp:

(WebCore::calculateWeightRange):
(WebCore::calculateStretchRange):
(WebCore::calculateItalicRange):

  • css/CSSFontFaceSet.cpp:

(WebCore::computeFontSelectionRequest):
(WebCore::CSSFontFaceSet::matchingFaces):
(WebCore::calculateWeightValue): Deleted.
(WebCore::calculateStretchValue): Deleted.
(WebCore::calculateStyleValue): Deleted.

  • css/CSSFontFaceSet.h:
  • css/CSSFontSelector.cpp:

(WebCore::CSSFontSelector::addFontFaceRule):

  • css/CSSFontStyleRangeValue.cpp: Added.

(WebCore::CSSFontStyleRangeValue::customCSSText):
(WebCore::CSSFontStyleRangeValue::equals):

  • css/CSSFontStyleRangeValue.h: Added.
  • css/CSSFontStyleValue.cpp: Added.

(WebCore::CSSFontStyleValue::customCSSText):
(WebCore::CSSFontStyleValue::equals):

  • css/CSSFontStyleValue.h: Added.
  • css/CSSFontValue.cpp:

(WebCore::CSSFontValue::customCSSText):

  • css/CSSFontValue.h:
  • css/CSSValue.cpp:

(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):

  • css/CSSValue.h:

(WebCore::CSSValue::isFontStyleValue):
(WebCore::CSSValue::isFontStyleRangeValue):

  • css/FontFace.cpp:

(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):

  • css/StyleBuilderConverter.h:

(WebCore::StyleBuilderConverter::convertFontWeightFromValue):
(WebCore::StyleBuilderConverter::convertFontStretchFromValue):
(WebCore::StyleBuilderConverter::convertFontStyleFromValue):
(WebCore::StyleBuilderConverter::convertFontWeight):
(WebCore::StyleBuilderConverter::convertFontStretch):
(WebCore::StyleBuilderConverter::convertFontStyle):

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeFontStyle):
(WebCore::consumeFontStyleRange):
(WebCore::CSSPropertyParser::consumeSystemFont):
(WebCore::CSSPropertyParser::consumeFont):

  • svg/SVGFontFaceElement.cpp:

(WebCore::SVGFontFaceElement::parseAttribute):

LayoutTests:

Update tests' expected results.

  • fast/text/font-selection-font-face-parse-expected.txt:
  • fast/text/font-selection-font-face-parse.html:
  • fast/text/font-style-parse-expected.txt:
  • fast/text/font-style-parse.html:
  • platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
  • svg/css/getComputedStyle-basic-expected.txt:
File:
1 edited

Legend:

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

    r212629 r214359  
    4242#include "CSSFontFaceSrcValue.h"
    4343#include "CSSFontFeatureValue.h"
     44#include "CSSFontStyleRangeValue.h"
     45#include "CSSFontStyleValue.h"
    4446#include "CSSFontValue.h"
    4547#include "CSSFontVariationValue.h"
     
    207209        case PendingSubstitutionValueClass:
    208210            return compareCSSValues<CSSPendingSubstitutionValue>(*this, other);
     211        case FontStyleClass:
     212            return compareCSSValues<CSSFontStyleValue>(*this, other);
     213        case FontStyleRangeClass:
     214            return compareCSSValues<CSSFontStyleRangeValue>(*this, other);
    209215        default:
    210216            ASSERT_NOT_REACHED();
     
    303309    case PendingSubstitutionValueClass:
    304310        return downcast<CSSPendingSubstitutionValue>(*this).customCSSText();
     311    case FontStyleClass:
     312        return downcast<CSSFontStyleValue>(*this).customCSSText();
     313    case FontStyleRangeClass:
     314        return downcast<CSSFontStyleRangeValue>(*this).customCSSText();
    305315    }
    306316
     
    432442    case PendingSubstitutionValueClass:
    433443        delete downcast<CSSPendingSubstitutionValue>(this);
     444        return;
     445    case FontStyleClass:
     446        delete downcast<CSSFontStyleValue>(this);
     447        return;
     448    case FontStyleRangeClass:
     449        delete downcast<CSSFontStyleRangeValue>(this);
    434450        return;
    435451    }
Note: See TracChangeset for help on using the changeset viewer.