Changeset 122895 in webkit


Ignore:
Timestamp:
Jul 17, 2012 4:23:36 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Add parsing and style application for css3-images image-orientation
https://bugs.webkit.org/show_bug.cgi?id=89624

Patch by David Barr <davidbarr@chromium.org> on 2012-07-17
Reviewed by Tony Chang.

The css3-images module is at candidate recommendation.
http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation

Source/WebCore:

Test: fast/css/image-orientation/image-orientation.html

  • css/CSSComputedStyleDeclaration.cpp: Add computed style for image-orientation.

(WebCore): Add CSSPropertyImageOrientation to computedProperties.
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Map CSSPropertyImageOrientation using cast operator from PrimitiveValueMappings.

  • css/CSSParser.cpp: Add parsing rule for image-orientation.

(WebCore::CSSParser::parseValue): Parse the value of CSSPropertyImageOrientation as an angle.

  • css/CSSPrimitiveValueMappings.h: Add mappings between CSSPrimitiveValue and ImageOrientationEnum.

(WebCore): Add conditional include for ImageOrientation.h.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Map the natural orientations to angles.
(WebCore::CSSPrimitiveValue::operator ImageOrientationEnum): Round angles away from zero to quarter turns and map to the natural orientations.

  • css/CSSProperty.cpp: Add CSSPropertyImageOrientation.

(WebCore::CSSProperty::isInheritedProperty): Map CSSPropertyImageOrientation inherited.

  • css/CSSPropertyNames.in: Add image-orientation.
  • css/StyleBuilder.cpp: Add style application logic for CSSPropertyImageOrientation.

(WebCore::StyleBuilder::StyleBuilder): Map CSSPropertyImageOrientation to RenderStyle::imageOrientation with type ImageOrientationEnum.

  • css/StyleResolver.cpp: Handle CSSPropertyImageOrientation.

(WebCore::StyleResolver::applyProperty): Expect CSSPropertyImageOrientation to be handled by StyleBuilder.

  • rendering/style/RenderStyle.h: Add imageOrientation, setImageOrientation and initialImageOrientation.
  • rendering/style/StyleRareInheritedData.cpp: Add m_imageOrientation.

(WebCore::StyleRareInheritedData::StyleRareInheritedData): Add m_imageOrientation to default and copy contructors.
(WebCore::StyleRareInheritedData::operator==): Include m_imageOrientation in comparison.

  • rendering/style/StyleRareInheritedData.h: Add m_imageOrientation.

(StyleRareInheritedData): Add 4-bit field m_imageOrientation, mapping to ImageOrientationEnum.

LayoutTests:

  • fast/css/image-orientation/image-orientation-expected.txt: Added.
  • fast/css/image-orientation/image-orientation.html: Added.
  • platform/chromium/TestExpectations: Skip tests until image-orientation implementation lands.
  • platform/efl/TestExpectations: Skip tests until image-orientation implementation lands.
  • platform/gtk/TestExpectations: Skip tests until image-orientation implementation lands.
  • platform/mac/TestExpectations: Skip tests until image-orientation implementation lands.
  • platform/qt/TestExpectations: Skip tests until image-orientation implementation lands.
Location:
trunk
Files:
3 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r122893 r122895  
     12012-07-17  David Barr  <davidbarr@chromium.org>
     2
     3        Add parsing and style application for css3-images image-orientation
     4        https://bugs.webkit.org/show_bug.cgi?id=89624
     5
     6        Reviewed by Tony Chang.
     7
     8        The css3-images module is at candidate recommendation.
     9        http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation
     10
     11        * fast/css/image-orientation/image-orientation-expected.txt: Added.
     12        * fast/css/image-orientation/image-orientation.html: Added.
     13        * platform/chromium/TestExpectations: Skip tests until image-orientation implementation lands.
     14        * platform/efl/TestExpectations: Skip tests until image-orientation implementation lands.
     15        * platform/gtk/TestExpectations: Skip tests until image-orientation implementation lands.
     16        * platform/mac/TestExpectations: Skip tests until image-orientation implementation lands.
     17        * platform/qt/TestExpectations: Skip tests until image-orientation implementation lands.
     18
    1192012-07-17  Andy Estes  <aestes@apple.com>
    220
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r122874 r122895  
    159159// CSS image-resolution is not yet enabled.
    160160BUGWK85262 SKIP : fast/css/image-resolution = PASS
     161
     162// CSS image-orientation is not yet enabled.
     163BUGWK89052 SKIP : fast/css/image-orientation = PASS
    161164
    162165// Chromium needs larger media files to test buffering this way.
  • trunk/LayoutTests/platform/efl/TestExpectations

    r122843 r122895  
    5252// CSS image-resolution is not yet enabled.
    5353BUGWK85262 SKIP : fast/css/image-resolution = PASS
     54
     55// CSS image-orientation is not yet enabled.
     56BUGWK89052 SKIP : fast/css/image-orientation = PASS
    5457
    5558// This test assumes we cannot play RTSP, but we can.
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r122748 r122895  
    325325// CSS image-resolution is not yet enabled.
    326326BUGWK85262 SKIP : fast/css/image-resolution = PASS TEXT
     327
     328// CSS image-orientation is not yet enabled.
     329BUGWK89052 SKIP : fast/css/image-orientation = PASS
    327330
    328331// No CORS support for media elements is implemented yet.
  • trunk/LayoutTests/platform/mac/TestExpectations

    r122893 r122895  
    1919// CSS image-resolution is not yet enabled.
    2020BUGWK85262 SKIP : fast/css/image-resolution = PASS
     21
     22// CSS image-orientation is not yet enabled.
     23BUGWK89052 SKIP : fast/css/image-orientation = PASS
    2124
    2225// Our slow tests, in alphabetical order.
  • trunk/LayoutTests/platform/qt/TestExpectations

    r122723 r122895  
    8383BUGWK85262 SKIP : fast/css/image-resolution = PASS
    8484
     85// CSS image-orientation is not yet enabled.
     86BUGWK89052 SKIP : fast/css/image-orientation = PASS
     87
    8588// Needs rebaseline after bug 86441
    8689// failing new tests
  • trunk/Source/WebCore/ChangeLog

    r122886 r122895  
     12012-07-17  David Barr  <davidbarr@chromium.org>
     2
     3        Add parsing and style application for css3-images image-orientation
     4        https://bugs.webkit.org/show_bug.cgi?id=89624
     5
     6        Reviewed by Tony Chang.
     7
     8        The css3-images module is at candidate recommendation.
     9        http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation
     10
     11        Test: fast/css/image-orientation/image-orientation.html
     12
     13        * css/CSSComputedStyleDeclaration.cpp: Add computed style for image-orientation.
     14        (WebCore): Add CSSPropertyImageOrientation to computedProperties.
     15        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Map CSSPropertyImageOrientation using cast operator from PrimitiveValueMappings.
     16        * css/CSSParser.cpp: Add parsing rule for image-orientation.
     17        (WebCore::CSSParser::parseValue): Parse the value of CSSPropertyImageOrientation as an angle.
     18        * css/CSSPrimitiveValueMappings.h: Add mappings between CSSPrimitiveValue and ImageOrientationEnum.
     19        (WebCore): Add conditional include for ImageOrientation.h.
     20        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Map the natural orientations to angles.
     21        (WebCore::CSSPrimitiveValue::operator ImageOrientationEnum): Round angles away from zero to quarter turns and map to the natural orientations.
     22        * css/CSSProperty.cpp: Add CSSPropertyImageOrientation.
     23        (WebCore::CSSProperty::isInheritedProperty): Map CSSPropertyImageOrientation inherited.
     24        * css/CSSPropertyNames.in: Add image-orientation.
     25        * css/StyleBuilder.cpp: Add style application logic for CSSPropertyImageOrientation.
     26        (WebCore::StyleBuilder::StyleBuilder): Map CSSPropertyImageOrientation to RenderStyle::imageOrientation with type ImageOrientationEnum.
     27        * css/StyleResolver.cpp: Handle CSSPropertyImageOrientation.
     28        (WebCore::StyleResolver::applyProperty): Expect CSSPropertyImageOrientation to be handled by StyleBuilder.
     29        * rendering/style/RenderStyle.h: Add imageOrientation, setImageOrientation and initialImageOrientation.
     30        * rendering/style/StyleRareInheritedData.cpp: Add m_imageOrientation.
     31        (WebCore::StyleRareInheritedData::StyleRareInheritedData): Add m_imageOrientation to default and copy contructors.
     32        (WebCore::StyleRareInheritedData::operator==): Include m_imageOrientation in comparison.
     33        * rendering/style/StyleRareInheritedData.h: Add m_imageOrientation.
     34        (StyleRareInheritedData): Add 4-bit field m_imageOrientation, mapping to ImageOrientationEnum.
     35
    1362012-07-17  Adrienne Walker  <enne@google.com>
    237
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r122773 r122895  
    131131    CSSPropertyFontWeight,
    132132    CSSPropertyHeight,
     133#if ENABLE(CSS_IMAGE_ORIENTATION)
     134    CSSPropertyImageOrientation,
     135#endif
    133136    CSSPropertyImageRendering,
    134137#if ENABLE(CSS_IMAGE_RESOLUTION)
     
    17761779                return cssValuePool().createIdentifierValue(CSSValueBorder);
    17771780            return cssValuePool().createIdentifierValue(CSSValueLines);
     1781#if ENABLE(CSS_IMAGE_ORIENTATION)
     1782        case CSSPropertyImageOrientation:
     1783            return cssValuePool().createValue(style->imageOrientation());
     1784#endif
    17781785        case CSSPropertyImageRendering:
    17791786            return CSSPrimitiveValue::create(style->imageRendering());
  • trunk/Source/WebCore/css/CSSParser.cpp

    r122848 r122895  
    26872687    case CSSPropertyWebkitWrap:
    26882688        return RuntimeEnabledFeatures::cssExclusionsEnabled() && parseShorthand(propId, webkitWrapShorthand(), important);
     2689#endif
     2690#if ENABLE(CSS_IMAGE_ORIENTATION)
     2691    case CSSPropertyImageOrientation:
     2692        validPrimitive = !id && validUnit(value, FAngle);
     2693        break;
    26892694#endif
    26902695#if ENABLE(CSS_IMAGE_RESOLUTION)
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r121289 r122895  
    3838#include "FontSmoothingMode.h"
    3939#include "GraphicsTypes.h"
     40#if ENABLE(CSS_IMAGE_ORIENTATION)
     41#include "ImageOrientation.h"
     42#endif
    4043#include "Length.h"
    4144#include "LineClampValue.h"
     
    41094112#endif // ENABLE(SVG)
    41104113
     4114#if ENABLE(CSS_IMAGE_ORIENTATION)
     4115
     4116template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ImageOrientationEnum e)
     4117    : CSSValue(PrimitiveClass)
     4118{
     4119    m_primitiveUnitType = CSS_DEG;
     4120    switch (e) {
     4121    case OriginTopLeft:
     4122        m_value.num = 0;
     4123        break;
     4124    case OriginRightTop:
     4125        m_value.num = 90;
     4126        break;
     4127    case OriginBottomRight:
     4128        m_value.num = 180;
     4129        break;
     4130    case OriginLeftBottom:
     4131        m_value.num = 270;
     4132        break;
     4133    case OriginTopRight:
     4134    case OriginLeftTop:
     4135    case OriginBottomLeft:
     4136    case OriginRightBottom:
     4137        ASSERT_NOT_REACHED();
     4138    }
     4139}
     4140
     4141template<> inline CSSPrimitiveValue::operator ImageOrientationEnum() const
     4142{
     4143    ASSERT(isAngle());
     4144    double quarters = 4 * getDoubleValue(CSS_TURN);
     4145    int orientation = 3 & static_cast<int>(quarters < 0 ? floor(quarters) : ceil(quarters));
     4146    switch (orientation) {
     4147    case 0:
     4148        return OriginTopLeft;
     4149    case 1:
     4150        return OriginRightTop;
     4151    case 2:
     4152        return OriginBottomRight;
     4153    case 3:
     4154        return OriginLeftBottom;
     4155    default:
     4156        ASSERT_NOT_REACHED();
     4157        return OriginTopLeft;
     4158    }
     4159}
     4160
     4161#endif // ENABLE(CSS_IMAGE_ORIENTATION)
     4162
    41114163}
    41124164
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r121874 r122895  
    283283    case CSSPropertyFontVariant:
    284284    case CSSPropertyFontWeight:
     285#if ENABLE(CSS_IMAGE_ORIENTATION)
     286    case CSSPropertyImageOrientation:
     287#endif
    285288    case CSSPropertyImageRendering:
    286289#if ENABLE(CSS_IMAGE_RESOLUTION)
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r121597 r122895  
    104104font-stretch
    105105height
     106#if defined(ENABLE_CSS_IMAGE_ORIENTATION) && ENABLE_CSS_IMAGE_ORIENTATION
     107image-orientation
     108#endif
    106109image-rendering
    107110#if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r122773 r122895  
    18811881    setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
    18821882    setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneDisabled, UndefinedDisabled>::createHandler());
     1883#if ENABLE(CSS_IMAGE_ORIENTATION)
     1884    setPropertyHandler(CSSPropertyImageOrientation, ApplyPropertyDefault<ImageOrientationEnum, &RenderStyle::imageOrientation, ImageOrientationEnum, &RenderStyle::setImageOrientation, ImageOrientationEnum, &RenderStyle::initialImageOrientation>::createHandler());
     1885#endif
    18831886    setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
    18841887#if ENABLE(CSS_IMAGE_RESOLUTION)
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r122700 r122895  
    41704170    case CSSPropertyFontWeight:
    41714171    case CSSPropertyHeight:
     4172#if ENABLE(CSS_IMAGE_ORIENTATION)
     4173    case CSSPropertyImageOrientation:
     4174#endif
    41724175    case CSSPropertyImageRendering:
    41734176#if ENABLE(CSS_IMAGE_RESOLUTION)
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r122773 r122895  
    964964    bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; }
    965965
     966#if ENABLE(CSS_IMAGE_ORIENTATION)
     967    ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); }
     968#endif
     969
    966970    EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
    967971
     
    11361140    void setZoomWithoutReturnValue(float f) { setZoom(f); }
    11371141    bool setEffectiveZoom(float);
     1142
     1143#if ENABLE(CSS_IMAGE_ORIENTATION)
     1144    void setImageOrientation(ImageOrientationEnum v) { SET_VAR(rareInheritedData, m_imageOrientation, static_cast<int>(v)) }
     1145#endif
     1146
    11381147    void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) }
    11391148
     
    16591668    static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
    16601669    static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
     1670    static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; }
    16611671    static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
    16621672    static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r121127 r122895  
    8282    , textEmphasisPosition(TextEmphasisPositionOver)
    8383    , m_lineBoxContain(RenderStyle::initialLineBoxContain())
     84#if ENABLE(CSS_IMAGE_ORIENTATION)
     85    , m_imageOrientation(RenderStyle::initialImageOrientation())
     86#endif
    8487    , m_imageRendering(RenderStyle::initialImageRendering())
    8588    , m_lineSnap(RenderStyle::initialLineSnap())
     
    141144    , textEmphasisPosition(o.textEmphasisPosition)
    142145    , m_lineBoxContain(o.m_lineBoxContain)
     146#if ENABLE(CSS_IMAGE_ORIENTATION)
     147    , m_imageOrientation(o.m_imageOrientation)
     148#endif
    143149    , m_imageRendering(o.m_imageRendering)
    144150    , m_lineSnap(o.m_lineSnap)
     
    231237        && m_tabSize == o.m_tabSize
    232238        && m_lineGrid == o.m_lineGrid
     239#if ENABLE(CSS_IMAGE_ORIENTATION)
     240        && m_imageOrientation == o.m_imageOrientation
     241#endif
    233242        && m_imageRendering == o.m_imageRendering
    234243#if ENABLE(CSS_IMAGE_RESOLUTION)
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r121189 r122895  
    9696    unsigned m_lineBoxContain: 7; // LineBoxContain
    9797    // CSS Image Values Level 3
     98#if ENABLE(CSS_IMAGE_ORIENTATION)
     99    unsigned m_imageOrientation : 4; // ImageOrientationEnum
     100#endif
    98101    unsigned m_imageRendering : 2; // EImageRendering
    99102    unsigned m_lineSnap : 2; // LineSnap
Note: See TracChangeset for help on using the changeset viewer.