| Index: Source/core/css/resolver/StyleResourceLoader.cpp
|
| diff --git a/Source/core/css/resolver/StyleResourceLoader.cpp b/Source/core/css/resolver/StyleResourceLoader.cpp
|
| index 7c780c44c896744730f382e59debb7f7d84c223f..792cb0d8854618bfa3e3c4b64121f1ad8daddfa3 100644
|
| --- a/Source/core/css/resolver/StyleResourceLoader.cpp
|
| +++ b/Source/core/css/resolver/StyleResourceLoader.cpp
|
| @@ -77,20 +77,20 @@ void StyleResourceLoader::loadPendingSVGDocuments(ComputedStyle* computedStyle,
|
| elementStyleResources.clearPendingSVGDocuments();
|
| }
|
|
|
| -static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document, StylePendingImage* pendingImage, float deviceScaleFactor, const ResourceLoaderOptions& options)
|
| +static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document, CSSStyleImageMap& imageMap, StylePendingImage* pendingImage, float deviceScaleFactor, const ResourceLoaderOptions& options)
|
| {
|
| if (CSSImageValue* imageValue = pendingImage->cssImageValue())
|
| - return imageValue->cachedImage(document, options);
|
| + return imageValue->cachedImage(document, options, imageMap);
|
|
|
| if (CSSImageGeneratorValue* imageGeneratorValue
|
| = pendingImage->cssImageGeneratorValue()) {
|
| - imageGeneratorValue->loadSubimages(document);
|
| + imageGeneratorValue->loadSubimages(document, imageMap);
|
| return StyleGeneratedImage::create(imageGeneratorValue);
|
| }
|
|
|
| if (CSSCursorImageValue* cursorImageValue
|
| = pendingImage->cssCursorImageValue())
|
| - return cursorImageValue->cachedImage(document, deviceScaleFactor);
|
| + return cursorImageValue->cachedImage(document, imageMap, deviceScaleFactor);
|
|
|
| if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue())
|
| return imageSetValue->cachedImageSet(document, deviceScaleFactor, options);
|
| @@ -98,12 +98,12 @@ static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document,
|
| return nullptr;
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePendingImage* pendingImage, float deviceScaleFactor)
|
| +PassRefPtrWillBeRawPtr<StyleImage> StyleResourceLoader::loadPendingImage(CSSStyleImageMap& imageMap, StylePendingImage* pendingImage, float deviceScaleFactor)
|
| {
|
| - return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, ResourceFetcher::defaultResourceOptions());
|
| + return doLoadPendingImage(m_document, imageMap, pendingImage, deviceScaleFactor, ResourceFetcher::defaultResourceOptions());
|
| }
|
|
|
| -void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, ShapeValue* shapeValue, float deviceScaleFactor)
|
| +void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, CSSStyleImageMap& imageMap, ShapeValue* shapeValue, float deviceScaleFactor)
|
| {
|
| if (!shapeValue)
|
| return;
|
| @@ -117,7 +117,7 @@ void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, Sh
|
| options.credentialsRequested = ClientDidNotRequestCredentials;
|
| options.corsEnabled = IsCORSEnabled;
|
|
|
| - shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(image), deviceScaleFactor, options));
|
| + shapeValue->setImage(doLoadPendingImage(m_document, imageMap, toStylePendingImage(image), deviceScaleFactor, options));
|
| }
|
|
|
| void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleResources& elementStyleResources)
|
| @@ -128,12 +128,13 @@ void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
|
| PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pendingImageProperties().end().keys();
|
| for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResources.pendingImageProperties().begin().keys(); it != end; ++it) {
|
| CSSPropertyID currentProperty = *it;
|
| + CSSStyleImageMap& imageMap = elementStyleResources.mutableCssImages();
|
|
|
| switch (currentProperty) {
|
| case CSSPropertyBackgroundImage: {
|
| for (FillLayer* backgroundLayer = &style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
|
| if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage())
|
| - backgroundLayer->setImage(loadPendingImage(toStylePendingImage(backgroundLayer->image()), elementStyleResources.deviceScaleFactor()));
|
| + backgroundLayer->setImage(loadPendingImage(imageMap, toStylePendingImage(backgroundLayer->image()), elementStyleResources.deviceScaleFactor()));
|
| }
|
| break;
|
| }
|
| @@ -142,7 +143,7 @@ void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
|
| if (contentData->isImage()) {
|
| StyleImage* image = toImageContentData(contentData)->image();
|
| if (image->isPendingImage()) {
|
| - RefPtrWillBeRawPtr<StyleImage> loadedImage = loadPendingImage(toStylePendingImage(image), elementStyleResources.deviceScaleFactor());
|
| + RefPtrWillBeRawPtr<StyleImage> loadedImage = loadPendingImage(imageMap, toStylePendingImage(image), elementStyleResources.deviceScaleFactor());
|
| if (loadedImage)
|
| toImageContentData(contentData)->setImage(loadedImage.release());
|
| }
|
| @@ -156,7 +157,7 @@ void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
|
| CursorData& currentCursor = cursorList->at(i);
|
| if (StyleImage* image = currentCursor.image()) {
|
| if (image->isPendingImage())
|
| - currentCursor.setImage(loadPendingImage(toStylePendingImage(image), elementStyleResources.deviceScaleFactor()));
|
| + currentCursor.setImage(loadPendingImage(imageMap, toStylePendingImage(image), elementStyleResources.deviceScaleFactor()));
|
| }
|
| }
|
| }
|
| @@ -164,19 +165,19 @@ void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
|
| }
|
| case CSSPropertyListStyleImage: {
|
| if (style->listStyleImage() && style->listStyleImage()->isPendingImage())
|
| - style->setListStyleImage(loadPendingImage(toStylePendingImage(style->listStyleImage()), elementStyleResources.deviceScaleFactor()));
|
| + style->setListStyleImage(loadPendingImage(imageMap, toStylePendingImage(style->listStyleImage()), elementStyleResources.deviceScaleFactor()));
|
| break;
|
| }
|
| case CSSPropertyBorderImageSource: {
|
| if (style->borderImageSource() && style->borderImageSource()->isPendingImage())
|
| - style->setBorderImageSource(loadPendingImage(toStylePendingImage(style->borderImageSource()), elementStyleResources.deviceScaleFactor()));
|
| + style->setBorderImageSource(loadPendingImage(imageMap, toStylePendingImage(style->borderImageSource()), elementStyleResources.deviceScaleFactor()));
|
| break;
|
| }
|
| case CSSPropertyWebkitBoxReflect: {
|
| if (StyleReflection* reflection = style->boxReflect()) {
|
| const NinePieceImage& maskImage = reflection->mask();
|
| if (maskImage.image() && maskImage.image()->isPendingImage()) {
|
| - RefPtrWillBeRawPtr<StyleImage> loadedImage = loadPendingImage(toStylePendingImage(maskImage.image()), elementStyleResources.deviceScaleFactor());
|
| + RefPtrWillBeRawPtr<StyleImage> loadedImage = loadPendingImage(imageMap, toStylePendingImage(maskImage.image()), elementStyleResources.deviceScaleFactor());
|
| reflection->setMask(NinePieceImage(loadedImage.release(), maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.outset(), maskImage.horizontalRule(), maskImage.verticalRule()));
|
| }
|
| }
|
| @@ -184,18 +185,18 @@ void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
|
| }
|
| case CSSPropertyWebkitMaskBoxImageSource: {
|
| if (style->maskBoxImageSource() && style->maskBoxImageSource()->isPendingImage())
|
| - style->setMaskBoxImageSource(loadPendingImage(toStylePendingImage(style->maskBoxImageSource()), elementStyleResources.deviceScaleFactor()));
|
| + style->setMaskBoxImageSource(loadPendingImage(imageMap, toStylePendingImage(style->maskBoxImageSource()), elementStyleResources.deviceScaleFactor()));
|
| break;
|
| }
|
| case CSSPropertyWebkitMaskImage: {
|
| for (FillLayer* maskLayer = &style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {
|
| if (maskLayer->image() && maskLayer->image()->isPendingImage())
|
| - maskLayer->setImage(loadPendingImage(toStylePendingImage(maskLayer->image()), elementStyleResources.deviceScaleFactor()));
|
| + maskLayer->setImage(loadPendingImage(imageMap, toStylePendingImage(maskLayer->image()), elementStyleResources.deviceScaleFactor()));
|
| }
|
| break;
|
| }
|
| case CSSPropertyShapeOutside:
|
| - loadPendingShapeImage(style, style->shapeOutside(), elementStyleResources.deviceScaleFactor());
|
| + loadPendingShapeImage(style, imageMap, style->shapeOutside(), elementStyleResources.deviceScaleFactor());
|
| break;
|
| default:
|
| ASSERT_NOT_REACHED();
|
| @@ -203,6 +204,7 @@ void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
|
| }
|
|
|
| elementStyleResources.clearPendingImageProperties();
|
| + elementStyleResources.clearCSSImages();
|
| }
|
|
|
| void StyleResourceLoader::loadPendingResources(ComputedStyle* computedStyle, ElementStyleResources& elementStyleResources)
|
|
|