| Index: third_party/WebKit/Source/core/style/FillLayer.cpp
|
| diff --git a/third_party/WebKit/Source/core/style/FillLayer.cpp b/third_party/WebKit/Source/core/style/FillLayer.cpp
|
| index fd248537ea206ce98593c9aa8954f2487f991b5f..64717004d712602149dc9c76ce1047272d126911 100644
|
| --- a/third_party/WebKit/Source/core/style/FillLayer.cpp
|
| +++ b/third_party/WebKit/Source/core/style/FillLayer.cpp
|
| @@ -21,6 +21,7 @@
|
|
|
| #include "core/style/FillLayer.h"
|
|
|
| +#include "core/layout/LayoutObject.h"
|
| #include "core/style/DataEquivalency.h"
|
|
|
| namespace blink {
|
| @@ -370,29 +371,44 @@ bool FillLayer::imagesAreLoaded() const
|
| return true;
|
| }
|
|
|
| -bool FillLayer::hasOpaqueImage(const LayoutObject* layoutObject) const
|
| +bool FillLayer::imageIsOpaque(const LayoutObject& layoutObject) const
|
| {
|
| - if (!m_image)
|
| - return false;
|
| + // Returns true if we have an image that will cover the content below it when
|
| + // m_composite == CompositeSourceOver && m_blendMode == WebBlendModeNormal.
|
| + // Otherwise false.
|
| + return m_image->knownToBeOpaque(layoutObject)
|
| + && !m_image->imageSize(layoutObject, layoutObject.style()->effectiveZoom(), LayoutSize()).isEmpty();
|
| +}
|
|
|
| - // TODO(trchen): Should check blend mode before composite mode.
|
| - if (m_composite == CompositeClear || m_composite == CompositeCopy)
|
| - return true;
|
| +bool FillLayer::imageTilesLayer() const
|
| +{
|
| + // Returns true if an image will be tiled such that it covers any sized rectangle.
|
| + // TODO(schenney) We could relax the repeat mode requirement if we also knew the rect we
|
| + // had to fill, and the portion of the image we need to use, and know that the latter
|
| + // covers the former
|
| + return (m_repeatX == RepeatFill || m_repeatX == RoundFill)
|
| + && (m_repeatY == RepeatFill || m_repeatY == RoundFill);
|
| +
|
| +}
|
|
|
| - if (m_blendMode != WebBlendModeNormal)
|
| +bool FillLayer::imageOccludesNextLayers(const LayoutObject& layoutObject) const
|
| +{
|
| + // We can't cover without an image, regardless of other parameters
|
| + if (!m_image || !m_image->canRender())
|
| return false;
|
|
|
| - if (m_composite == CompositeSourceOver)
|
| - return m_image->knownToBeOpaque(*layoutObject);
|
| + switch (m_composite) {
|
| + case CompositeClear:
|
| + case CompositeCopy:
|
| + return imageTilesLayer();
|
| + case CompositeSourceOver:
|
| + return (m_blendMode == WebBlendModeNormal) && imageTilesLayer() && imageIsOpaque(layoutObject);
|
| + default: { }
|
| + }
|
|
|
| return false;
|
| }
|
|
|
| -bool FillLayer::hasRepeatXY() const
|
| -{
|
| - return m_repeatX == RepeatFill && m_repeatY == RepeatFill;
|
| -}
|
| -
|
| static inline bool layerImagesIdentical(const FillLayer& layer1, const FillLayer& layer2)
|
| {
|
| // We just care about pointer equivalency.
|
|
|