Skip to content
Permalink
Browse files
Subpixel rendering: RenderLayer's clipping should snap to device pixe…
…l boundaries.

https://bugs.webkit.org/show_bug.cgi?id=131466

Reviewed by Simon Fraser.

Fractional pixel clipping can produce cruft on RenderLayers. Since RenderLayer
sizing and painting are snapped, painting clip rect needs to be snapped the same way.

Source/WebCore:
Test: fast/clip/clip-when-rect-has-fractional-pixel-value.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clipToRect):

LayoutTests:
* fast/clip/clip-when-rect-has-fractional-pixel-value-expected.html: Added.
* fast/clip/clip-when-rect-has-fractional-pixel-value.html: Added.


Canonical link: https://commits.webkit.org/149982@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbaradlay committed Apr 20, 2014
1 parent bd46a9a commit d1ab07182011638c64a3b2458ec70250d368ab6f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
@@ -1,3 +1,16 @@
2014-04-19 Zalan Bujtas <zalan@apple.com>

Subpixel rendering: RenderLayer's clipping should snap to device pixel boundaries.
https://bugs.webkit.org/show_bug.cgi?id=131466

Reviewed by Simon Fraser.

Fractional pixel clipping can produce cruft on RenderLayers. Since RenderLayer
sizing and painting are snapped, painting clip rect needs to be snapped the same way.

* fast/clip/clip-when-rect-has-fractional-pixel-value-expected.html: Added.
* fast/clip/clip-when-rect-has-fractional-pixel-value.html: Added.

2014-04-19 Chris Fleizach <cfleizach@apple.com>

AX: grid rows are not recognized do to lack of explicit role="row", role="gridcell"
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>This tests that clipping a block element does not leave cruft behind.</title>
<style>
div {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 72px;
background-color: yellow;
-webkit-transform: translateZ(0);
}
</style>
</head>
<body>
<div></div>
</body>
@@ -0,0 +1,21 @@
<html>
<head>
<title>This tests that clipping a block element does not leave cruft behind.</title>
<style>
div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
clip: rect(0, 100, 6.5em, 0);
font-size: 11px;
background-color: yellow;
-webkit-transform: translateZ(0);
}
</style>
</head>
<body>
<div></div>
</body>

@@ -1,3 +1,18 @@
2014-04-19 Zalan Bujtas <zalan@apple.com>

Subpixel rendering: RenderLayer's clipping should snap to device pixel boundaries.
https://bugs.webkit.org/show_bug.cgi?id=131466

Reviewed by Simon Fraser.

Fractional pixel clipping can produce cruft on RenderLayers. Since RenderLayer
sizing and painting are snapped, painting clip rect needs to be snapped the same way.

Test: fast/clip/clip-when-rect-has-fractional-pixel-value.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clipToRect):

2014-04-19 Brent Fulgham <bfulgham@apple.com>

Latched scrolling may interact badly with custom programmatic scrolling
@@ -3630,9 +3630,10 @@ static bool inContainingBlockChain(RenderLayer* startLayer, RenderLayer* endLaye
void RenderLayer::clipToRect(RenderLayer* rootLayer, GraphicsContext* context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect,
BorderRadiusClippingRule rule)
{
float deviceScaleFactor = renderer().document().deviceScaleFactor();
if (clipRect.rect() != paintDirtyRect || clipRect.hasRadius()) {
context->save();
context->clip(clipRect.rect());
context->clip(pixelSnappedForPainting(clipRect.rect(), deviceScaleFactor));
}

if (!clipRect.hasRadius())
@@ -3645,7 +3646,7 @@ void RenderLayer::clipToRect(RenderLayer* rootLayer, GraphicsContext* context, c
if (layer->renderer().hasOverflowClip() && layer->renderer().style().hasBorderRadius() && inContainingBlockChain(this, layer)) {
LayoutPoint delta;
layer->convertToLayerCoords(rootLayer, delta);
context->clipRoundedRect(FloatRoundedRect(layer->renderer().style().getRoundedInnerBorderFor(LayoutRect(delta, layer->size()))));
context->clipRoundedRect(layer->renderer().style().getRoundedInnerBorderFor(LayoutRect(delta, layer->size())).pixelSnappedRoundedRectForPainting(deviceScaleFactor));
}

if (layer == rootLayer)

0 comments on commit d1ab071

Please sign in to comment.