Remove the webkit prefix from CanvasRenderingContext2D imageSmoothingEnabled
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Aug 2015 11:15:01 +0000 (11:15 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Aug 2015 11:15:01 +0000 (11:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147803
<rdar://problem/22200553>

Reviewed by Sam Weinig.

Source/WebCore:

Rename webkitImageSmoothingEnabled to imageSmoothingEnabled.

Updated existing tests, and made sure that the prefixed version is
identical to the standard version.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::imageSmoothingEnabled): Renamed from webkitImageSmoothingEnabled.
(WebCore::CanvasRenderingContext2D::setImageSmoothingEnabled): Renamed from setWebkitImageSmoothingEnabled.
(WebCore::CanvasRenderingContext2D::webkitImageSmoothingEnabled): Deleted.
(WebCore::CanvasRenderingContext2D::setWebkitImageSmoothingEnabled): Deleted.
* html/canvas/CanvasRenderingContext2D.h: Rename the methods.
* html/canvas/CanvasRenderingContext2D.idl: Add the non-prefixed form, and mark is as the
implementation of the prefixed form.

LayoutTests:

Use the standard version of imageSmoothingEnabled rather than
the prefixed version.

* fast/canvas/canvas-imageSmoothingEnabled-expected.txt:
* fast/canvas/canvas-imageSmoothingEnabled-patterns.html:
* fast/canvas/canvas-imageSmoothingEnabled-zero-size.html:
* fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js:
(draw):
* fast/canvas/script-tests/canvas-imageSmoothingEnabled.js: Add some tests
to make sure the prefixed version correctly maps to the standard version.

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

LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-expected.txt
LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-patterns.html
LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-zero-size.html
LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js
LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled.js
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.idl

index d326868..ce65ca6 100644 (file)
@@ -1,3 +1,22 @@
+2015-08-08  Dean Jackson  <dino@apple.com>
+
+        Remove the webkit prefix from CanvasRenderingContext2D imageSmoothingEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=147803
+        <rdar://problem/22200553>
+
+        Reviewed by Sam Weinig.
+
+        Use the standard version of imageSmoothingEnabled rather than
+        the prefixed version.
+
+        * fast/canvas/canvas-imageSmoothingEnabled-expected.txt:
+        * fast/canvas/canvas-imageSmoothingEnabled-patterns.html:
+        * fast/canvas/canvas-imageSmoothingEnabled-zero-size.html:
+        * fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js:
+        (draw):
+        * fast/canvas/script-tests/canvas-imageSmoothingEnabled.js: Add some tests
+        to make sure the prefixed version correctly maps to the standard version.
+
 2015-08-08  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r179871.
index 3980b56..61dd02b 100644 (file)
@@ -4,11 +4,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 Test that the default value is true.
-PASS ctx.webkitImageSmoothingEnabled is true
+PASS ctx.imageSmoothingEnabled is true
 Test that false is returned after a the attribute is set to false.
-PASS ctx.webkitImageSmoothingEnabled is false
+PASS ctx.imageSmoothingEnabled is false
 Test that restore works. We save a false state; create, then save a true state; and then finally restore.
-PASS ctx.webkitImageSmoothingEnabled is false
+PASS ctx.imageSmoothingEnabled is false
 New canvas element created.
 Test that the image is smoothed by default. We check by making sure the pixel just to the left of the middle line is not completely black.
 PASS left_of_center_pixel.data[0] !== 0 is true
@@ -26,6 +26,15 @@ Test that restoring actually changes smoothing and not just the attribute value.
 PASS left_of_center_pixel.data[0] is 0
 PASS left_of_center_pixel.data[1] is 0
 PASS left_of_center_pixel.data[2] is 0
+Test that the prefixed attribute mirrors the unprefixed attribute.
+PASS ctx.imageSmoothingEnabled is false
+PASS ctx.webkitImageSmoothingEnabled is false
+PASS ctx.imageSmoothingEnabled is true
+PASS ctx.webkitImageSmoothingEnabled is true
+PASS ctx.imageSmoothingEnabled is false
+PASS ctx.webkitImageSmoothingEnabled is false
+PASS ctx.imageSmoothingEnabled is true
+PASS ctx.webkitImageSmoothingEnabled is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 8531d54..d5fcae1 100644 (file)
@@ -30,7 +30,7 @@
         var ctx = canvas.getContext('2d');
         var pattern = ctx.createPattern(image, "repeat");
         ctx.fillStyle = pattern;
-        ctx.webkitImageSmoothingEnabled = smoothing;
+        ctx.imageSmoothingEnabled = smoothing;
         ctx.scale(10, 10);
         ctx.fillRect(0, 0, canvas.width, canvas.height);
     }
@@ -39,7 +39,7 @@
         var ctx = canvas.getContext('2d');
         var pattern = ctx.createPattern(image, "repeat");
         ctx.fillStyle = pattern;
-        ctx.webkitImageSmoothingEnabled = smoothing;
+        ctx.imageSmoothingEnabled = smoothing;
         ctx.scale(10, 10);
         ctx.beginPath();
         ctx.moveTo(0,0);
@@ -53,7 +53,7 @@
         var pattern = ctx.createPattern(image, "repeat");
         ctx.strokeStyle = pattern;
         ctx.lineWidth = 5;
-        ctx.webkitImageSmoothingEnabled = smoothing;
+        ctx.imageSmoothingEnabled = smoothing;
         ctx.scale(10, 10);
         ctx.beginPath();
         ctx.moveTo(0,0);
index 84c120f..6fb5325 100644 (file)
@@ -8,11 +8,11 @@
         testRunner.dumpAsText();
     }
     window.onload = function () {
-       var canvas = document.createElement('canvas');
-               canvas.width = 0;
-               canvas.height = 0;
-               var context = canvas.getContext('2d');
-               if(context.webkitImageSmoothingEnabled) {context.webkitImageSmoothingEnabled = false;}
+        var canvas = document.createElement('canvas');
+        canvas.width = 0;
+        canvas.height = 0;
+        var context = canvas.getContext('2d');
+        if(context.imageSmoothingEnabled) {context.imageSmoothingEnabled = false;}
     };
     </script>
   </body>
index b7b0234..cf1ef38 100644 (file)
@@ -17,7 +17,7 @@ function draw()
     srcCtx.fillRect(0, 0, 1, 1);
     srcCtx.fillStyle = "rgb(0, 255, 0)";
     srcCtx.fillRect(1, 0, 1, 1);
-    dstCtx.webkitImageSmoothingEnabled = false;
+    dstCtx.imageSmoothingEnabled = false;
     dstCtx.drawImage(srcCanvas, 0, 0, 2, 1, 0, 0, 300, 300);
 }
 
index 996f782..c75b04f 100644 (file)
@@ -2,17 +2,17 @@ description("Tests for the imageSmoothingEnabled attribute.");
 var ctx = document.createElement('canvas').getContext('2d');
 
 debug("Test that the default value is true.");
-shouldBe("ctx.webkitImageSmoothingEnabled", "true");
+shouldBe("ctx.imageSmoothingEnabled", "true");
 
 debug("Test that false is returned after a the attribute is set to false.");
-ctx.webkitImageSmoothingEnabled = false;
-shouldBe("ctx.webkitImageSmoothingEnabled", "false");
+ctx.imageSmoothingEnabled = false;
+shouldBe("ctx.imageSmoothingEnabled", "false");
 
 debug("Test that restore works. We save a false state; create, then save a true state; and then finally restore.");
 ctx.save();
-ctx.webkitImageSmoothingEnabled = true;
+ctx.imageSmoothingEnabled = true;
 ctx.restore();
-shouldBe("ctx.webkitImageSmoothingEnabled", "false");
+shouldBe("ctx.imageSmoothingEnabled", "false");
 
 var image = document.createElement('canvas');
 image.width = 2;
@@ -49,7 +49,7 @@ shouldBe("left_of_center_pixel.data[0] !== 0", "true");
 shouldBe("left_of_center_pixel.data[1] !== 0", "true");
 shouldBe("left_of_center_pixel.data[2] !== 0", "true");
 
-ctx.webkitImageSmoothingEnabled = false;
+ctx.imageSmoothingEnabled = false;
 ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
 left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
 debug("Test that nearest neighbour is used when imageSmoothingEnabled is set to false. We check this by making sure the pixel just to the left of the middle line is completely black.");
@@ -57,7 +57,7 @@ shouldBe("left_of_center_pixel.data[0]", "0");
 shouldBe("left_of_center_pixel.data[1]", "0");
 shouldBe("left_of_center_pixel.data[2]", "0");
 
-ctx.webkitImageSmoothingEnabled = true;
+ctx.imageSmoothingEnabled = true;
 ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
 left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
 debug("Test that the image is smoothed when imageSmoothingEnabled is set to true.");
@@ -66,9 +66,9 @@ shouldBe("left_of_center_pixel.data[1] !== 0", "true");
 shouldBe("left_of_center_pixel.data[2] !== 0", "true");
 
 debug("Test that restoring actually changes smoothing and not just the attribute value. We are restoring to a point where imageSmoothingEnabled is set to false.");
-ctx.webkitImageSmoothingEnabled = false;
+ctx.imageSmoothingEnabled = false;
 ctx.save();
-ctx.webkitImageSmoothingEnabled = true;
+ctx.imageSmoothingEnabled = true;
 ctx.restore();
 ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
 left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
@@ -76,3 +76,16 @@ shouldBe("left_of_center_pixel.data[0]", "0");
 shouldBe("left_of_center_pixel.data[1]", "0");
 shouldBe("left_of_center_pixel.data[2]", "0");
 
+debug("Test that the prefixed attribute mirrors the unprefixed attribute.");
+ctx.imageSmoothingEnabled = false;
+shouldBe("ctx.imageSmoothingEnabled", "false");
+shouldBe("ctx.webkitImageSmoothingEnabled", "false");
+ctx.imageSmoothingEnabled = true;
+shouldBe("ctx.imageSmoothingEnabled", "true");
+shouldBe("ctx.webkitImageSmoothingEnabled", "true");
+ctx.webkitImageSmoothingEnabled = false;
+shouldBe("ctx.imageSmoothingEnabled", "false");
+shouldBe("ctx.webkitImageSmoothingEnabled", "false");
+ctx.webkitImageSmoothingEnabled = true;
+shouldBe("ctx.imageSmoothingEnabled", "true");
+shouldBe("ctx.webkitImageSmoothingEnabled", "true");
index 43c9fa5..fdaeeac 100644 (file)
@@ -1,3 +1,25 @@
+2015-08-08  Dean Jackson  <dino@apple.com>
+
+        Remove the webkit prefix from CanvasRenderingContext2D imageSmoothingEnabled
+        https://bugs.webkit.org/show_bug.cgi?id=147803
+        <rdar://problem/22200553>
+
+        Reviewed by Sam Weinig.
+
+        Rename webkitImageSmoothingEnabled to imageSmoothingEnabled.
+
+        Updated existing tests, and made sure that the prefixed version is
+        identical to the standard version.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::imageSmoothingEnabled): Renamed from webkitImageSmoothingEnabled.
+        (WebCore::CanvasRenderingContext2D::setImageSmoothingEnabled): Renamed from setWebkitImageSmoothingEnabled.
+        (WebCore::CanvasRenderingContext2D::webkitImageSmoothingEnabled): Deleted.
+        (WebCore::CanvasRenderingContext2D::setWebkitImageSmoothingEnabled): Deleted.
+        * html/canvas/CanvasRenderingContext2D.h: Rename the methods.
+        * html/canvas/CanvasRenderingContext2D.idl: Add the non-prefixed form, and mark is as the
+        implementation of the prefixed form.
+
 2015-08-09  Andreas Kling  <akling@apple.com>
 
         Ref-ify some functions that always succeed in constructing Documents.
index ceebe5c..767c62c 100644 (file)
@@ -2478,12 +2478,12 @@ PlatformLayer* CanvasRenderingContext2D::platformLayer() const
 }
 #endif
 
-bool CanvasRenderingContext2D::webkitImageSmoothingEnabled() const
+bool CanvasRenderingContext2D::imageSmoothingEnabled() const
 {
     return state().m_imageSmoothingEnabled;
 }
 
-void CanvasRenderingContext2D::setWebkitImageSmoothingEnabled(bool enabled)
+void CanvasRenderingContext2D::setImageSmoothingEnabled(bool enabled)
 {
     if (enabled == state().m_imageSmoothingEnabled)
         return;
index 92f0b3f..92a330c 100644 (file)
@@ -225,8 +225,8 @@ public:
     LineCap getLineCap() const { return state().m_lineCap; }
     LineJoin getLineJoin() const { return state().m_lineJoin; }
 
-    bool webkitImageSmoothingEnabled() const;
-    void setWebkitImageSmoothingEnabled(bool);
+    bool imageSmoothingEnabled() const;
+    void setImageSmoothingEnabled(bool);
 
 private:
     enum class Direction {
index 372209a..b2c032c 100644 (file)
@@ -186,6 +186,7 @@ interface CanvasRenderingContext2D : CanvasRenderingContext {
 
     readonly attribute float webkitBackingStorePixelRatio;
 
-    attribute boolean webkitImageSmoothingEnabled;
+    attribute boolean imageSmoothingEnabled;
+    [ImplementedAs=imageSmoothingEnabled] attribute boolean webkitImageSmoothingEnabled;
 };