Title: [127608] trunk
Revision
127608
Author
k...@webkit.org
Date
2012-09-05 10:48:19 -0700 (Wed, 05 Sep 2012)

Log Message

Use -webkit-clip-path shapes to clip HTML elements
https://bugs.webkit.org/show_bug.cgi?id=95646

Reviewed by Dean Jackson.

Source/WebCore:

-webkit-clip-path creates a new layer for HTML elements now. The border,
background and content gets clipped by the clip path after any filter was
applied.

Tests: css3/masking/clip-path-circle-filter.html
       css3/masking/clip-path-circle-overflow.html
       css3/masking/clip-path-circle-overflow-hidden.html
       css3/masking/clip-path-circle-relative-overflow.html
       css3/masking/clip-path-circle.html
       css3/masking/clip-path-ellipse.html
       css3/masking/clip-path-polygon-evenodd.html
       css3/masking/clip-path-polygon-nonzero.html
       css3/masking/clip-path-polygon.html
       css3/masking/clip-path-rectangle.html

* rendering/RenderBox.h: Create new layer on clip-path.
* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::requiresLayer): Create new layer on clip-path.
* rendering/RenderInline.h:
(WebCore::RenderInline::requiresLayer): Create new layer on clip-path.
* rendering/RenderLayer.cpp: Apply clip-path on context of object.
(WebCore::RenderLayer::paintLayerContents): Create new layer on clip-path.
* rendering/RenderObject.h:
(WebCore::RenderObject::hasClipPath): Indicates that renderer needs to be clipped by clip-path.
* rendering/RenderTableRow.h: Create new layer on clip-path.

LayoutTests:

Added new tests for the -webkit-clip-path property applied to HTML content.

* css3/masking/clip-path-circle-filter.html: Added.
* css3/masking/clip-path-circle-overflow.html: Added.
* css3/masking/clip-path-circle-relative-overflow.html: Added.
* css3/masking/clip-path-circle-overflow-hidden.html: Added.
* css3/masking/clip-path-circle.html: Added.
* css3/masking/clip-path-ellipse.html: Added.
* css3/masking/clip-path-polygon-evenodd.html: Added.
* css3/masking/clip-path-polygon-nonzero.html: Added.
* css3/masking/clip-path-polygon.html: Added.
* css3/masking/clip-path-rectangle.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/css3/masking/clip-path-circle-expected.png: Added.
* platform/mac/css3/masking/clip-path-circle-expected.txt: Added.
* platform/mac/css3/masking/clip-path-circle-filter-expected.png: Added.
* platform/mac/css3/masking/clip-path-circle-filter-expected.txt: Added.
* platform/mac/css3/masking/clip-path-circle-overflow-expected.png: Added.
* platform/mac/css3/masking/clip-path-circle-overflow-expected.txt: Added.
* platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.png: Added.
* platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.txt: Added.
* platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png: Added.
* platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.txt: Added.
* platform/mac/css3/masking/clip-path-ellipse-expected.png: Added.
* platform/mac/css3/masking/clip-path-ellipse-expected.txt: Added.
* platform/mac/css3/masking/clip-path-polygon-evenodd-expected.png: Added.
* platform/mac/css3/masking/clip-path-polygon-evenodd-expected.txt: Added.
* platform/mac/css3/masking/clip-path-polygon-expected.png: Added.
* platform/mac/css3/masking/clip-path-polygon-expected.txt: Added.
* platform/mac/css3/masking/clip-path-polygon-nonzero-expected.png: Added.
* platform/mac/css3/masking/clip-path-polygon-nonzero-expected.txt: Added.
* platform/mac/css3/masking/clip-path-rectangle-expected.png: Added.
* platform/mac/css3/masking/clip-path-rectangle-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127607 => 127608)


--- trunk/LayoutTests/ChangeLog	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/LayoutTests/ChangeLog	2012-09-05 17:48:19 UTC (rev 127608)
@@ -1,3 +1,46 @@
+2012-09-01  Dirk Schulze  <k...@webkit.org>
+
+        Use -webkit-clip-path shapes to clip HTML elements
+        https://bugs.webkit.org/show_bug.cgi?id=95646
+
+        Reviewed by Dean Jackson.
+
+        Added new tests for the -webkit-clip-path property applied to HTML content.
+
+        * css3/masking/clip-path-circle-filter.html: Added.
+        * css3/masking/clip-path-circle-overflow.html: Added.
+        * css3/masking/clip-path-circle-relative-overflow.html: Added.
+        * css3/masking/clip-path-circle-overflow-hidden.html: Added.
+        * css3/masking/clip-path-circle.html: Added.
+        * css3/masking/clip-path-ellipse.html: Added.
+        * css3/masking/clip-path-polygon-evenodd.html: Added.
+        * css3/masking/clip-path-polygon-nonzero.html: Added.
+        * css3/masking/clip-path-polygon.html: Added.
+        * css3/masking/clip-path-rectangle.html: Added.
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/css3/masking/clip-path-circle-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-circle-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-circle-filter-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-circle-filter-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-circle-overflow-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-circle-overflow-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-ellipse-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-ellipse-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-polygon-evenodd-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-polygon-evenodd-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-polygon-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-polygon-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-polygon-nonzero-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-polygon-nonzero-expected.txt: Added.
+        * platform/mac/css3/masking/clip-path-rectangle-expected.png: Added.
+        * platform/mac/css3/masking/clip-path-rectangle-expected.txt: Added.
+
 2012-09-05  Vincent Scheib  <sch...@chromium.org>
 
         webkitPointerLockElement returns null when pointer lock request is pending.

Added: trunk/LayoutTests/css3/masking/clip-path-circle-filter.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-circle-filter.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-circle-filter.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    -webkit-filter: blur(5px);
+    -webkit-clip-path: circle(100px, 100px, 90px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-circle-overflow-hidden.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-circle-overflow-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-circle-overflow-hidden.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <style>
+ .parent {
+ 	width: 200px;
+ 	height: 200px;
+ 	overflow: hidden;
+ 	-webkit-clip-path: circle(100px, 100px, 100px);
+ }
+ .child {
+ 	height: 400px;
+ 	width: 200px;
+ 	margin:0;
+ 	padding:0;
+ 	background-color: green;
+ }
+</style>
+</head>
+<body>
+<div class="parent">
+<div class="child"></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-circle-overflow.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-circle-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-circle-overflow.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    border: 20px solid black;
+    -webkit-clip-path: circle(130px, 130px, 130px);
+}
+</style>
+</head>
+<body>
+<div><div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-circle-relative-overflow.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    border: 20px solid black;
+    -webkit-clip-path: circle(50%, 50%, 50%);
+}
+</style>
+</head>
+<body>
+<div><div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-circle.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-circle.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-circle.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    -webkit-clip-path: circle(100px, 100px, 100px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-ellipse.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-ellipse.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-ellipse.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    -webkit-clip-path: ellipse(100px, 100px, 100px, 75px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-polygon-evenodd.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-polygon-evenodd.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-polygon-evenodd.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+
+    background-color: green;
+    -webkit-clip-path: polygon(evenodd, 10px 75px, 180px 180px, 100px 10px, 10px 180px, 180px 75px, 10px 75px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-polygon-nonzero.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-polygon-nonzero.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-polygon-nonzero.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    -webkit-clip-path: polygon(nonzero, 10px 75px, 180px 180px, 100px 10px, 10px 180px, 180px 75px, 10px 75px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-polygon.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-polygon.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-polygon.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 200px;
+    height: 200px;
+    background-color: green;
+    -webkit-clip-path: polygon(10px 75px, 180px 180px, 100px 10px, 10px 180px, 180px 75px, 10px 75px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/css3/masking/clip-path-rectangle.html (0 => 127608)


--- trunk/LayoutTests/css3/masking/clip-path-rectangle.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-rectangle.html	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+div {
+    width: 180px;
+    height: 180px;
+    background-color: green;
+    border: 10px solid black;
+    -webkit-clip-path: rectangle(0, 0, 200px, 200px, 100px, 100px);
+}
+</style>
+</head>
+<body>
+<div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (127607 => 127608)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-05 17:48:19 UTC (rev 127608)
@@ -3576,6 +3576,18 @@
 BUGWK80394 MAC WIN : fast/block/margin-collapse/025.html = TEXT
 BUGWK80394 MAC WIN : fast/block/margin-collapse/block-inside-inline/025.html = TEXT
 
+// Following tests need baselines on Mac, Win and Linux  
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-circle.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-ellipse.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-rectangle.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-polygon.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-polygon-evenodd.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-polygon-nonzero.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-circle-filter.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-circle-overflow.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-circle-relative-overflow.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 MAC WIN LINUX : css3/masking/clip-path-circle-overflow-hidden.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+
 // Does not yet support new web notifications TestRunner API
 BUGWK95506 SKIP : http/tests/notifications = PASS
 

Modified: trunk/LayoutTests/platform/efl/TestExpectations (127607 => 127608)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-09-05 17:48:19 UTC (rev 127608)
@@ -1079,6 +1079,18 @@
 // Started failing on JSC ports after r127202.
 BUGWK95530 : http/tests/security/inactive-document-with-empty-security-origin.html = TEXT
 
+// Following tests need baselines
+BUGWK95646 : css3/masking/clip-path-circle.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-ellipse.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-rectangle.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-polygon.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-polygon-evenodd.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-polygon-nonzero.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-filter.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-overflow.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-relative-overflow.html = MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-overflow-hidden.html = MISSING 
+
 // Fails after r127140.
 BUGWK95551 : fast/forms/datalist/input-appearance-range-with-datalist-rtl.html = IMAGE
 

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (127607 => 127608)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2012-09-05 17:48:19 UTC (rev 127608)
@@ -1300,6 +1300,18 @@
 
 BUGWK95825 : accessibility/canvas-description-and-role.html = TEXT
 
+// Following tests need baselines
+BUGWK95646 : css3/masking/clip-path-circle.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-ellipse.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-rectangle.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-polygon.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-polygon-evenodd.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-polygon-nonzero.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-filter.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-overflow.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-relative-overflow.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+BUGWK95646 : css3/masking/clip-path-circle-overflow-hidden.html = PASS IMAGE IMAGE+TEXT TEXT MISSING 
+
 //////////////////////////////////////////////////////////////////////////////////////////
 // End of Tests failing
 //////////////////////////////////////////////////////////////////////////////////////////

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-filter-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-filter-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-filter-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-filter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-filter-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x256
+  RenderBlock {HTML} at (0,0) size 800x256
+    RenderBody {BODY} at (8,8) size 784x240
+layer at (8,8) size 240x240
+  RenderBlock {DIV} at (0,0) size 240x240 [bgcolor=#008000] [border: (20px solid #000000)]
+layer at (28,28) size 240x240
+  RenderBlock {DIV} at (20,20) size 240x240 [border: (20px solid #000000)]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-overflow-hidden-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200 scrollHeight 400
+  RenderBlock {DIV} at (0,0) size 200x200
+    RenderBlock {DIV} at (0,0) size 200x400 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-circle-relative-overflow-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x256
+  RenderBlock {HTML} at (0,0) size 800x256
+    RenderBody {BODY} at (8,8) size 784x240
+layer at (8,8) size 240x240
+  RenderBlock {DIV} at (0,0) size 240x240 [bgcolor=#008000] [border: (20px solid #000000)]
+layer at (28,28) size 240x240
+  RenderBlock {DIV} at (20,20) size 240x240 [border: (20px solid #000000)]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-ellipse-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-ellipse-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-ellipse-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-ellipse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-ellipse-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-evenodd-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-evenodd-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-evenodd-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-evenodd-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-evenodd-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-nonzero-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-nonzero-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-nonzero-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-nonzero-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-polygon-nonzero-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-rectangle-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/masking/clip-path-rectangle-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/masking/clip-path-rectangle-expected.txt (0 => 127608)


--- trunk/LayoutTests/platform/mac/css3/masking/clip-path-rectangle-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/css3/masking/clip-path-rectangle-expected.txt	2012-09-05 17:48:19 UTC (rev 127608)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000] [border: (10px solid #000000)]

Modified: trunk/Source/WebCore/ChangeLog (127607 => 127608)


--- trunk/Source/WebCore/ChangeLog	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/ChangeLog	2012-09-05 17:48:19 UTC (rev 127608)
@@ -1,3 +1,36 @@
+2012-09-01  Dirk Schulze  <k...@webkit.org>
+
+        Use -webkit-clip-path shapes to clip HTML elements
+        https://bugs.webkit.org/show_bug.cgi?id=95646
+
+        Reviewed by Dean Jackson.
+
+        -webkit-clip-path creates a new layer for HTML elements now. The border,
+        background and content gets clipped by the clip path after any filter was
+        applied.
+
+        Tests: css3/masking/clip-path-circle-filter.html
+               css3/masking/clip-path-circle-overflow.html
+               css3/masking/clip-path-circle-overflow-hidden.html
+               css3/masking/clip-path-circle-relative-overflow.html
+               css3/masking/clip-path-circle.html
+               css3/masking/clip-path-ellipse.html
+               css3/masking/clip-path-polygon-evenodd.html
+               css3/masking/clip-path-polygon-nonzero.html
+               css3/masking/clip-path-polygon.html
+               css3/masking/clip-path-rectangle.html
+
+        * rendering/RenderBox.h: Create new layer on clip-path.
+        * rendering/RenderBoxModelObject.h:
+        (WebCore::RenderBoxModelObject::requiresLayer): Create new layer on clip-path.
+        * rendering/RenderInline.h:
+        (WebCore::RenderInline::requiresLayer): Create new layer on clip-path.
+        * rendering/RenderLayer.cpp: Apply clip-path on context of object.
+        (WebCore::RenderLayer::paintLayerContents): Create new layer on clip-path.
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::hasClipPath): Indicates that renderer needs to be clipped by clip-path.
+        * rendering/RenderTableRow.h: Create new layer on clip-path.
+
 2012-09-05  Kangil Han  <kangil....@samsung.com>
 
         [EFL] Use explicit constructor in RenderThemeEfl.

Modified: trunk/Source/WebCore/rendering/RenderBox.h (127607 => 127608)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-09-05 17:48:19 UTC (rev 127608)
@@ -44,7 +44,7 @@
 
     // hasAutoZIndex only returns true if the element is positioned or a flex-item since
     // position:static elements that are not flex-items get their z-index coerced to auto.
-    virtual bool requiresLayer() const OVERRIDE { return isRoot() || isPositioned() || createsGroup() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !style()->hasAutoZIndex(); }
+    virtual bool requiresLayer() const OVERRIDE { return isRoot() || isPositioned() || createsGroup() || hasClipPath() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !style()->hasAutoZIndex(); }
 
     // Use this with caution! No type checking is done!
     RenderBox* firstChildBox() const;

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (127607 => 127608)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-09-05 17:48:19 UTC (rev 127608)
@@ -87,7 +87,7 @@
     bool hasSelfPaintingLayer() const;
     RenderLayer* layer() const { return m_layer; }
 
-    virtual bool requiresLayer() const { return isRoot() || isPositioned() || createsGroup() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns(); }
+    virtual bool requiresLayer() const { return isRoot() || isPositioned() || createsGroup() || hasClipPath() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns(); }
 
     // This will work on inlines to return the bounding box of all of the lines' border boxes.
     virtual IntRect borderBoundingBox() const = 0;

Modified: trunk/Source/WebCore/rendering/RenderInline.h (127607 => 127608)


--- trunk/Source/WebCore/rendering/RenderInline.h	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2012-09-05 17:48:19 UTC (rev 127608)
@@ -124,7 +124,7 @@
 
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
 
-    virtual bool requiresLayer() const { return isInFlowPositioned() || createsGroup(); }
+    virtual bool requiresLayer() const { return isInFlowPositioned() || createsGroup() || hasClipPath(); }
 
     virtual LayoutUnit offsetLeft() const;
     virtual LayoutUnit offsetTop() const;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (127607 => 127608)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-09-05 17:48:19 UTC (rev 127608)
@@ -3123,6 +3123,18 @@
     // Ensure our lists are up-to-date.
     updateLayerListsIfNeeded();
 
+    // Apply clip-path to context.
+    RenderStyle* style = renderer()->style();
+    if (renderer()->hasClipPath() && !context->paintingDisabled() && style) {
+        if (BasicShape* clipShape = style->clipPath()) {
+            // FIXME: Investigate if it is better to store and update a Path object in RenderStyle.
+            // https://bugs.webkit.org/show_bug.cgi?id=95619
+            Path clipPath;
+            clipShape->path(clipPath, calculateLayerBounds(this, rootLayer, 0));
+            transparencyLayerContext->clipPath(clipPath, clipShape->windRule());
+        }
+    }
+
 #if ENABLE(CSS_FILTERS)
     FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilters());
     if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) {
@@ -4820,6 +4832,7 @@
                 || (renderer()->style()->specifiesColumns() && !isRootLayer()))
             && !renderer()->isPositioned()
             && !renderer()->hasTransform()
+            && !renderer()->hasClipPath()
 #if ENABLE(CSS_FILTERS)
             && !renderer()->hasFilter()
 #endif

Modified: trunk/Source/WebCore/rendering/RenderObject.h (127607 => 127608)


--- trunk/Source/WebCore/rendering/RenderObject.h	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2012-09-05 17:48:19 UTC (rev 127608)
@@ -559,6 +559,7 @@
 
     bool hasTransform() const { return m_bitfields.hasTransform(); }
     bool hasMask() const { return style() && style()->hasMask(); }
+    bool hasClipPath() const { return style() && style()->clipPath(); }
     bool hasHiddenBackface() const { return style() && style()->backfaceVisibility() == BackfaceVisibilityHidden; }
 
 #if ENABLE(CSS_FILTERS)

Modified: trunk/Source/WebCore/rendering/RenderTableRow.h (127607 => 127608)


--- trunk/Source/WebCore/rendering/RenderTableRow.h	2012-09-05 17:33:55 UTC (rev 127607)
+++ trunk/Source/WebCore/rendering/RenderTableRow.h	2012-09-05 17:48:19 UTC (rev 127608)
@@ -97,7 +97,7 @@
     virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
 
-    virtual bool requiresLayer() const OVERRIDE { return hasOverflowClip() || hasTransform() || hasHiddenBackface() || createsGroup(); }
+    virtual bool requiresLayer() const OVERRIDE { return hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasClipPath() || createsGroup(); }
 
     virtual void paint(PaintInfo&, const LayoutPoint&);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to