Regression(r175381): -webkit-mask-box-image is broken
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 19:01:46 +0000 (19:01 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 19:01:46 +0000 (19:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138969
<rdar://problem/19054471>

Reviewed by Simon Fraser.

Source/WebCore:

After r175381, the StyleBuilder would call NinePieceImage::setMaskDefaults()
*after* calling CSSToStyleMap::mapNinePieceImage(), instead of *before*, for
-webkit-mask-box-image CSS property. This was causing the mask defaults to
overwrite what was set by mapNinePieceImage().

Test: fast/css/webkit-mask-box-image.html

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertBorderMask):

LayoutTests:

Add a layout test to add basic coverage for -webkit-mask-box-image
CSS property.

* fast/css/resources/mask.png: Added.
* fast/css/webkit-mask-box-image.html: Added.
* fast/css/webkit-mask-box-image-expected.html: Added

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176455 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/resources/mask.png [new file with mode: 0644]
LayoutTests/fast/css/webkit-mask-box-image-expected.html [new file with mode: 0644]
LayoutTests/fast/css/webkit-mask-box-image.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleBuilderConverter.h

index 0116e0c..f9634d6 100644 (file)
@@ -1,5 +1,20 @@
 2014-11-21  Chris Dumez  <cdumez@apple.com>
 
+        Regression(r175381): -webkit-mask-box-image is broken
+        https://bugs.webkit.org/show_bug.cgi?id=138969
+        <rdar://problem/19054471>
+
+        Reviewed by Simon Fraser.
+
+        Add a layout test to add basic coverage for -webkit-mask-box-image
+        CSS property.
+
+        * fast/css/resources/mask.png: Added.
+        * fast/css/webkit-mask-box-image.html: Added.
+        * fast/css/webkit-mask-box-image-expected.html: Added
+
+2014-11-21  Chris Dumez  <cdumez@apple.com>
+
         Crash when setting 'font' CSS property to 'calc(2 * 3)'
         https://bugs.webkit.org/show_bug.cgi?id=138933
 
diff --git a/LayoutTests/fast/css/resources/mask.png b/LayoutTests/fast/css/resources/mask.png
new file mode 100644 (file)
index 0000000..119bb6e
Binary files /dev/null and b/LayoutTests/fast/css/resources/mask.png differ
diff --git a/LayoutTests/fast/css/webkit-mask-box-image-expected.html b/LayoutTests/fast/css/webkit-mask-box-image-expected.html
new file mode 100644 (file)
index 0000000..e2a99a6
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.rect {
+  background-color: grey;
+  width: 190px;
+  height: 40px;
+  position: absolute;
+  top: 55px;
+  left: 55px;
+}
+</style>
+</head>
+<body>
+<p>This should be a grey rectangle.</p>
+
+<div class="rect"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/css/webkit-mask-box-image.html b/LayoutTests/fast/css/webkit-mask-box-image.html
new file mode 100644 (file)
index 0000000..f4ad9e7
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.mask {
+  -webkit-mask-box-image: url('resources/mask.png') 5 5 5 5;
+  background-color: grey;
+  width: 200px;
+  height: 50px;
+  position: absolute;
+  top: 50px;
+  left: 50px;
+  /*
+   * Clip 5px on each side to keep only the area not
+   * affected by the mask.
+   */
+  clip: rect(5px, 195px, 45px, 5px);
+}
+</style>
+</head>
+<body>
+<p>This should be a grey rectangle.</p>
+
+<div class="mask"></div>
+</body>
+</html>
index 742daf4..e192d48 100644 (file)
@@ -1,5 +1,23 @@
 2014-11-21  Chris Dumez  <cdumez@apple.com>
 
+        Regression(r175381): -webkit-mask-box-image is broken
+        https://bugs.webkit.org/show_bug.cgi?id=138969
+        <rdar://problem/19054471>
+
+        Reviewed by Simon Fraser.
+
+        After r175381, the StyleBuilder would call NinePieceImage::setMaskDefaults()
+        *after* calling CSSToStyleMap::mapNinePieceImage(), instead of *before*, for
+        -webkit-mask-box-image CSS property. This was causing the mask defaults to
+        overwrite what was set by mapNinePieceImage().
+
+        Test: fast/css/webkit-mask-box-image.html
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertBorderMask):
+
+2014-11-21  Chris Dumez  <cdumez@apple.com>
+
         Crash when setting 'font' CSS property to 'calc(2 * 3)'
         https://bugs.webkit.org/show_bug.cgi?id=138933
 
index 30898fc..d5658c4 100644 (file)
@@ -249,8 +249,9 @@ inline NinePieceImage StyleBuilderConverter::convertBorderImage(StyleResolver& s
 template <CSSPropertyID property>
 inline NinePieceImage StyleBuilderConverter::convertBorderMask(StyleResolver& styleResolver, CSSValue& value)
 {
-    NinePieceImage image = convertBorderImage<property>(styleResolver, value);
+    NinePieceImage image;
     image.setMaskDefaults();
+    styleResolver.styleMap()->mapNinePieceImage(property, &value, image);
     return image;
 }