Changeset 126105 in webkit


Ignore:
Timestamp:
Aug 20, 2012 5:35:27 PM (12 years ago)
Author:
krit@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-20
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-20
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.
  • platform/chromium/css3/compositing/blend-mode-property-expected.txt : Added.
  • platform/chromium/css3/compositing/blend-mode-property-parsing-expected.txt : Added.
Location:
trunk
Files:
12 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r126097 r126105  
     12012-08-20  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        * platform/chromium/css3/compositing/blend-mode-property-expected.txt : Added.
     26        * platform/chromium/css3/compositing/blend-mode-property-parsing-expected.txt : Added.
     27
    1282012-08-20  Brady Eidson  <beidson@apple.com>
    229
  • trunk/Source/WebCore/ChangeLog

    r126103 r126105  
     12012-08-20  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-20  Kentaro Hara  <haraken@chromium.org>
    247
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r126072 r126105  
    214214    CSSPropertyWebkitBackgroundOrigin,
    215215    CSSPropertyWebkitBackgroundSize,
     216#if ENABLE(CSS_COMPOSITING)
     217    CSSPropertyWebkitBlendMode,
     218#endif
    216219    CSSPropertyWebkitBorderFit,
    217220    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

    r126072 r126105  
    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:
     
    22462258            return false;
    22472259        }
     2260        break;
     2261#endif
     2262#if ENABLE(CSS_COMPOSITING)
     2263    case CSSPropertyWebkitBlendMode:
     2264            validPrimitive = true;
    22482265        break;
    22492266#endif
  • trunk/Source/WebCore/css/CSSProperty.cpp

    r126054 r126105  
    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

    r126054 r126105  
    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

    r126072 r126105  
    931931fine
    932932
    933 #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS
     933#if (defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS) || (defined(ENABLE_CSS_COMPOSITING) && ENABLE_CSS_COMPOSITING)
    934934// -webkit-filter
    935935#if defined(ENABLE_CSS_SHADERS) && ENABLE_CSS_SHADERS
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r126072 r126105  
    20652065    setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
    20662066    setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
     2067#if ENABLE(CSS_COMPOSITING)
     2068    setPropertyHandler(CSSPropertyWebkitBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
     2069#endif
    20672070}
    20682071
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r126032 r126105  
    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

    r126032 r126105  
    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

    r126032 r126105  
    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

    r126054 r126105  
    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

    r126054 r126105  
    982982#endif
    983983
     984#if ENABLE(CSS_COMPOSITING)
     985    BlendMode blendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode); }
     986    void setBlendMode(BlendMode v) { rareNonInheritedData.access()->m_effectiveBlendMode = v; }
     987    bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) == BlendModeNormal; }
     988#else
     989    bool hasBlendMode() const { return false; }
     990#endif
     991 
    984992#if USE(RTL_SCROLLBAR)
    985993    bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
     
    17141722    static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
    17151723#endif
     1724#if ENABLE(CSS_COMPOSITING)
     1725    static BlendMode initialBlendMode() { return BlendModeNormal; }
     1726#endif
    17161727private:
    17171728    void setVisitedLinkColor(const Color&);
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r126054 r126105  
    8282#endif
    8383    , m_hasAspectRatio(false)
     84#if ENABLE(CSS_COMPOSITING)
     85    , m_effectiveBlendMode(RenderStyle::initialBlendMode())
     86#endif
    8487{
    8588    m_maskBoxImage.setMaskDefaults();
     
    156159#endif
    157160    , m_hasAspectRatio(o.m_hasAspectRatio)
     161#if ENABLE(CSS_COMPOSITING)
     162    , m_effectiveBlendMode(RenderStyle::initialBlendMode())
     163#endif
    158164{
    159165}
     
    235241        && !m_runningAcceleratedAnimation && !o.m_runningAcceleratedAnimation
    236242#endif
     243#if ENABLE(CSS_COMPOSITING)
     244        && m_effectiveBlendMode == o.m_effectiveBlendMode
     245#endif
    237246        && m_hasAspectRatio == o.m_hasAspectRatio;
    238247}
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h

    r126054 r126105  
    186186    unsigned m_runningAcceleratedAnimation : 1;
    187187#endif
     188
    188189    unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
     190
     191#if ENABLE(CSS_COMPOSITING)
     192    unsigned m_effectiveBlendMode: 5; // EBlendMode
     193#endif
    189194
    190195private:
Note: See TracChangeset for help on using the changeset viewer.