| Index: Source/core/paint/BoxDecorationData.cpp
|
| diff --git a/Source/core/paint/BoxDecorationData.cpp b/Source/core/paint/BoxDecorationData.cpp
|
| index 370311d2ceaaa95fa07f7340222ffa3a7895e294..e73f50f779b47c10b5cbac9dbfe80d54903edd20 100644
|
| --- a/Source/core/paint/BoxDecorationData.cpp
|
| +++ b/Source/core/paint/BoxDecorationData.cpp
|
| @@ -24,31 +24,14 @@ BoxDecorationData::BoxDecorationData(const LayoutBox& layoutBox, GraphicsContext
|
| m_bleedAvoidance = determineBackgroundBleedAvoidance(layoutBox, context);
|
| }
|
|
|
| -BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(const LayoutBox& layoutBox, GraphicsContext* context)
|
| -{
|
| - if (layoutBox.isDocumentElement())
|
| - return BackgroundBleedNone;
|
| -
|
| - if (!hasBackground)
|
| - return BackgroundBleedNone;
|
| -
|
| - if (!hasBorder || !layoutBox.style()->hasBorderRadius() || layoutBox.canRenderBorderImage()) {
|
| - if (layoutBox.backgroundShouldAlwaysBeClipped())
|
| - return BackgroundBleedClipBackground;
|
| - return BackgroundBleedNone;
|
| - }
|
| -
|
| - // If display lists are enabled (via Slimming Paint), then simply clip the background and do not
|
| - // perform advanced bleed-avoidance heuristics. These heuristics are not correct in the presence
|
| - // of impl-side rasterization or layerization, since the actual pixel-relative scaling and rotation
|
| - // of the content is not known to Blink.
|
| - if (RuntimeEnabledFeatures::slimmingPaintEnabled())
|
| - return BackgroundBleedClipBackground;
|
| +namespace {
|
|
|
| +bool borderObscuresBackgroundEdge(const GraphicsContext& context, const ComputedStyle& style)
|
| +{
|
| // FIXME: See crbug.com/382491. getCTM does not accurately reflect the scale at the time content is
|
| // rasterized, and should not be relied on to make decisions about bleeding.
|
| - AffineTransform ctm = context->getCTM();
|
| - FloatSize contextScaling(static_cast<float>(ctm.xScale()), static_cast<float>(ctm.yScale()));
|
| + AffineTransform ctm = context.getCTM();
|
| + FloatSize contextScale(static_cast<float>(ctm.xScale()), static_cast<float>(ctm.yScale()));
|
|
|
| // Because RoundedRect uses IntRect internally the inset applied by the
|
| // BackgroundBleedShrinkBackground strategy cannot be less than one integer
|
| @@ -59,21 +42,11 @@ BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(co
|
| // coordinates.
|
| // This precaution will become obsolete if RoundedRect is ever promoted to
|
| // a sub-pixel representation.
|
| - if (contextScaling.width() > 1)
|
| - contextScaling.setWidth(1);
|
| - if (contextScaling.height() > 1)
|
| - contextScaling.setHeight(1);
|
| -
|
| - if (borderObscuresBackgroundEdge(*layoutBox.style(), contextScaling))
|
| - return BackgroundBleedShrinkBackground;
|
| - if (!hasAppearance && layoutBox.style()->borderObscuresBackground() && layoutBox.backgroundHasOpaqueTopLayer())
|
| - return BackgroundBleedBackgroundOverBorder;
|
| -
|
| - return BackgroundBleedClipBackground;
|
| -}
|
| + if (contextScale.width() > 1)
|
| + contextScale.setWidth(1);
|
| + if (contextScale.height() > 1)
|
| + contextScale.setHeight(1);
|
|
|
| -bool BoxDecorationData::borderObscuresBackgroundEdge(const ComputedStyle& style, const FloatSize& contextScale) const
|
| -{
|
| BorderEdge edges[4];
|
| style.getBorderEdgeInfo(edges);
|
|
|
| @@ -88,4 +61,33 @@ bool BoxDecorationData::borderObscuresBackgroundEdge(const ComputedStyle& style,
|
| return true;
|
| }
|
|
|
| +} // anonymous namespace
|
| +
|
| +BackgroundBleedAvoidance BoxDecorationData::determineBackgroundBleedAvoidance(const LayoutBox& layoutBox, GraphicsContext* context)
|
| +{
|
| + if (layoutBox.isDocumentElement())
|
| + return BackgroundBleedNone;
|
| +
|
| + if (!hasBackground)
|
| + return BackgroundBleedNone;
|
| +
|
| + if (!hasBorder || !layoutBox.style()->hasBorderRadius() || layoutBox.canRenderBorderImage()) {
|
| + if (layoutBox.backgroundShouldAlwaysBeClipped())
|
| + return BackgroundBleedClipBackground;
|
| + return BackgroundBleedNone;
|
| + }
|
| +
|
| + // If display lists are enabled (via Slimming Paint), then BackgroundBleedShrinkBackground is not
|
| + // usable as is relies on device-space heuristics. These heuristics are not correct in the presence
|
| + // of impl-side rasterization or layerization, since the actual pixel-relative scaling and rotation
|
| + // of the content is not known to Blink.
|
| + if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && borderObscuresBackgroundEdge(*context, *layoutBox.style()))
|
| + return BackgroundBleedShrinkBackground;
|
| +
|
| + if (!hasAppearance && layoutBox.style()->borderObscuresBackground() && layoutBox.backgroundHasOpaqueTopLayer())
|
| + return BackgroundBleedBackgroundOverBorder;
|
| +
|
| + return BackgroundBleedClipBackground;
|
| +}
|
| +
|
| } // namespace blink
|
|
|