| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| index 246ccabb2e3a81e661dac034b68b9c451e15b57f..0cfbb374950d74f1d459ac342b00b0fed8cf98ff 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| @@ -727,6 +727,51 @@ LayoutRect LayoutBox::backgroundClipRect() const
|
| return LayoutRect();
|
| }
|
|
|
| +LayoutRect LayoutBox::opaqueBackgroundClipRect() const
|
| +{
|
| + EFillBox backgroundClip = TextFillBox;
|
| + // Find the largest opaque background clip rect.
|
| + // TODO(flackr): Unify with the above method.
|
| + if (const FillLayer* current = &(style()->backgroundLayers())) {
|
| + do {
|
| + const FillLayer* cur = current;
|
| + current = current->next();
|
| + if (cur->blendMode() != WebBlendModeNormal || cur->composite() != CompositeSourceOver)
|
| + continue;
|
| + // Check if the image or color has alpha.
|
| + if (const StyleImage* image = cur->image()) {
|
| + if (!image->knownToBeOpaque(*this))
|
| + continue;
|
| + } else {
|
| + Color backgroundColor = resolveColor(CSSPropertyBackgroundColor);
|
| + if (backgroundColor.hasAlpha())
|
| + continue;
|
| + }
|
| + EFillBox currentClip = cur->clip();
|
| + // Adjust clip if attachment is local.
|
| + if (currentClip == BorderFillBox && cur->attachment() == LocalBackgroundAttachment)
|
| + currentClip = PaddingFillBox;
|
| + // TODO(flackr): Expose and use clipMax method from FillLayer.cpp.
|
| + if (currentClip < backgroundClip)
|
| + backgroundClip = currentClip;
|
| + } while (current);
|
| + }
|
| + switch (backgroundClip) {
|
| + case BorderFillBox:
|
| + return borderBoxRect();
|
| + break;
|
| + case PaddingFillBox:
|
| + return paddingBoxRect();
|
| + break;
|
| + case ContentFillBox:
|
| + return contentBoxRect();
|
| + break;
|
| + default:
|
| + break;
|
| + }
|
| + return LayoutRect();
|
| +}
|
| +
|
| void LayoutBox::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, IncludeBlockVisualOverflowOrNot) const
|
| {
|
| rects.append(LayoutRect(additionalOffset, size()));
|
| @@ -1395,10 +1440,6 @@ bool LayoutBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c
|
| if (isDocumentElement() || backgroundStolenForBeingBody())
|
| return false;
|
|
|
| - Color backgroundColor = resolveColor(CSSPropertyBackgroundColor);
|
| - if (backgroundColor.hasAlpha())
|
| - return false;
|
| -
|
| // If the element has appearance, it might be painted by theme.
|
| // We cannot be sure if theme paints the background opaque.
|
| // In this case it is safe to not assume opaqueness.
|
| @@ -1412,10 +1453,9 @@ bool LayoutBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c
|
| return false;
|
| if (hasClipPath())
|
| return false;
|
| - // FIXME: The background color clip is defined by the last layer.
|
| - if (style()->backgroundLayers().next())
|
| + if (style()->hasBlendMode())
|
| return false;
|
| - return backgroundClipRect().contains(localRect);
|
| + return opaqueBackgroundClipRect().contains(localRect);
|
| }
|
|
|
| static bool isCandidateForOpaquenessTest(const LayoutBox& childBox)
|
|
|