Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp |
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
index 227d0f12e1d8f04b964c54243687efaddc5c82c5..a8621108df516216ef516f5ee7d0c46c66080ae3 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -1268,12 +1268,30 @@ bool ComputedStyle::hasEntirelyLocalBackground() const |
for (; layer; layer = layer->next()) { |
if (layer->attachment() == LocalBackgroundAttachment) |
continue; |
- // Solid color layers with a background clip of the padding box can be treated |
+ // Solid color layers with an effective background clip of the padding box can be treated |
// as local. |
- // TODO(flackr): We can handle other fill boxes with solid colors as long as they |
- // are essentially the same (i.e. PaddingFillBox == ContentFillBox when padding = 0). |
- if (!layer->image() && !layer->next() && layer->clip() == PaddingFillBox) |
- continue; |
+ if (!layer->image() && !layer->next()) { |
+ EFillBox clip = layer->clip(); |
+ if (clip == PaddingFillBox) |
+ continue; |
+ // A border box can be treated as a padding box if the border is opaque or there is |
+ // no border. |
+ if (clip == BorderFillBox |
+ && (borderTopWidth() == 0 || !visitedDependentColor(CSSPropertyBorderTopColor).hasAlpha()) |
+ && (borderLeftWidth() == 0 || !visitedDependentColor(CSSPropertyBorderLeftColor).hasAlpha()) |
+ && (borderRightWidth() == 0 || !visitedDependentColor(CSSPropertyBorderRightColor).hasAlpha()) |
+ && (borderBottomWidth() == 0 || !visitedDependentColor(CSSPropertyBorderBottomColor).hasAlpha())) { |
+ continue; |
+ } |
+ // A content fill box can be treated as a padding fill box if there is no padding. |
+ if (clip == ContentFillBox |
+ && paddingTop().isZero() |
+ && paddingLeft().isZero() |
+ && paddingRight().isZero() |
+ && paddingBottom().isZero()) { |
+ continue; |
+ } |
+ } |
return false; |
} |
return true; |