Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2620763005: Pad inval rects to compensate for Skia's hairline stroke
Patch Set: limit to composited bounds Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index e4f5b18fb2b1b60eda7d99c92ecdb7a84c2130cb..a5dd1ce1e0ac31893481e511c6fc8c90a607ec11 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -2734,6 +2734,19 @@ struct SetContentsNeedsDisplayInRectFunctor {
const DisplayItemClient& client;
};
+IntRect CompositedLayerMapping::adjustedInvalRect(const LayoutRect& r) const {
+ // Skia's hairline stroke may extend .5 units outside the computed path
+ // bounds. Pad defensively.
+ static constexpr float kInvalRectPadding = .5f;
+
+ LayoutRect adjustedRect(r);
+ adjustedRect.inflate(LayoutUnit(kInvalRectPadding));
+ adjustedRect.intersect(m_compositedBounds);
+ adjustedRect.move(m_owningLayer.subpixelAccumulation());
+
+ return enclosingIntRect(adjustedRect);
+}
+
void CompositedLayerMapping::setContentsNeedDisplayInRect(
const LayoutRect& r,
PaintInvalidationReason invalidationReason,
@@ -2743,10 +2756,8 @@ void CompositedLayerMapping::setContentsNeedDisplayInRect(
// spv2 is ready.
// ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
- SetContentsNeedsDisplayInRectFunctor functor = {
- enclosingIntRect(LayoutRect(
- r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
- invalidationReason, client};
+ SetContentsNeedsDisplayInRectFunctor functor = {adjustedInvalRect(r),
+ invalidationReason, client};
ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
}
@@ -2759,10 +2770,8 @@ void CompositedLayerMapping::setNonScrollingContentsNeedDisplayInRect(
// spv2 is ready.
// ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
- SetContentsNeedsDisplayInRectFunctor functor = {
- enclosingIntRect(LayoutRect(
- r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
- invalidationReason, client};
+ SetContentsNeedsDisplayInRectFunctor functor = {adjustedInvalRect(r),
+ invalidationReason, client};
ApplyToGraphicsLayers(this, functor, ApplyToNonScrollingContentLayers);
}
@@ -2775,10 +2784,8 @@ void CompositedLayerMapping::setScrollingContentsNeedDisplayInRect(
// spv2 is ready.
// ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
- SetContentsNeedsDisplayInRectFunctor functor = {
- enclosingIntRect(LayoutRect(
- r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
- invalidationReason, client};
+ SetContentsNeedsDisplayInRectFunctor functor = {adjustedInvalRect(r),
+ invalidationReason, client};
ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentLayers);
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698