diff options
Diffstat (limited to 'Source/WebCore')
3 files changed, 49 insertions, 18 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 68f452a..a6bf6af 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -604,24 +604,22 @@ void GraphicsLayerAndroid::updateFixedBackgroundLayers() { // Grab the background image and create a layer for it // the layer will be fixed positioned. - FillLayer* layers = view->style()->accessBackgroundLayers(); - StyleImage* styleImage = layers->image(); - if (styleImage->isCachedImage()) { - CachedImage* cachedImage = static_cast<StyleCachedImage*>(styleImage)->cachedImage(); - Image* image = cachedImage->image(); - if (image) { - m_fixedBackgroundLayer = new FixedBackgroundImageLayerAndroid(view->style(), - view->width(), - view->height()); - - Color color = view->style()->visitedDependentColor(CSSPropertyBackgroundColor); - SkColor skiaColor = SkColorSetARGB(color.alpha(), - color.red(), - color.green(), - color.blue()); - m_fixedBackgroundLayer->setBackgroundColor(skiaColor); - } - } + + Image* image = FixedBackgroundImageLayerAndroid::GetCachedImage(view->style()); + + if (!image) + return; + + m_fixedBackgroundLayer = new FixedBackgroundImageLayerAndroid(view->style(), + view->width(), + view->height()); + + Color color = view->style()->visitedDependentColor(CSSPropertyBackgroundColor); + SkColor skiaColor = SkColorSetARGB(color.alpha(), + color.red(), + color.green(), + color.blue()); + m_fixedBackgroundLayer->setBackgroundColor(skiaColor); // We need to clip the background image to the bounds of the original element m_foregroundClipLayer = new LayerAndroid(renderLayer); diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp index 8abff96..62a5824 100644 --- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp @@ -202,4 +202,35 @@ bool FixedBackgroundImageLayerAndroid::drawGL(bool layerTilesDisabled) return false; } +Image* FixedBackgroundImageLayerAndroid::GetCachedImage(PassRefPtr<RenderStyle> aStyle) +{ + RefPtr<RenderStyle> style = aStyle; + if (!style) + return 0; + + if (!style->hasFixedBackgroundImage()) + return 0; + + FillLayer* layers = style->accessBackgroundLayers(); + StyleImage* styleImage = layers->image(); + + if (!styleImage) + return 0; + + if (!styleImage->isLoaded()) + return 0; + + if (!styleImage->isCachedImage()) + return 0; + + CachedImage* cachedImage = static_cast<StyleCachedImage*>(styleImage)->cachedImage(); + + Image* image = cachedImage->image(); + + if (image == Image::nullImage()) + return 0; + + return image; +} + } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h index afe1c35..9ce8a07 100644 --- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h @@ -31,6 +31,7 @@ namespace WebCore { +class Image; class RenderLayerCompositor; class RenderStyle; @@ -68,6 +69,7 @@ public: virtual bool needsTexture() { return true; } virtual SubclassType subclassType() const { return LayerAndroid::FixedBackgroundImageLayer; } virtual bool drawGL(bool layerTilesDisabled); + static Image* GetCachedImage(PassRefPtr<RenderStyle> style); private: int m_width; |