| Index: third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
|
| index 78c5335250e14d1948f73e9cb5d2662d7dbad87a..b71e3bcb0e15621898eeeac00dc0ea30472074c6 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp
|
| @@ -28,7 +28,9 @@
|
| #include "core/css/CSSImageValue.h"
|
| #include "core/css/CSSURIValue.h"
|
| #include "core/dom/Document.h"
|
| +#include "core/fetch/ImageResource.h"
|
| #include "core/fetch/ResourceFetcher.h"
|
| +#include "core/frame/Settings.h"
|
| #include "core/layout/svg/ReferenceFilterBuilder.h"
|
| #include "core/style/ComputedStyle.h"
|
| #include "core/style/ContentData.h"
|
| @@ -41,6 +43,8 @@
|
| #include "core/style/StyleImage.h"
|
| #include "core/style/StyleInvalidImage.h"
|
| #include "core/style/StylePendingImage.h"
|
| +#include "platform/Length.h"
|
| +#include "platform/LengthPoint.h"
|
|
|
| namespace blink {
|
|
|
| @@ -133,10 +137,27 @@ void ElementStyleResources::loadPendingSVGDocuments(ComputedStyle* computedStyle
|
| }
|
| }
|
|
|
| +static bool isSprite(const ComputedStyle& style)
|
| +{
|
| + if (!style.hasBackgroundImage())
|
| + return false;
|
| +
|
| + const FillLayer& background = style.backgroundLayers();
|
| + return (background.xPosition().isFixed() && !background.xPosition().isZero())
|
| + || (background.yPosition().isFixed() && !background.yPosition().isZero());
|
| +}
|
| +
|
| +static ImageResource::PlaceholderRequestType determinePlaceholderRequestType(const Document& document, const ComputedStyle& style)
|
| +{
|
| + return document.settings() && document.settings()->fetchImagePlaceholders() && !isSprite(style)
|
| + ? ImageResource::PlaceholderRequestType::AllowPlaceholder
|
| + : ImageResource::PlaceholderRequestType::DisallowPlaceholder;
|
| +}
|
| +
|
| StyleImage* ElementStyleResources::loadPendingImage(ComputedStyle* style, StylePendingImage* pendingImage, CrossOriginAttributeValue crossOrigin)
|
| {
|
| if (CSSImageValue* imageValue = pendingImage->cssImageValue())
|
| - return imageValue->cacheImage(*m_document, crossOrigin);
|
| + return imageValue->cacheImage(*m_document, crossOrigin, determinePlaceholderRequestType(*m_document, *style));
|
|
|
| if (CSSPaintValue* paintValue = pendingImage->cssPaintValue()) {
|
| StyleGeneratedImage* image = StyleGeneratedImage::create(*paintValue);
|
| @@ -153,7 +174,7 @@ StyleImage* ElementStyleResources::loadPendingImage(ComputedStyle* style, StyleP
|
| return cursorImageValue->cacheImage(*m_document, m_deviceScaleFactor);
|
|
|
| if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue())
|
| - return imageSetValue->cacheImage(*m_document, m_deviceScaleFactor, crossOrigin);
|
| + return imageSetValue->cacheImage(*m_document, m_deviceScaleFactor, crossOrigin, determinePlaceholderRequestType(*m_document, *style));
|
|
|
| ASSERT_NOT_REACHED();
|
| return nullptr;
|
|
|