Changeset 254861 in webkit


Ignore:
Timestamp:
Jan 21, 2020 10:28:17 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

-webkit-image-set should support all the image functions WebKit supports, not just url()
https://bugs.webkit.org/show_bug.cgi?id=81941

Patch by Noam Rosenthal <Noam Rosenthal> on 2020-01-21
Reviewed by Darin Adler.

Source/WebCore:

Separate StyleCachedImage to 4 classes:

  • StyleCachedImage: for single images only
  • StyleMultiImage: for values that can contain multiple images: like cursor/image-set
  • StyleImageSet
  • StyleCursorImage

The new classes only deal with their own value type. Before, ImageSet and cursor were resolved
as a StyleCachedImage, which is no longer a valid assumption if image-set can contain generated images.
Though cursors still can only contain cached images, it was cleaner to refactor it out as well.

Refactored best-fit image selection from loading. Now StyleCachedImage is in charge of loading
the actual image, and StyleImageSet/StyleCursorImage perform the source selection.

Also, added the necessary logic in the CSS parser to consume generated images inside image-sets, excluding
when the image-set is a cursor value.

Tests: fast/css/image-set-parsing-generated.html

fast/hidpi/image-set-cross-fade.html
fast/hidpi/image-set-gradient-multi.html
fast/hidpi/image-set-gradient-single.html
fast/hidpi/image-set-gradient.html

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:

Added new files

  • css/CSSCursorImageValue.cpp:

(WebCore::CSSCursorImageValue::selectBestFitImage):
(WebCore::CSSCursorImageValue::loadImage): Deleted.

  • css/CSSCursorImageValue.h:

Instead of cursor loading the image, it selects an image CSS value

  • css/CSSImageSetValue.cpp:

(WebCore::CSSImageSetValue::CSSImageSetValue):
(WebCore::CSSImageSetValue::fillImageSet):
(WebCore::CSSImageSetValue::cachedImage const):
(WebCore::CSSImageSetValue::selectBestFitImage):
(WebCore::CSSImageSetValue::updateDeviceScaleFactor):
(WebCore::CSSImageSetValue::imageSetWithStylesResolved):
(WebCore::CSSImageSetValue::traverseSubresources const):
(WebCore::CSSImageSetValue::loadBestFitImage): Deleted.

  • css/CSSImageSetValue.h:

Refactor CSSImageSetValue to include non-cachedImage images

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeCursor):

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::consumeImageSet):
(WebCore::CSSPropertyParserHelpers::consumeImage):
(WebCore::CSSPropertyParserHelpers::consumeUrlOrStringAsStringView): Deleted.

  • css/parser/CSSPropertyParserHelpers.h:
  • page/animation/CSSPropertyAnimation.cpp:

(WebCore::blendFunc):

When blending two images, get the selected images in case it is an image-set

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderImageResourceStyleImage.cpp:

(WebCore::RenderImageResourceStyleImage::initialize):

  • rendering/RenderLayerBacking.cpp:

(WebCore::canDirectlyCompositeBackgroundBackgroundImage):

  • rendering/style/ShapeValue.cpp:

(WebCore::ShapeValue::isImageValid const):

Use hasCachedImage() instead of isCachedImage() as a StyleImageSet is no longer an isCachedImage()

  • rendering/style/StyleCachedImage.cpp:

(WebCore::StyleCachedImage::StyleCachedImage):
(WebCore::StyleCachedImage::imageURL):
(WebCore::StyleCachedImage::load):

  • rendering/style/StyleCachedImage.h:
  • rendering/style/StyleCursorImage.h:
  • rendering/style/StyleCursorImage.cpp:
  • rendering/style/StyleMultiImage.h:
  • rendering/style/StyleMultiImage.cpp:
  • rendering/style/StyleImageSet.h:
  • rendering/style/StyleImageSet.cpp:
  • rendering/style/StyleImage.h:

(WebCore::StyleImage::selectedImage):
(WebCore::StyleImage::selectedImage const):
(WebCore::StyleImage::isCursorImage const):
(WebCore::StyleImage::isImageSet const):
(WebCore::StyleImage::hasCachedImage const):
(WebCore::StyleImage::StyleImage):

Separate cursor/image-set related stuff away from StyleCachedImage.

  • style/StyleBuilderCustom.h:

(WebCore::Style::BuilderCustom::applyValueContent):

  • style/StyleBuilderState.cpp:

(WebCore::Style::BuilderState::resolveImageStyles):
(WebCore::Style::BuilderState::createStyleImage):

  • style/StyleBuilderState.h:

Match the CSS values with the correct Style class. Also, ensure image-sets resolve their
images' styles as they may contain gradients and other context-aware values.

LayoutTests:

  • fast/css/cursor-parsing-expected.txt:
  • fast/css/cursor-parsing.html:

Added parsing test to ensure arrow image-sets disable generated images

  • fast/css/image-set-parsing-generated-expected.txt: Added.
  • fast/css/image-set-parsing-generated.html: Added.
  • fast/css/image-set-parsing-invalid-expected.txt:
  • fast/css/image-set-parsing-invalid.html:

Added parsing tests for new generated-inside-image-set use cases
Test that image-set inside image-set is not supported

  • fast/hidpi/image-set-cross-fade-expected.html: Added.
  • fast/hidpi/image-set-cross-fade.html: Added.
  • fast/hidpi/image-set-gradient-expected.html: Added.
  • fast/hidpi/image-set-gradient-multi-expected.html: Added.
  • fast/hidpi/image-set-gradient-multi.html: Added.
  • fast/hidpi/image-set-gradient-single-expected.html: Added.
  • fast/hidpi/image-set-gradient-single.html: Added.
  • fast/hidpi/image-set-gradient.html: Added.

Added ref-tests for several generated-inside-image-set use-cases

Location:
trunk
Files:
16 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254860 r254861  
     12020-01-21  Noam Rosenthal  <noam@webkit.org>
     2
     3        -webkit-image-set should support all the image functions WebKit supports, not just url()
     4        https://bugs.webkit.org/show_bug.cgi?id=81941
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/css/cursor-parsing-expected.txt:
     9        * fast/css/cursor-parsing.html:
     10                Added parsing test to ensure arrow image-sets disable generated images
     11
     12        * fast/css/image-set-parsing-generated-expected.txt: Added.
     13        * fast/css/image-set-parsing-generated.html: Added.
     14        * fast/css/image-set-parsing-invalid-expected.txt:
     15        * fast/css/image-set-parsing-invalid.html:
     16                Added parsing tests for new generated-inside-image-set use cases
     17                Test that image-set inside image-set is not supported
     18
     19        * fast/hidpi/image-set-cross-fade-expected.html: Added.
     20        * fast/hidpi/image-set-cross-fade.html: Added.
     21        * fast/hidpi/image-set-gradient-expected.html: Added.
     22        * fast/hidpi/image-set-gradient-multi-expected.html: Added.
     23        * fast/hidpi/image-set-gradient-multi.html: Added.
     24        * fast/hidpi/image-set-gradient-single-expected.html: Added.
     25        * fast/hidpi/image-set-gradient-single.html: Added.
     26        * fast/hidpi/image-set-gradient.html: Added.
     27                Added ref-tests for several generated-inside-image-set use-cases
     28
    1292020-01-21  Chris Dumez  <cdumez@apple.com>
    230
  • trunk/LayoutTests/fast/css/cursor-parsing-expected.txt

    r231359 r254861  
    6363PASS roundtripCssRule("cursor: url(file:///foo.png) x y;").cssText is ""
    6464PASS roundtripCssRule("cursor: url(file:///foo.png) auto;").cssText is ""
     65
     66Test a bunch of cursor rules with generated images.
     67PASS roundtripCssRule("cursor: linear-gradient(red, white) -1 -1, pointer;").cssText is ""
     68PASS roundtripCssRule("cursor: image-set(linear-gradient(red, white) 1x) -1 -1, pointer;").cssText is ""
    6569PASS successfullyParsed is true
    6670
  • trunk/LayoutTests/fast/css/cursor-parsing.html

    r231359 r254861  
    106106testInvalidCursorRule('url(file:///foo.png) auto');
    107107
     108debug('');
     109debug('Test a bunch of cursor rules with generated images.');
     110testInvalidCursorRule('linear-gradient(red, white) -1 -1, pointer');
     111testInvalidCursorRule('image-set(linear-gradient(red, white) 1x) -1 -1, pointer');
     112
    108113successfullyParsed = true;
    109114</script>
  • trunk/LayoutTests/fast/css/image-set-parsing-invalid-expected.txt

    r254406 r254861  
    1919Scale factor is 0 : url('#a') 0x
    2020PASS cssRule is null
     21
     22Generated image for cursor : linear-gradient(black, white) 1x
     23PASS cssRule is null
     24
     25Image-set inside image-set : image-set(image-set(url('#a') 1x) 1x)
     26PASS cssRule is null
    2127PASS successfullyParsed is true
    2228
  • trunk/LayoutTests/fast/css/image-set-parsing-invalid.html

    r254406 r254861  
    3333testInvalidImageSet("Too many scale factor parameters", "background-image", "url('#a') 1x 2x");
    3434testInvalidImageSet("Scale factor is 0", "background-image", "url('#a') 0x");
     35testInvalidImageSet("Generated image for cursor", "cursor", "linear-gradient(black, white) 1x");
     36testInvalidImageSet("Image-set inside image-set", "background-image", "image-set(image-set(url('#a') 1x) 1x)");
    3537
    3638successfullyParsed = true;
  • trunk/Source/WebCore/ChangeLog

    r254859 r254861  
     12020-01-21  Noam Rosenthal  <noam@webkit.org>
     2
     3        -webkit-image-set should support all the image functions WebKit supports, not just url()
     4        https://bugs.webkit.org/show_bug.cgi?id=81941
     5
     6        Reviewed by Darin Adler.
     7
     8        Separate StyleCachedImage to 4 classes:
     9        - StyleCachedImage: for single images only
     10        - StyleMultiImage: for values that can contain multiple images: like cursor/image-set
     11        - StyleImageSet
     12        - StyleCursorImage
     13
     14        The new classes only deal with their own value type. Before, ImageSet and cursor were resolved
     15        as a StyleCachedImage, which is no longer a valid assumption if image-set can contain generated images.
     16        Though cursors still can only contain cached images, it was cleaner to refactor it out as well.
     17
     18        Refactored best-fit image selection from loading. Now StyleCachedImage is in charge of loading
     19        the actual image, and StyleImageSet/StyleCursorImage perform the source selection.
     20
     21        Also, added the necessary logic in the CSS parser to consume generated images inside image-sets, excluding
     22        when the image-set is a cursor value.
     23
     24        Tests: fast/css/image-set-parsing-generated.html
     25               fast/hidpi/image-set-cross-fade.html
     26               fast/hidpi/image-set-gradient-multi.html
     27               fast/hidpi/image-set-gradient-single.html
     28               fast/hidpi/image-set-gradient.html
     29
     30        * Sources.txt:
     31        * WebCore.xcodeproj/project.pbxproj:
     32                Added new files
     33
     34        * css/CSSCursorImageValue.cpp:
     35        (WebCore::CSSCursorImageValue::selectBestFitImage):
     36        (WebCore::CSSCursorImageValue::loadImage): Deleted.
     37        * css/CSSCursorImageValue.h:
     38                Instead of cursor loading the image, it selects an image CSS value
     39
     40        * css/CSSImageSetValue.cpp:
     41        (WebCore::CSSImageSetValue::CSSImageSetValue):
     42        (WebCore::CSSImageSetValue::fillImageSet):
     43        (WebCore::CSSImageSetValue::cachedImage const):
     44        (WebCore::CSSImageSetValue::selectBestFitImage):
     45        (WebCore::CSSImageSetValue::updateDeviceScaleFactor):
     46        (WebCore::CSSImageSetValue::imageSetWithStylesResolved):
     47        (WebCore::CSSImageSetValue::traverseSubresources const):
     48        (WebCore::CSSImageSetValue::loadBestFitImage): Deleted.
     49        * css/CSSImageSetValue.h:
     50                Refactor CSSImageSetValue to include non-cachedImage images
     51
     52        * css/parser/CSSPropertyParser.cpp:
     53        (WebCore::consumeCursor):
     54        * css/parser/CSSPropertyParserHelpers.cpp:
     55        (WebCore::CSSPropertyParserHelpers::consumeImageSet):
     56        (WebCore::CSSPropertyParserHelpers::consumeImage):
     57        (WebCore::CSSPropertyParserHelpers::consumeUrlOrStringAsStringView): Deleted.
     58        * css/parser/CSSPropertyParserHelpers.h:
     59               
     60        * page/animation/CSSPropertyAnimation.cpp:
     61        (WebCore::blendFunc):
     62                When blending two images, get the selected images in case it is an image-set
     63
     64        * rendering/RenderBoxModelObject.cpp:
     65        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     66        * rendering/RenderImageResourceStyleImage.cpp:
     67        (WebCore::RenderImageResourceStyleImage::initialize):
     68        * rendering/RenderLayerBacking.cpp:
     69        (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
     70        * rendering/style/ShapeValue.cpp:
     71        (WebCore::ShapeValue::isImageValid const):
     72                Use hasCachedImage() instead of isCachedImage() as a StyleImageSet is no longer an isCachedImage()
     73
     74        * rendering/style/StyleCachedImage.cpp:
     75        (WebCore::StyleCachedImage::StyleCachedImage):
     76        (WebCore::StyleCachedImage::imageURL):
     77        (WebCore::StyleCachedImage::load):
     78        * rendering/style/StyleCachedImage.h:
     79        * rendering/style/StyleCursorImage.h:
     80        * rendering/style/StyleCursorImage.cpp:
     81        * rendering/style/StyleMultiImage.h:
     82        * rendering/style/StyleMultiImage.cpp:
     83        * rendering/style/StyleImageSet.h:
     84        * rendering/style/StyleImageSet.cpp:
     85        * rendering/style/StyleImage.h:
     86        (WebCore::StyleImage::selectedImage):
     87        (WebCore::StyleImage::selectedImage const):
     88        (WebCore::StyleImage::isCursorImage const):
     89        (WebCore::StyleImage::isImageSet const):
     90        (WebCore::StyleImage::hasCachedImage const):
     91        (WebCore::StyleImage::StyleImage):
     92                Separate cursor/image-set related stuff away from StyleCachedImage.
     93
     94        * style/StyleBuilderCustom.h:
     95        (WebCore::Style::BuilderCustom::applyValueContent):
     96        * style/StyleBuilderState.cpp:
     97        (WebCore::Style::BuilderState::resolveImageStyles):
     98        (WebCore::Style::BuilderState::createStyleImage):
     99        * style/StyleBuilderState.h:
     100                Match the CSS values with the correct Style class. Also, ensure image-sets resolve their
     101                images' styles as they may contain gradients and other context-aware values.
     102
    11032020-01-21  Chris Dumez  <cdumez@apple.com>
    2104
  • trunk/Source/WebCore/Sources.txt

    r254849 r254861  
    22632263rendering/style/StyleBoxData.cpp
    22642264rendering/style/StyleCachedImage.cpp
     2265rendering/style/StyleCursorImage.cpp
    22652266rendering/style/StyleDeprecatedFlexibleBoxData.cpp
    22662267rendering/style/StyleFilterData.cpp
     
    22692270rendering/style/StyleGridData.cpp
    22702271rendering/style/StyleGridItemData.cpp
     2272rendering/style/StyleImageSet.cpp
    22712273rendering/style/StyleInheritedData.cpp
    22722274rendering/style/StyleMarqueeData.cpp
    22732275rendering/style/StyleMultiColData.cpp
     2276rendering/style/StyleMultiImage.cpp
    22742277rendering/style/StyleRareInheritedData.cpp
    22752278rendering/style/StyleRareNonInheritedData.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r254817 r254861  
    1372313723                C9DADBCA1B1D3B25001F17D8 /* JSMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSession.h; sourceTree = "<group>"; };
    1372413724                C9F87CFD1B28E5F600979B83 /* MediaSessionEvents.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = MediaSessionEvents.h; sourceTree = "<group>"; };
     13725                CA091D8623CF907800AD4346 /* StyleImageSet.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StyleImageSet.cpp; sourceTree = "<group>"; };
     13726                CA091D8923CF908800AD4346 /* StyleImageSet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleImageSet.h; sourceTree = "<group>"; };
    1372513727                CA1635DC2072E76900E7D2CE /* ReferrerPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReferrerPolicy.cpp; sourceTree = "<group>"; };
    1372613728                CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
    1372713729                CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
     13730                CA52BAE523D0AF1600DE0B84 /* StyleCursorImage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StyleCursorImage.cpp; sourceTree = "<group>"; };
     13731                CA52BAE723D0AF1700DE0B84 /* StyleMultiImage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StyleMultiImage.cpp; sourceTree = "<group>"; };
     13732                CA52BAE823D0AF1800DE0B84 /* StyleMultiImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleMultiImage.h; sourceTree = "<group>"; };
     13733                CA52BAE923D0AF1900DE0B84 /* StyleCursorImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleCursorImage.h; sourceTree = "<group>"; };
    1372813734                CA6C152F220B4A550055CBFC /* JSIDBRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBRequestCustom.cpp; sourceTree = "<group>"; };
    1372913735                CA6C1537220D1EB30055CBFC /* JSIDBCursorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBCursorCustom.cpp; sourceTree = "<group>"; };
     
    2556325569                                1C0AA16A21940DC700896829 /* StyleColorScheme.h */,
    2556425570                                9DAC7C561AF2CB6400437C44 /* StyleContentAlignmentData.h */,
     25571                                CA52BAE523D0AF1600DE0B84 /* StyleCursorImage.cpp */,
     25572                                CA52BAE923D0AF1900DE0B84 /* StyleCursorImage.h */,
    2556525573                                BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */,
    2556625574                                BC5EB8B60E8201BD00B25965 /* StyleDeprecatedFlexibleBoxData.cpp */,
     
    2557725585                                A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */,
    2557825586                                BCEF43CE0E673DA1001C1287 /* StyleImage.h */,
     25587                                CA091D8623CF907800AD4346 /* StyleImageSet.cpp */,
     25588                                CA091D8923CF908800AD4346 /* StyleImageSet.h */,
    2557925589                                BC2273010E82F1E600E7F975 /* StyleInheritedData.cpp */,
    2558025590                                BC2273020E82F1E600E7F975 /* StyleInheritedData.h */,
     
    2558325593                                BC5EB74B0E81E06700B25965 /* StyleMultiColData.cpp */,
    2558425594                                BC5EB74C0E81E06700B25965 /* StyleMultiColData.h */,
     25595                                CA52BAE723D0AF1700DE0B84 /* StyleMultiImage.cpp */,
     25596                                CA52BAE823D0AF1800DE0B84 /* StyleMultiImage.h */,
    2558525597                                BC2272E10E82EE9B00E7F975 /* StyleRareInheritedData.cpp */,
    2558625598                                BC2272E20E82EE9B00E7F975 /* StyleRareInheritedData.h */,
     
    3136931381                                6F26BB6C23343E6F002F2BEA /* LayoutContext.h in Headers */,
    3137031382                                11310CF520BA4A4C0065A8D0 /* LayoutDescendantIterator.h in Headers */,
     31383                                E418025523D4549B00FFB071 /* LayoutIntegrationBoxTree.h in Headers */,
    3137131384                                E4ABABDD236088FE00FA4345 /* LayoutIntegrationLineLayout.h in Headers */,
    3137231385                                11310CF420BA4A3D0065A8D0 /* LayoutIterator.h in Headers */,
     
    3206332076                                0F11A54F0F39233100C37884 /* RenderSelectionInfo.h in Headers */,
    3206432077                                AB247A6D0AFD6383003FA5FD /* RenderSlider.h in Headers */,
    32065                                 E418025523D4549B00FFB071 /* LayoutIntegrationBoxTree.h in Headers */,
    3206632078                                31955A88160D199200858025 /* RenderSnapshottedPlugIn.h in Headers */,
    3206732079                                BC8C8FAE0DDCD31B00B592F4 /* RenderStyle.h in Headers */,
  • trunk/Source/WebCore/css/CSSCursorImageValue.cpp

    r246034 r254861  
    9696}
    9797
    98 std::pair<CachedImage*, float> CSSCursorImageValue::loadImage(CachedResourceLoader& loader, const ResourceLoaderOptions& options)
     98ImageWithScale CSSCursorImageValue::selectBestFitImage(const Document& document)
    9999{
    100100    if (is<CSSImageSetValue>(m_imageValue.get()))
    101         return downcast<CSSImageSetValue>(m_imageValue.get()).loadBestFitImage(loader, options);
     101        return downcast<CSSImageSetValue>(m_imageValue.get()).selectBestFitImage(document);
    102102
    103     if (auto* cursorElement = updateCursorElement(*loader.document())) {
     103    if (auto* cursorElement = updateCursorElement(document)) {
    104104        if (cursorElement->href() != downcast<CSSImageValue>(m_imageValue.get()).url())
    105             m_imageValue = CSSImageValue::create(loader.document()->completeURL(cursorElement->href()), m_loadedFromOpaqueSource);
     105            m_imageValue = CSSImageValue::create(document.completeURL(cursorElement->href()), m_loadedFromOpaqueSource);
    106106    }
    107107
    108     return { downcast<CSSImageValue>(m_imageValue.get()).loadImage(loader, options), 1 };
     108    return { m_imageValue.ptr() , 1 };
    109109}
    110110
  • trunk/Source/WebCore/css/CSSCursorImageValue.h

    r238698 r254861  
    3535class SVGElement;
    3636
     37struct ImageWithScale;
     38
     39namespace Style {
     40class BuilderState;
     41}
     42
    3743class CSSCursorImageValue final : public CSSValue {
    3844public:
     
    5763    String customCSSText() const;
    5864
    59     std::pair<CachedImage*, float> loadImage(CachedResourceLoader&, const ResourceLoaderOptions&);
     65    ImageWithScale selectBestFitImage(const Document&);
    6066
    6167    void removeReferencedElement(SVGElement*);
  • trunk/Source/WebCore/css/CSSImageSetValue.cpp

    r238698 r254861  
    2929#include "CSSImageValue.h"
    3030#include "CSSPrimitiveValue.h"
    31 #include "CachedImage.h"
    32 #include "CachedResourceLoader.h"
    33 #include "CachedResourceRequest.h"
    34 #include "CachedResourceRequestInitiators.h"
    3531#include "Document.h"
    3632#include "Page.h"
     33#include "StyleBuilderState.h"
    3734#include <wtf/text/StringBuilder.h>
    3835
    3936namespace WebCore {
    4037
    41 CSSImageSetValue::CSSImageSetValue(LoadedFromOpaqueSource loadedFromOpaqueSource)
     38Ref<CSSImageSetValue> CSSImageSetValue::create()
     39{
     40    return adoptRef(*new CSSImageSetValue);
     41}
     42
     43CSSImageSetValue::CSSImageSetValue()
    4244    : CSSValueList(ImageSetClass, CommaSeparator)
    43     , m_loadedFromOpaqueSource(loadedFromOpaqueSource)
    4445{
    4546}
     
    5354    while (i < length) {
    5455        CSSValue* imageValue = item(i);
    55         URL imageURL = downcast<CSSImageValue>(*imageValue).url();
    56 
     56        ASSERT(is<CSSImageValue>(imageValue) || is<CSSImageGeneratorValue>(imageValue));
    5757        ++i;
    5858        ASSERT_WITH_SECURITY_IMPLICATION(i < length);
     
    6161
    6262        ImageWithScale image;
    63         image.imageURL = imageURL;
     63        image.value = imageValue;
    6464        image.scaleFactor = scaleFactor;
    6565        m_imagesInSet.append(image);
     
    7171}
    7272
    73 CSSImageSetValue::ImageWithScale CSSImageSetValue::bestImageForScaleFactor()
     73ImageWithScale CSSImageSetValue::bestImageForScaleFactor()
    7474{
    7575    if (!m_imagesInSet.size())
     
    8686}
    8787
    88 std::pair<CachedImage*, float> CSSImageSetValue::loadBestFitImage(CachedResourceLoader& loader, const ResourceLoaderOptions& options)
     88CachedImage* CSSImageSetValue::cachedImage() const
    8989{
    90     Document* document = loader.document();
    91     ASSERT(document);
     90    if (is<CSSImageValue>(m_selectedImageValue))
     91        return downcast<CSSImageValue>(*m_selectedImageValue).cachedImage();
     92    return nullptr;
     93}
    9294
    93     updateDeviceScaleFactor(*document);
     95ImageWithScale CSSImageSetValue::selectBestFitImage(const Document& document)
     96{
     97    updateDeviceScaleFactor(document);
    9498
    9599    if (!m_accessedBestFitImage) {
    96100        m_accessedBestFitImage = true;
     101        m_bestFitImage = bestImageForScaleFactor();
     102    }
    97103
    98         // FIXME: In the future, we want to take much more than deviceScaleFactor into acount here.
    99         // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(),
    100         // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
    101         ImageWithScale image = bestImageForScaleFactor();
    102 
    103         ResourceLoaderOptions loadOptions = options;
    104         loadOptions.loadedFromOpaqueSource = m_loadedFromOpaqueSource;
    105         CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), loadOptions);
    106         request.setInitiator(cachedResourceRequestInitiators().css);
    107         if (options.mode == FetchOptions::Mode::Cors)
    108             request.updateForAccessControl(*document);
    109 
    110         m_cachedImage = loader.requestImage(WTFMove(request)).value_or(nullptr);
    111         m_bestFitImageScaleFactor = image.scaleFactor;
    112     }
    113     return { m_cachedImage.get(), m_bestFitImageScaleFactor };
     104    return m_bestFitImage;
    114105}
    115106
    116107void CSSImageSetValue::updateDeviceScaleFactor(const Document& document)
    117108{
     109
     110    // FIXME: In the future, we want to take much more than deviceScaleFactor into acount here.
     111    // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(),
     112    // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
    118113    float deviceScaleFactor = document.page() ? document.page()->deviceScaleFactor() : 1;
    119114    if (deviceScaleFactor == m_deviceScaleFactor)
     
    121116    m_deviceScaleFactor = deviceScaleFactor;
    122117    m_accessedBestFitImage = false;
    123     m_cachedImage = nullptr;
     118    m_selectedImageValue = nullptr;
     119}
     120
     121Ref<CSSImageSetValue> CSSImageSetValue::imageSetWithStylesResolved(Style::BuilderState& builderState)
     122{
     123    Ref<CSSImageSetValue> result = CSSImageSetValue::create();
     124    size_t length = this->length();
     125    for (size_t i = 0; i + 1 < length; i += 2) {
     126        result->append(builderState.resolveImageStyles(*itemWithoutBoundsCheck(i)));
     127        result->append(*itemWithoutBoundsCheck(i + 1));
     128    }
     129
     130    return result;
    124131}
    125132
     
    156163bool CSSImageSetValue::traverseSubresources(const WTF::Function<bool (const CachedResource&)>& handler) const
    157164{
    158     if (!m_cachedImage)
    159         return false;
    160     return handler(*m_cachedImage);
     165    return m_selectedImageValue && m_selectedImageValue->traverseSubresources(handler);
    161166}
    162167
  • trunk/Source/WebCore/css/CSSImageSetValue.h

    r238698 r254861  
    3030#include "ResourceLoaderOptions.h"
    3131#include <wtf/Function.h>
     32#include <wtf/RefPtr.h>
    3233
    3334namespace WebCore {
     
    3536class CachedImage;
    3637class CachedResourceLoader;
     38class CSSImageValue;
    3739class Document;
     40
     41namespace Style {
     42class BuilderState;
     43}
     44
     45struct ImageWithScale {
     46    RefPtr<CSSValue> value;
     47    float scaleFactor { 1 };
     48};
    3849
    3950class CSSImageSetValue final : public CSSValueList {
    4051public:
    41     static Ref<CSSImageSetValue> create(LoadedFromOpaqueSource loadedFromOpaqueSource)
    42     {
    43         return adoptRef(*new CSSImageSetValue(loadedFromOpaqueSource));
    44     }
     52    static Ref<CSSImageSetValue> create();
    4553    ~CSSImageSetValue();
    4654
    47     std::pair<CachedImage*, float>  loadBestFitImage(CachedResourceLoader&, const ResourceLoaderOptions&);
    48     CachedImage* cachedImage() const { return m_cachedImage.get(); }
     55    ImageWithScale selectBestFitImage(const Document&);
     56    CachedImage* cachedImage() const;
    4957
    5058    String customCSSText() const;
    51 
    52     struct ImageWithScale {
    53         URL imageURL;
    54         float scaleFactor;
    55     };
    5659
    5760    bool traverseSubresources(const WTF::Function<bool (const CachedResource&)>& handler) const;
     
    5962    void updateDeviceScaleFactor(const Document&);
    6063
    61     URL bestImageForScaleFactorURL() { return bestImageForScaleFactor().imageURL; }
     64    Ref<CSSImageSetValue> imageSetWithStylesResolved(Style::BuilderState&);
    6265
    6366protected:
     
    6568
    6669private:
    67     explicit CSSImageSetValue(LoadedFromOpaqueSource);
     70    CSSImageSetValue();
    6871
    6972    void fillImageSet();
    7073    static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale second) { return first.scaleFactor < second.scaleFactor; }
    7174
    72     CachedResourceHandle<CachedImage> m_cachedImage;
     75    RefPtr<CSSValue> m_selectedImageValue;
    7376    bool m_accessedBestFitImage { false };
    74     float m_bestFitImageScaleFactor { 1 };
     77    ImageWithScale m_bestFitImage;
    7578    float m_deviceScaleFactor { 1 };
    76 
    7779    Vector<ImageWithScale> m_imagesInSet;
    78     LoadedFromOpaqueSource m_loadedFromOpaqueSource { LoadedFromOpaqueSource::No };
    7980};
    8081
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r254790 r254861  
    21522152{
    21532153    RefPtr<CSSValueList> list;
    2154     while (RefPtr<CSSValue> image = consumeImage(range, context, ConsumeGeneratedImage::Forbid)) {
     2154    while (RefPtr<CSSValue> image = consumeImage(range, context, { AllowedImageType::URLFunction, AllowedImageType::ImageSet })) {
    21552155        double num;
    21562156        IntPoint hotSpot(-1, -1);
  • trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

    r254406 r254861  
    14801480}
    14811481
    1482 static StringView consumeUrlOrStringAsStringView(CSSParserTokenRange& args)
    1483 {
    1484     if (args.peek().type() == StringToken)
    1485         return args.consumeIncludingWhitespace().value();
    1486     return consumeUrlAsStringView(args);
    1487 }
    1488 
    1489 static RefPtr<CSSValue> consumeImageSet(CSSParserTokenRange& range, const CSSParserContext& context)
     1482static RefPtr<CSSValue> consumeImageSet(CSSParserTokenRange& range, const CSSParserContext& context, OptionSet<AllowedImageType> allowedImageType)
    14901483{
    14911484    CSSParserTokenRange rangeCopy = range;
    14921485    CSSParserTokenRange args = consumeFunction(rangeCopy);
    1493     RefPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create(context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
     1486    RefPtr<CSSImageSetValue> imageSet = CSSImageSetValue::create();
    14941487    do {
    1495         AtomString urlValue = consumeUrlOrStringAsStringView(args).toAtomString();
    1496         if (urlValue.isNull())
    1497             return nullptr;
    1498 
    1499         RefPtr<CSSValue> image = CSSImageValue::create(completeURL(context, urlValue), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
     1488        RefPtr<CSSValue> image = consumeImage(args, context, (allowedImageType | AllowedImageType::RawStringAsURL) - AllowedImageType::ImageSet);
     1489        if (!image)
     1490            return nullptr;
     1491
    15001492        imageSet->append(image.releaseNonNull());
    15011493
     
    17121704}
    17131705
    1714 RefPtr<CSSValue> consumeImage(CSSParserTokenRange& range, CSSParserContext context, ConsumeGeneratedImage generatedImage)
    1715 {
    1716     AtomString uri = consumeUrlAsStringView(range).toAtomString();
    1717     if (!uri.isNull())
    1718         return CSSImageValue::create(completeURL(context, uri), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
     1706RefPtr<CSSValue> consumeImage(CSSParserTokenRange& range, CSSParserContext context, OptionSet<AllowedImageType> AllowedImageType)
     1707{
     1708    if ((range.peek().type() == StringToken) && (AllowedImageType & AllowedImageType::RawStringAsURL))
     1709        return CSSImageValue::create(completeURL(context, range.consumeIncludingWhitespace().value().toAtomString()), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
    17191710
    17201711    if (range.peek().type() == FunctionToken) {
    17211712        CSSValueID id = range.peek().functionId();
    1722         if (id == CSSValueWebkitImageSet || id == CSSValueImageSet)
    1723             return consumeImageSet(range, context);
    1724         if (generatedImage == ConsumeGeneratedImage::Allow && isGeneratedImage(id))
     1713        if ((AllowedImageType & AllowedImageType::ImageSet) && (id == CSSValueWebkitImageSet || id == CSSValueImageSet))
     1714            return consumeImageSet(range, context, AllowedImageType);
     1715        if ((AllowedImageType & AllowedImageType::GeneratedImage) && isGeneratedImage(id))
    17251716            return consumeGeneratedImage(range, context);
    17261717    }
     1718
     1719    if (AllowedImageType & AllowedImageType::URLFunction) {
     1720        auto uri = consumeUrlAsStringView(range);
     1721        if (!uri.isNull())
     1722            return CSSImageValue::create(completeURL(context, uri.toAtomString()), context.isContentOpaque ? LoadedFromOpaqueSource::Yes : LoadedFromOpaqueSource::No);
     1723    }
     1724
    17271725    return nullptr;
    17281726}
  • trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h

    r252983 r254861  
    3737#include "CSSValuePool.h"
    3838#include "Length.h" // For ValueRange
     39#include <wtf/OptionSet.h>
    3940
    4041namespace WebCore {
     
    9091bool consumeOneOrTwoValuedPosition(CSSParserTokenRange&, CSSParserMode, UnitlessQuirk, RefPtr<CSSPrimitiveValue>& resultX, RefPtr<CSSPrimitiveValue>& resultY);
    9192
    92 enum class ConsumeGeneratedImage {
    93     Allow,
    94     Forbid
     93enum class AllowedImageType : uint8_t {
     94    URLFunction = 1 << 0,
     95    RawStringAsURL = 1 << 1,
     96    ImageSet = 1 << 2,
     97    GeneratedImage = 1 << 3
    9598};
    9699
    97 RefPtr<CSSValue> consumeImage(CSSParserTokenRange&, CSSParserContext, ConsumeGeneratedImage = ConsumeGeneratedImage::Allow);
     100RefPtr<CSSValue> consumeImage(CSSParserTokenRange&, CSSParserContext, OptionSet<AllowedImageType> = { AllowedImageType::URLFunction, AllowedImageType::ImageSet, AllowedImageType::GeneratedImage });
     101
    98102RefPtr<CSSValue> consumeImageOrNone(CSSParserTokenRange&, CSSParserContext);
    99103
  • trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp

    r252724 r254861  
    334334        return to;
    335335
     336    from = from->selectedImage();
     337    to = to->selectedImage();
     338
     339    if (!from || !to)
     340        return to;   
     341
    336342    // Animation between two generated images. Cross fade for all other cases.
    337343    if (is<StyleGeneratedImage>(*from) && is<StyleGeneratedImage>(*to)) {
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r254559 r254861  
    963963            auto drawResult = context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), options);
    964964            if (drawResult == ImageDrawResult::DidRequestDecoding) {
    965                 ASSERT(bgImage->isCachedImage());
     965                ASSERT(bgImage->hasCachedImage());
    966966                bgImage->cachedImage()->addClientWaitingForAsyncDecoding(*this);
    967967            }
  • trunk/Source/WebCore/rendering/RenderImageResourceStyleImage.cpp

    r225872 r254861  
    4545void RenderImageResourceStyleImage::initialize(RenderElement& renderer)
    4646{
    47     RenderImageResource::initialize(renderer, m_styleImage->isCachedImage() ? m_styleImage.get().cachedImage() : nullptr);
     47    RenderImageResource::initialize(renderer, m_styleImage->hasCachedImage() ? m_styleImage.get().cachedImage() : nullptr);
    4848    m_styleImage->addClient(this->renderer());
    4949}
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r254087 r254861  
    21082108    // FIXME: support gradients with isGeneratedImage.
    21092109    auto* styleImage = fillLayer.image();
    2110     if (!styleImage->isCachedImage())
     2110    if (!styleImage->hasCachedImage())
    21112111        return false;
    21122112
  • trunk/Source/WebCore/rendering/style/ShapeValue.cpp

    r210469 r254861  
    3636    if (!m_image)
    3737        return false;
    38     if (m_image->isCachedImage()) {
     38    if (m_image->hasCachedImage()) {
    3939        auto* cachedImage = m_image->cachedImage();
    4040        return cachedImage && cachedImage->hasImage();
  • trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp

    r223728 r254861  
    2525#include "StyleCachedImage.h"
    2626
    27 #include "CSSCursorImageValue.h"
    28 #include "CSSImageSetValue.h"
    2927#include "CSSImageValue.h"
    3028#include "CachedImage.h"
     
    3432namespace WebCore {
    3533
    36 StyleCachedImage::StyleCachedImage(CSSValue& cssValue)
     34Ref<StyleCachedImage> StyleCachedImage::create(CSSImageValue& cssValue, float scaleFactor)
     35{
     36    return adoptRef(*new StyleCachedImage(cssValue, scaleFactor));
     37}
     38
     39StyleCachedImage::StyleCachedImage(CSSImageValue& cssValue, float scaleFactor)
    3740    : m_cssValue(cssValue)
     41    , m_scaleFactor(scaleFactor)
    3842{
    39     ASSERT(is<CSSImageValue>(m_cssValue) || is<CSSImageSetValue>(m_cssValue) || is<CSSCursorImageValue>(m_cssValue));
    40 
    4143    m_isCachedImage = true;
    42 
    43     // CSSImageValue doesn't get invalidated so we can grab the CachedImage immediately if it exists.
    44     if (is<CSSImageValue>(m_cssValue)) {
    45         m_cachedImage = downcast<CSSImageValue>(m_cssValue.get()).cachedImage();
    46         if (m_cachedImage)
    47             m_isPending = false;
    48     }
     44    m_cachedImage = m_cssValue->cachedImage();
     45    if (m_cachedImage)
     46        m_isPending = false;
    4947}
    5048
     
    6967URL StyleCachedImage::imageURL()
    7068{
    71     if (is<CSSImageValue>(m_cssValue))
    72         return downcast<CSSImageValue>(m_cssValue.get()).url();
    73 
    74     if (is<CSSImageSetValue>(m_cssValue))
    75         return downcast<CSSImageSetValue>(m_cssValue.get()).bestImageForScaleFactorURL();
    76 
    77     if (is<CSSCursorImageValue>(m_cssValue.get()))
    78         return downcast<CSSCursorImageValue>(m_cssValue.get()).imageURL();
    79 
    80     ASSERT_NOT_REACHED();
    81     return { };
     69    return m_cssValue->url();
    8270}
    8371
     
    8674    ASSERT(m_isPending);
    8775    m_isPending = false;
    88 
    89     if (is<CSSImageValue>(m_cssValue)) {
    90         auto& imageValue = downcast<CSSImageValue>(m_cssValue.get());
    91         m_cachedImage = imageValue.loadImage(loader, options);
    92         return;
    93     }
    94 
    95     if (is<CSSImageSetValue>(m_cssValue)) {
    96         auto& imageSetValue = downcast<CSSImageSetValue>(m_cssValue.get());
    97         std::tie(m_cachedImage, m_scaleFactor) = imageSetValue.loadBestFitImage(loader, options);
    98         return;
    99     }
    100 
    101     if (is<CSSCursorImageValue>(m_cssValue.get())) {
    102         auto& cursorValue = downcast<CSSCursorImageValue>(m_cssValue.get());
    103         std::tie(m_cachedImage, m_scaleFactor) = cursorValue.loadImage(loader, options);
    104         return;
    105     }
     76    m_cachedImage = m_cssValue->loadImage(loader, options);
    10677}
    10778
  • trunk/Source/WebCore/rendering/style/StyleCachedImage.h

    r221377 r254861  
    3030
    3131class CSSValue;
     32class CSSImageValue;
    3233class CachedImage;
    3334class Document;
     
    3637    WTF_MAKE_FAST_ALLOCATED;
    3738public:
    38     static Ref<StyleCachedImage> create(CSSValue& cssValue) { return adoptRef(*new StyleCachedImage(cssValue)); }
     39    static Ref<StyleCachedImage> create(CSSImageValue& cssValue, float scaleFactor = 1);
    3940    virtual ~StyleCachedImage();
    4041
     
    6566
    6667private:
    67     StyleCachedImage(CSSValue&);
     68    StyleCachedImage(CSSImageValue&, float);
    6869    URL imageURL();
    6970
    70     Ref<CSSValue> m_cssValue;
     71    Ref<CSSImageValue> m_cssValue;
    7172    bool m_isPending { true };
    7273    mutable float m_scaleFactor { 1 };
  • trunk/Source/WebCore/rendering/style/StyleImage.h

    r223728 r254861  
    6868    virtual bool knownToBeOpaque(const RenderElement*) const = 0;
    6969    virtual CachedImage* cachedImage() const { return 0; }
     70    virtual StyleImage* selectedImage() { return this; }
     71    virtual const StyleImage* selectedImage() const { return this; }
    7072
    7173    ALWAYS_INLINE bool isCachedImage() const { return m_isCachedImage; }
    7274    ALWAYS_INLINE bool isGeneratedImage() const { return m_isGeneratedImage; }
     75    ALWAYS_INLINE bool isCursorImage() const { return m_isCursorImage; }
     76    ALWAYS_INLINE bool isImageSet() const { return m_isImageSet; }
     77
     78    bool hasCachedImage() const { return m_isCachedImage || selectedImage()->isCachedImage(); }
    7379
    7480protected:
     
    7682        : m_isCachedImage(false)
    7783        , m_isGeneratedImage(false)
     84        , m_isImageSet(false)
     85        , m_isCursorImage(false)
    7886    {
    7987    }
    8088    bool m_isCachedImage : 1;
    8189    bool m_isGeneratedImage : 1;
     90    bool m_isImageSet : 1;
     91    bool m_isCursorImage : 1;
    8292};
    8393
  • trunk/Source/WebCore/style/StyleBuilderCustom.h

    r252392 r254861  
    4747#include "StyleBuilderConverter.h"
    4848#include "StyleCachedImage.h"
     49#include "StyleCursorImage.h"
    4950#include "StyleFontSizeFunctions.h"
    5051#include "StyleGeneratedImage.h"
     52#include "StyleImageSet.h"
    5153#include "StyleResolver.h"
    5254#include "WillChangeData.h"
     
    13251327                builderState.style().setContent(StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(item.get())), didSet);
    13261328            didSet = true;
    1327         } else if (is<CSSImageSetValue>(item)) {
    1328             builderState.style().setContent(StyleCachedImage::create(item), didSet);
     1329        }
     1330       
     1331        if (is<CSSImageSetValue>(item)) {
     1332            builderState.style().setContent(StyleImageSet::create(downcast<CSSImageSetValue>(item.get()).imageSetWithStylesResolved(builderState)), didSet);
    13291333            didSet = true;
    13301334        }
    13311335
    13321336        if (is<CSSImageValue>(item)) {
    1333             builderState.style().setContent(StyleCachedImage::create(item), didSet);
     1337            builderState.style().setContent(StyleCachedImage::create(downcast<CSSImageValue>(item.get())), didSet);
    13341338            didSet = true;
    13351339            continue;
  • trunk/Source/WebCore/style/StyleBuilderState.cpp

    r253538 r254861  
    4646#include "StyleBuilder.h"
    4747#include "StyleCachedImage.h"
     48#include "StyleCursorImage.h"
    4849#include "StyleFontSizeFunctions.h"
    4950#include "StyleGeneratedImage.h"
     51#include "StyleImageSet.h"
    5052#include "TransformFunctions.h"
    5153
     
    8082}
    8183
     84Ref<CSSValue> BuilderState::resolveImageStyles(CSSValue& value)
     85{
     86    if (is<CSSGradientValue>(value))
     87        return downcast<CSSGradientValue>(value).gradientWithStylesResolved(*this);
     88
     89    if (is<CSSImageSetValue>(value))
     90        return downcast<CSSImageSetValue>(value).imageSetWithStylesResolved(*this);
     91
     92    // Creating filter operations doesn't create a new CSSValue reference.
     93    if (is<CSSFilterImageValue>(value))
     94        downcast<CSSFilterImageValue>(value).createFilterOperations(*this);
     95
     96    return makeRef(value);
     97}
     98
    8299RefPtr<StyleImage> BuilderState::createStyleImage(CSSValue& value)
    83100{
    84     if (is<CSSImageGeneratorValue>(value)) {
    85         if (is<CSSGradientValue>(value))
    86             return StyleGeneratedImage::create(downcast<CSSGradientValue>(value).gradientWithStylesResolved(*this));
    87 
    88         if (is<CSSFilterImageValue>(value)) {
    89             // FilterImage needs to calculate FilterOperations.
    90             downcast<CSSFilterImageValue>(value).createFilterOperations(*this);
    91         }
    92         return StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(value));
    93     }
    94 
    95     if (is<CSSImageValue>(value) || is<CSSImageSetValue>(value) || is<CSSCursorImageValue>(value))
    96         return StyleCachedImage::create(value);
     101    if (is<CSSImageValue>(value))
     102        return StyleCachedImage::create(downcast<CSSImageValue>(value));
     103
     104    if (is<CSSCursorImageValue>(value))
     105        return StyleCursorImage::create(downcast<CSSCursorImageValue>(value));
     106
     107    if (is<CSSImageGeneratorValue>(value))
     108        return StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(resolveImageStyles(value).get()));
     109   
     110    if (is<CSSImageSetValue>(value))
     111        return StyleImageSet::create(downcast<CSSImageSetValue>(resolveImageStyles(value).get()));
    97112
    98113    return nullptr;
  • trunk/Source/WebCore/style/StyleBuilderState.h

    r252313 r254861  
    8383    ScopeOrdinal styleScopeOrdinal() const { return m_styleScopeOrdinal; }
    8484
     85    Ref<CSSValue> resolveImageStyles(CSSValue&);
    8586    RefPtr<StyleImage> createStyleImage(CSSValue&);
    8687    bool createFilterOperations(const CSSValue&, FilterOperations& outOperations);
Note: See TracChangeset for help on using the changeset viewer.