Changeset 125989 in webkit


Ignore:
Timestamp:
Aug 19, 2012 8:33:41 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: parse CSS attribute -webkit-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=94024

Patch by Rik Cabanier <cabanier@adobe.com> on 2012-08-19
Reviewed by Dirk Schulze.

Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/

Tests: css3/compositing/blend-mode-property-parsing-invalid.html

css3/compositing/blend-mode-property-parsing.html
css3/compositing/blend-mode-property.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSParser.cpp:

(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):

  • css/CSSProperty.cpp:

(WebCore::CSSProperty::isInheritedProperty):

  • css/CSSPropertyNames.in:
  • css/CSSValueKeywords.in:
  • css/StyleBuilder.cpp:

(WebCore::StyleBuilder::StyleBuilder):

  • rendering/RenderLayer.h:

(RenderLayer):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore):
(WebCore::RenderLayerBacking::updateLayerBlendMode):
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::setBlendMode):

  • rendering/RenderLayerBacking.h:

(RenderLayerBacking):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:
  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):

  • rendering/style/StyleRareNonInheritedData.h:

(StyleRareNonInheritedData):

LayoutTests: parse CSS attribute -webkit-blend-mode
https://bugs.webkit.org/show_bug.cgi?id=94024

Patch by Rik Cabanier <cabanier@adobe.com> on 2012-08-19
Reviewed by Dirk Schulze.

Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/

  • css3/compositing: Added.
  • css3/compositing/blend-mode-property-expected.txt: Added.
  • css3/compositing/blend-mode-property-parsing-expected.txt: Added.
  • css3/compositing/blend-mode-property-parsing-invalid-expected.txt: Added.
  • css3/compositing/blend-mode-property-parsing-invalid.html: Added.
  • css3/compositing/blend-mode-property-parsing.html: Added.
  • css3/compositing/blend-mode-property.html: Added.
  • css3/compositing/script-tests: Added.
  • css3/compositing/script-tests/blend-mode-property-parsing-invalid.js: Added.

(testInvalidFilterRule):

  • css3/compositing/script-tests/blend-mode-property-parsing.js: Added.

(jsWrapperClass):
(shouldBeType):
(testFilterRule):

  • css3/compositing/script-tests/blend-mode-property.js: Added.
Location:
trunk
Files:
11 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125988 r125989  
     12012-08-19  Rik Cabanier  <cabanier@adobe.com>
     2
     3        parse CSS attribute -webkit-blend-mode
     4        https://bugs.webkit.org/show_bug.cgi?id=94024
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/
     9
     10        * css3/compositing: Added.
     11        * css3/compositing/blend-mode-property-expected.txt: Added.
     12        * css3/compositing/blend-mode-property-parsing-expected.txt: Added.
     13        * css3/compositing/blend-mode-property-parsing-invalid-expected.txt: Added.
     14        * css3/compositing/blend-mode-property-parsing-invalid.html: Added.
     15        * css3/compositing/blend-mode-property-parsing.html: Added.
     16        * css3/compositing/blend-mode-property.html: Added.
     17        * css3/compositing/script-tests: Added.
     18        * css3/compositing/script-tests/blend-mode-property-parsing-invalid.js: Added.
     19        (testInvalidFilterRule):
     20        * css3/compositing/script-tests/blend-mode-property-parsing.js: Added.
     21        (jsWrapperClass):
     22        (shouldBeType):
     23        (testFilterRule):
     24        * css3/compositing/script-tests/blend-mode-property.js: Added.
     25
    1262012-08-19  MORITA Hajime  <morrita@google.com>
    227
  • trunk/Source/WebCore/ChangeLog

    r125988 r125989  
     12012-08-19  Rik Cabanier  <cabanier@adobe.com>
     2
     3        parse CSS attribute -webkit-blend-mode
     4        https://bugs.webkit.org/show_bug.cgi?id=94024
     5 
     6        Reviewed by Dirk Schulze.
     7
     8        Added parsing and general CSS handling of -webkit-blend-mode per http://www.w3.org/TR/2012/WD-compositing-20120816/
     9
     10        Tests: css3/compositing/blend-mode-property-parsing-invalid.html
     11               css3/compositing/blend-mode-property-parsing.html
     12               css3/compositing/blend-mode-property.html
     13
     14        * css/CSSComputedStyleDeclaration.cpp:
     15        (WebCore):
     16        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     17        * css/CSSParser.cpp:
     18        (WebCore::isValidKeywordPropertyAndValue):
     19        (WebCore::isKeywordPropertyID):
     20        (WebCore::CSSParser::parseValue):
     21        * css/CSSProperty.cpp:
     22        (WebCore::CSSProperty::isInheritedProperty):
     23        * css/CSSPropertyNames.in:
     24        * css/CSSValueKeywords.in:
     25        * css/StyleBuilder.cpp:
     26        (WebCore::StyleBuilder::StyleBuilder):
     27        * rendering/RenderLayer.h:
     28        (RenderLayer):
     29        * rendering/RenderLayerBacking.cpp:
     30        (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
     31        (WebCore):
     32        (WebCore::RenderLayerBacking::updateLayerBlendMode):
     33        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     34        (WebCore::RenderLayerBacking::setBlendMode):
     35        * rendering/RenderLayerBacking.h:
     36        (RenderLayerBacking):
     37        * rendering/style/RenderStyle.cpp:
     38        (WebCore::RenderStyle::diff):
     39        * rendering/style/RenderStyle.h:
     40        * rendering/style/StyleRareNonInheritedData.cpp:
     41        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
     42        (WebCore::StyleRareNonInheritedData::operator==):
     43        * rendering/style/StyleRareNonInheritedData.h:
     44        (StyleRareNonInheritedData):
     45
    1462012-08-19  MORITA Hajime  <morrita@google.com>
    247
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r125934 r125989  
    213213    CSSPropertyWebkitBackgroundOrigin,
    214214    CSSPropertyWebkitBackgroundSize,
     215#if ENABLE(CSS_COMPOSITING)
     216    CSSPropertyWebkitBlendMode,
     217#endif
    215218    CSSPropertyWebkitBorderFit,
    216219    CSSPropertyWebkitBorderHorizontalSpacing,
     
    24252428            return valueForFilter(style.get());
    24262429#endif
     2430#if ENABLE(CSS_COMPOSITING)
     2431        case CSSPropertyWebkitBlendMode:
     2432            return cssValuePool().createValue(style->blendMode());
     2433#endif
    24272434        case CSSPropertyBackground:
    24282435            return getBackgroundShorthandValue();
  • trunk/Source/WebCore/css/CSSParser.cpp

    r125845 r125989  
    675675            return true;
    676676        break;
     677#if ENABLE(CSS_COMPOSITING)
     678    case CSSPropertyWebkitBlendMode:
     679        if (valueID == CSSValueNormal || valueID == CSSValueMultiply || valueID == CSSValueScreen || valueID == CSSValueOverlay
     680            || valueID == CSSValueDarken || valueID == CSSValueLighten ||  valueID == CSSValueColorDodge || valueID == CSSValueColorBurn
     681            || valueID == CSSValueHardLight || valueID == CSSValueSoftLight || valueID == CSSValueDifference || valueID == CSSValueExclusion
     682            || valueID == CSSValueHue || valueID == CSSValueSaturation || valueID == CSSValueColor || valueID == CSSValueLuminosity)
     683            return true;
     684        break;
     685#endif
    677686    case CSSPropertyWebkitBorderFit:
    678687        if (valueID == CSSValueBorder || valueID == CSSValueLines)
     
    919928    case CSSPropertyVisibility:
    920929    case CSSPropertyWebkitAppearance:
     930#if ENABLE(CSS_COMPOSITING)
     931    case CSSPropertyWebkitBlendMode:
     932#endif
    921933    case CSSPropertyWebkitBackfaceVisibility:
    922934    case CSSPropertyWebkitBorderAfterStyle:
     
    22562268            return false;
    22572269        }
     2270        break;
     2271#endif
     2272#if ENABLE(CSS_COMPOSITING)
     2273    case CSSPropertyWebkitBlendMode:
     2274            validPrimitive = true;
    22582275        break;
    22592276#endif
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r125934 r125989  
    570570    case CSSPropertyWebkitFilter:
    571571#endif
     572#if ENABLE(CSS_COMPOSITING)
     573    case CSSPropertyWebkitBlendMode:
     574#endif
    572575#if ENABLE(CSS3_FLEXBOX)
    573576    case CSSPropertyWebkitAlignContent:
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r125716 r125989  
    267267-webkit-filter
    268268#endif
     269#if defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING
     270-webkit-blend-mode
     271#endif
    269272#if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX
    270273-webkit-align-content
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r124820 r125989  
    927927fine
    928928
    929 #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS
     929#if (defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS) || (defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING)
    930930// -webkit-filter
    931931#if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r125925 r125989  
    20942094    setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
    20952095    setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
     2096#if ENABLE(CSS_COMPOSITING)
     2097    setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
     2098#endif
    20962099}
    20972100
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r125794 r125989  
    398398
    399399    void updateTransform();
     400   
     401#if ENABLE(CSS_COMPOSITING)
     402    void updateBlendMode();
     403#endif
    400404
    401405    const LayoutSize& relativePositionOffset() const { return m_relativeOffset; }
     
    932936#endif
    933937
     938#if ENABLE(CSS_COMPOSITING)
     939    BlendMode m_blendMode;
     940#endif
     941
    934942    RenderBoxModelObject* m_renderer;
    935943
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r125794 r125989  
    205205    updateLayerFilters(renderer()->style());
    206206#endif
     207#if ENABLE(CSS_COMPOSITING)
     208    updateLayerBlendMode(renderer()->style());
     209#endif
    207210}
    208211
     
    240243{
    241244    m_canCompositeFilters = m_graphicsLayer->setFilters(style->filter());
     245}
     246#endif
     247
     248#if ENABLE(CSS_COMPOSITING)
     249void RenderLayerBacking::updateLayerBlendMode(const RenderStyle*)
     250{
    242251}
    243252#endif
     
    452461#if ENABLE(CSS_FILTERS)
    453462    updateLayerFilters(renderer()->style());
     463#endif
     464
     465#if ENABLE(CSS_COMPOSITING)
     466    updateLayerBlendMode(renderer()->style());
    454467#endif
    455468   
     
    11841197}
    11851198
     1199#if ENABLE(CSS_COMPOSITING)
     1200void RenderLayerBacking::setBlendMode(BlendMode)
     1201{
     1202}
     1203#endif
     1204
    11861205void RenderLayerBacking::setContentsNeedDisplay()
    11871206{
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r122354 r125989  
    166166    String nameForLayer() const;
    167167   
     168#if ENABLE(CSS_COMPOSITING)
     169    void setBlendMode(BlendMode);
     170#endif
     171
    168172private:
    169173    void createPrimaryGraphicsLayer();
     
    197201    void updateLayerFilters(const RenderStyle*);
    198202#endif
    199 
     203#if ENABLE(CSS_COMPOSITING)
     204    void updateLayerBlendMode(const RenderStyle*);
     205#endif
    200206    // Return the opacity value that this layer should use for compositing.
    201207    float compositingOpacity(float rendererOpacity) const;
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r125925 r125989  
    613613            return StyleDifferenceRepaintLayer;
    614614    }
     615   
     616#if ENABLE(CSS_COMPOSITING)
     617    if (rareNonInheritedData->m_effectiveBlendMode != other->rareNonInheritedData->m_effectiveBlendMode)
     618        return StyleDifferenceRepaintLayer;
     619#endif
    615620
    616621    if (rareNonInheritedData->opacity != other->rareNonInheritedData->opacity) {
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r125925 r125989  
    979979#endif
    980980
     981#if ENABLE(CSS_COMPOSITING)
     982    BlendMode blendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode); }
     983    void setBlendMode(BlendMode v) { rareNonInheritedData.access()->m_effectiveBlendMode = v; }
     984    bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) == BlendModeNormal; }
     985#else
     986    bool hasBlendMode() const { return false; }
     987#endif
     988 
    981989#if USE(RTL_SCROLLBAR)
    982990    bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
     
    17051713    static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
    17061714#endif
     1715#if ENABLE(CSS_COMPOSITING)
     1716    static BlendMode initialBlendMode() { return BlendModeNormal; }
     1717#endif
    17071718private:
    17081719    void setVisitedLinkColor(const Color&);
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r124884 r125989  
    7979#endif
    8080    , m_hasAspectRatio(false)
     81#if ENABLE(CSS_COMPOSITING)
     82    , m_effectiveBlendMode(RenderStyle::initialBlendMode())
     83#endif
    8184{
    8285    m_maskBoxImage.setMaskDefaults();
     
    150153#endif
    151154    , m_hasAspectRatio(o.m_hasAspectRatio)
     155#if ENABLE(CSS_COMPOSITING)
     156    , m_effectiveBlendMode(RenderStyle::initialBlendMode())
     157#endif
    152158{
    153159}
     
    226232        && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
    227233#endif
     234#if ENABLE(CSS_COMPOSITING)
     235        && m_effectiveBlendMode == o.m_effectiveBlendMode
     236#endif
    228237        && m_hasAspectRatio == o.m_hasAspectRatio;
    229238}
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h

    r124452 r125989  
    183183    unsigned m_runningAcceleratedAnimation : 1;
    184184#endif
     185
    185186    unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
     187
     188#if ENABLE(CSS_COMPOSITING)
     189    unsigned m_effectiveBlendMode: 5; // EBlendMode
     190#endif
    186191
    187192private:
Note: See TracChangeset for help on using the changeset viewer.