Chromium Code Reviews| 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..5941fb654956f7e53d470660b16a2425160eed7a 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,27 +371,40 @@ bool FillLayer::imagesAreLoaded() const |
| return true; |
| } |
| -bool FillLayer::hasOpaqueImage(const LayoutObject* layoutObject) const |
| +bool FillLayer::imageIsOpaqueAndTilesLayer(const LayoutObject& layoutObject) const |
|
Stephen Chennney
2016/03/16 20:54:16
Put almost all the conditions surround images here
|
| { |
| - if (!m_image) |
| - return false; |
| + // Returns true if we have an image and tiling that will cover the content below it when |
| + // m_composite == CompositeSourceOver && m_blendMode == WebBlendModeNormal. |
| + // Otherwise false. |
| + // 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_image |
| + && m_image->canRender() |
|
Stephen Chennney
2016/03/16 20:54:16
Forgot to remove these. Will follow up.
|
| + && m_image->knownToBeOpaque(layoutObject) |
| + && !m_image->imageSize(layoutObject, layoutObject.style()->effectiveZoom(), LayoutSize()).isEmpty() |
| + && (m_repeatX == RepeatFill || m_repeatX == RoundFill) |
| + && (m_repeatY == RepeatFill || m_repeatY == RoundFill); |
| - // TODO(trchen): Should check blend mode before composite mode. |
| - if (m_composite == CompositeClear || m_composite == CompositeCopy) |
| - return true; |
| +} |
| - if (m_blendMode != WebBlendModeNormal) |
| +bool FillLayer::imageOccludesNextLayers(const LayoutObject& layoutObject) const |
|
Stephen Chennney
2016/03/16 20:54:16
Due to the compositing modes behavior, it's not re
|
| +{ |
| + // 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); |
| - |
| - return false; |
| -} |
| + if (imageIsOpaqueAndTilesLayer(layoutObject)) { |
| + // Check that the compositing and blend modes maintain the opaqueness |
| + return (m_composite == CompositeClear |
| + || m_composite == CompositeCopy |
| + || m_composite == CompositeSourceOver) |
| + && m_blendMode == WebBlendModeNormal; |
| + } |
| -bool FillLayer::hasRepeatXY() const |
| -{ |
| - return m_repeatX == RepeatFill && m_repeatY == RepeatFill; |
| + // The image is not opaque, but these composite modes overwrite the background |
| + // regardless of the foreground. |
| + return (m_composite == CompositeClear || m_composite == CompositeCopy); |
|
Stephen Chennney
2016/03/16 20:54:16
This is really the else clause, but we do not put
|
| } |
| static inline bool layerImagesIdentical(const FillLayer& layer1, const FillLayer& layer2) |