<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174986] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174986">174986</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2014-10-21 10:32:09 -0700 (Tue, 21 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>REGRESSION: Google Search (mobile) video thumbnails are too large.
https://bugs.webkit.org/show_bug.cgi?id=137895
Reviewed by Simon Fraser.
This patch fixes layer clipping when an ancestor layer has border-radius clipping.
In cases, where the current layer has non-radius cliprect, while an ancestor layer
has border-radius clipping, we only use the border-radius rect to clip.
Source/WebCore:
Test: fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::clipToRect):
(WebCore::RenderLayer::restoreClip):
(WebCore::RenderLayer::collectFragments):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:
(WebCore::ClipRect::ClipRect):
(WebCore::ClipRect::effectedByRadius):
(WebCore::ClipRect::setEffectedByRadius):
(WebCore::ClipRect::operator==):
(WebCore::ClipRect::operator!=):
(WebCore::ClipRect::intersect):
(WebCore::ClipRect::hasRadius): Deleted.
(WebCore::ClipRect::setHasRadius): Deleted.
LayoutTests:
* fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent-expected.html: Added.
* fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastclipoverflowhiddenwithborderradiusoverflowclippingparentexpectedhtml">trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastclipoverflowhiddenwithborderradiusoverflowclippingparenthtml">trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174985 => 174986)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-10-21 17:19:49 UTC (rev 174985)
+++ trunk/LayoutTests/ChangeLog        2014-10-21 17:32:09 UTC (rev 174986)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-10-21 Zalan Bujtas <zalan@apple.com>
+
+ REGRESSION: Google Search (mobile) video thumbnails are too large.
+ https://bugs.webkit.org/show_bug.cgi?id=137895
+
+ Reviewed by Simon Fraser.
+
+ This patch fixes layer clipping when an ancestor layer has border-radius clipping.
+
+ In cases, where the current layer has non-radius cliprect, while an ancestor layer
+ has border-radius clipping, we only use the border-radius rect to clip.
+
+ * fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent-expected.html: Added.
+ * fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html: Added.
+
</ins><span class="cx"> 2014-10-21 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r170808): Volume slider in built-in media controls only changes volume when thumb is released, not while dragging
</span></span></pre></div>
<a id="trunkLayoutTestsfastclipoverflowhiddenwithborderradiusoverflowclippingparentexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent-expected.html (0 => 174986)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent-expected.html        2014-10-21 17:32:09 UTC (rev 174986)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that parent clipping is applied properly when ancestor border-radius is present.</title>
+<style>
+ .container {
+ overflow: hidden;
+ border-radius: 20px 0px 0px 0px;
+ height: 10px;
+ width: 10px;
+ }
+
+ .content {
+        width: 100px;
+        height: 100px;
+        background-color: red;
+ }
+</style>
+</head>
+<body>
+<div class=container>
+ <div class=content></div>
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastclipoverflowhiddenwithborderradiusoverflowclippingparenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html (0 => 174986)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html         (rev 0)
+++ trunk/LayoutTests/fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html        2014-10-21 17:32:09 UTC (rev 174986)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that parent clipping is applied properly when ancestor border-radius is present.</title>
+<style>
+ .outer {
+ overflow: hidden;
+ border-radius: 20px 0px 0px 0px;
+ }
+
+ .inner {
+ overflow: hidden;
+ position: relative;
+ height: 10px;
+ width: 10px;
+ }
+
+ .content {
+        width: 100px;
+        height: 100px;
+        background-color: red;
+ }
+</style>
+</head>
+<body>
+<div class=outer>
+ <div class=inner>
+ <div class=content></div>
+ </div>
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174985 => 174986)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-21 17:19:49 UTC (rev 174985)
+++ trunk/Source/WebCore/ChangeLog        2014-10-21 17:32:09 UTC (rev 174986)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-10-21 Zalan Bujtas <zalan@apple.com>
+
+ REGRESSION: Google Search (mobile) video thumbnails are too large.
+ https://bugs.webkit.org/show_bug.cgi?id=137895
+
+ Reviewed by Simon Fraser.
+
+ This patch fixes layer clipping when an ancestor layer has border-radius clipping.
+
+ In cases, where the current layer has non-radius cliprect, while an ancestor layer
+ has border-radius clipping, we only use the border-radius rect to clip.
+
+ Test: fast/clip/overflow-hidden-with-border-radius-overflow-clipping-parent.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::clipToRect):
+ (WebCore::RenderLayer::restoreClip):
+ (WebCore::RenderLayer::collectFragments):
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLayer.h:
+ (WebCore::ClipRect::ClipRect):
+ (WebCore::ClipRect::effectedByRadius):
+ (WebCore::ClipRect::setEffectedByRadius):
+ (WebCore::ClipRect::operator==):
+ (WebCore::ClipRect::operator!=):
+ (WebCore::ClipRect::intersect):
+ (WebCore::ClipRect::hasRadius): Deleted.
+ (WebCore::ClipRect::setHasRadius): Deleted.
+
</ins><span class="cx"> 2014-10-20 Michael Saboff <msaboff@apple.com>
</span><span class="cx">
</span><span class="cx"> Don't create cached functions for HTMLDocument.write*()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (174985 => 174986)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-10-21 17:19:49 UTC (rev 174985)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-10-21 17:32:09 UTC (rev 174986)
</span><span class="lines">@@ -3664,10 +3664,19 @@
</span><span class="cx">
</span><span class="cx"> void RenderLayer::clipToRect(const LayerPaintingInfo& paintingInfo, GraphicsContext* context, const ClipRect& clipRect, BorderRadiusClippingRule rule)
</span><span class="cx"> {
</span><ins>+ bool needsClipping = clipRect.rect() != paintingInfo.paintDirtyRect;
+ if (needsClipping || clipRect.affectedByRadius())
+ context->save();
+
</ins><span class="cx"> float deviceScaleFactor = renderer().document().deviceScaleFactor();
</span><del>- if (clipRect.hasRadius()) {
- context->save();
-
</del><ins>+ bool layerHasBorderRadius = renderer().style().hasBorderRadius();
+ if (needsClipping && !layerHasBorderRadius) {
+ LayoutRect adjustedClipRect = clipRect.rect();
+ adjustedClipRect.move(paintingInfo.subpixelAccumulation);
+ context->clip(snapRectToDevicePixels(adjustedClipRect, deviceScaleFactor));
+ }
+
+ if (clipRect.affectedByRadius()) {
</ins><span class="cx"> // If the clip rect has been tainted by a border radius, then we have to walk up our layer chain applying the clips from
</span><span class="cx"> // any layers with overflow. The condition for being able to apply these clips is that the overflow object be in our
</span><span class="cx"> // containing block chain so we check that also.
</span><span class="lines">@@ -3681,17 +3690,12 @@
</span><span class="cx"> if (layer == paintingInfo.rootLayer)
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- } else if (clipRect.rect() != paintingInfo.paintDirtyRect) {
- context->save();
- LayoutRect adjustedClipRect = clipRect.rect();
- adjustedClipRect.move(paintingInfo.subpixelAccumulation);
- context->clip(snapRectToDevicePixels(adjustedClipRect, deviceScaleFactor));
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderLayer::restoreClip(GraphicsContext* context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect)
</span><span class="cx"> {
</span><del>- if (clipRect.rect() != paintDirtyRect || clipRect.hasRadius())
</del><ins>+ if (clipRect.rect() != paintDirtyRect || clipRect.affectedByRadius())
</ins><span class="cx"> context->restore();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4397,10 +4401,10 @@
</span><span class="cx"> fragment.intersect(ancestorClipRect.rect());
</span><span class="cx">
</span><span class="cx"> // If the ancestor clip rect has border-radius, make sure to apply it to the fragments.
</span><del>- if (ancestorClipRect.hasRadius()) {
- fragment.foregroundRect.setHasRadius(true);
- fragment.backgroundRect.setHasRadius(true);
- fragment.outlineRect.setHasRadius(true);
</del><ins>+ if (ancestorClipRect.affectedByRadius()) {
+ fragment.foregroundRect.setAffectedByRadius(true);
+ fragment.backgroundRect.setAffectedByRadius(true);
+ fragment.outlineRect.setAffectedByRadius(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Now intersect with our pagination clip. This will typically mean we're just intersecting the dirty rect with the column
</span><span class="lines">@@ -5304,7 +5308,7 @@
</span><span class="cx">
</span><span class="cx"> if (renderer().hasOverflowClip()) {
</span><span class="cx"> ClipRect newOverflowClip = downcast<RenderBox>(renderer()).overflowClipRectForChildLayers(offset, currentRenderNamedFlowFragment(), clipRectsContext.overlayScrollbarSizeRelevancy);
</span><del>- newOverflowClip.setHasRadius(renderer().style().hasBorderRadius());
</del><ins>+ newOverflowClip.setAffectedByRadius(renderer().style().hasBorderRadius());
</ins><span class="cx"> clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
</span><span class="cx"> if (renderer().isPositioned())
</span><span class="cx"> clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
</span><span class="lines">@@ -5429,7 +5433,7 @@
</span><span class="cx"> if (renderer().hasOverflowClip() && (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)) {
</span><span class="cx"> foregroundRect.intersect(downcast<RenderBox>(renderer()).overflowClipRect(toLayoutPoint(offsetFromRootLocal), namedFlowFragment, clipRectsContext.overlayScrollbarSizeRelevancy));
</span><span class="cx"> if (renderer().style().hasBorderRadius())
</span><del>- foregroundRect.setHasRadius(true);
</del><ins>+ foregroundRect.setAffectedByRadius(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (renderer().hasClip()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (174985 => 174986)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2014-10-21 17:19:49 UTC (rev 174985)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2014-10-21 17:32:09 UTC (rev 174986)
</span><span class="lines">@@ -84,30 +84,32 @@
</span><span class="cx"> class ClipRect {
</span><span class="cx"> public:
</span><span class="cx"> ClipRect()
</span><del>- : m_hasRadius(false)
- { }
</del><ins>+ : m_affectedByRadius(false)
+ {
+ }
</ins><span class="cx">
</span><span class="cx"> ClipRect(const LayoutRect& rect)
</span><del>- : m_rect(rect)
- , m_hasRadius(false)
- { }
</del><ins>+ : m_rect(rect)
+ , m_affectedByRadius(false)
+ {
+ }
</ins><span class="cx">
</span><span class="cx"> const LayoutRect& rect() const { return m_rect; }
</span><span class="cx"> void setRect(const LayoutRect& rect) { m_rect = rect; }
</span><span class="cx">
</span><del>- bool hasRadius() const { return m_hasRadius; }
- void setHasRadius(bool hasRadius) { m_hasRadius = hasRadius; }
</del><ins>+ bool affectedByRadius() const { return m_affectedByRadius; }
+ void setAffectedByRadius(bool affectedByRadius) { m_affectedByRadius = affectedByRadius; }
</ins><span class="cx">
</span><del>- bool operator==(const ClipRect& other) const { return rect() == other.rect() && hasRadius() == other.hasRadius(); }
- bool operator!=(const ClipRect& other) const { return rect() != other.rect() || hasRadius() != other.hasRadius(); }
</del><ins>+ bool operator==(const ClipRect& other) const { return rect() == other.rect() && affectedByRadius() == other.affectedByRadius(); }
+ bool operator!=(const ClipRect& other) const { return rect() != other.rect() || affectedByRadius() != other.affectedByRadius(); }
</ins><span class="cx"> bool operator!=(const LayoutRect& otherRect) const { return rect() != otherRect; }
</span><span class="cx">
</span><span class="cx"> void intersect(const LayoutRect& other) { m_rect.intersect(other); }
</span><span class="cx"> void intersect(const ClipRect& other)
</span><span class="cx"> {
</span><span class="cx"> m_rect.intersect(other.rect());
</span><del>- if (other.hasRadius())
- m_hasRadius = true;
</del><ins>+ if (other.affectedByRadius())
+ m_affectedByRadius = true;
</ins><span class="cx"> }
</span><span class="cx"> void move(LayoutUnit x, LayoutUnit y) { m_rect.move(x, y); }
</span><span class="cx"> void move(const LayoutSize& size) { m_rect.move(size); }
</span><span class="lines">@@ -123,7 +125,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> LayoutRect m_rect;
</span><del>- bool m_hasRadius;
</del><ins>+ bool m_affectedByRadius;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline ClipRect intersection(const ClipRect& a, const ClipRect& b)
</span></span></pre>
</div>
</div>
</body>
</html>