Diff
Modified: trunk/LayoutTests/ChangeLog (119099 => 119100)
--- trunk/LayoutTests/ChangeLog 2012-05-31 14:08:10 UTC (rev 119099)
+++ trunk/LayoutTests/ChangeLog 2012-05-31 14:32:13 UTC (rev 119100)
@@ -1,3 +1,16 @@
+2012-05-31 Keyar Hood <[email protected]>
+
+ the imageSmoothingEnabled flag needs to be in the state object
+ https://bugs.webkit.org/show_bug.cgi?id=87853
+
+ Reviewed by Darin Adler.
+
+ Updated the test for imageSmoothingEnabled to test that it is saved in
+ the draw state.
+
+ * fast/canvas/canvas-imageSmoothingEnabled-expected.txt:
+ * fast/canvas/script-tests/canvas-imageSmoothingEnabled.js:
+
2012-05-31 Mikhail Pozdnyakov <[email protected]>
[EFL] Gardening after r118989
Modified: trunk/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-expected.txt (119099 => 119100)
--- trunk/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-expected.txt 2012-05-31 14:08:10 UTC (rev 119099)
+++ trunk/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-expected.txt 2012-05-31 14:32:13 UTC (rev 119100)
@@ -7,6 +7,8 @@
PASS ctx.webkitImageSmoothingEnabled is true
Test that false is returned after a the attribute is set to false.
PASS ctx.webkitImageSmoothingEnabled 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
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
@@ -20,6 +22,10 @@
PASS left_of_center_pixel.data[0] !== 0 is true
PASS left_of_center_pixel.data[1] !== 0 is true
PASS left_of_center_pixel.data[2] !== 0 is true
+Test that restoring actually changes smoothing and not just the attribute value. We are restoring to a point where imageSmoothingEnabled is set to false.
+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
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled.js (119099 => 119100)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled.js 2012-05-31 14:08:10 UTC (rev 119099)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled.js 2012-05-31 14:32:13 UTC (rev 119100)
@@ -8,6 +8,12 @@
ctx.webkitImageSmoothingEnabled = false;
shouldBe("ctx.webkitImageSmoothingEnabled", "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.restore();
+shouldBe("ctx.webkitImageSmoothingEnabled", "false");
+
var image = document.createElement('canvas');
image.width = 2;
image.height = 1;
@@ -59,3 +65,14 @@
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.save();
+ctx.webkitImageSmoothingEnabled = true;
+ctx.restore();
+ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
+left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
+shouldBe("left_of_center_pixel.data[0]", "0");
+shouldBe("left_of_center_pixel.data[1]", "0");
+shouldBe("left_of_center_pixel.data[2]", "0");
+
Modified: trunk/Source/WebCore/ChangeLog (119099 => 119100)
--- trunk/Source/WebCore/ChangeLog 2012-05-31 14:08:10 UTC (rev 119099)
+++ trunk/Source/WebCore/ChangeLog 2012-05-31 14:32:13 UTC (rev 119100)
@@ -1,3 +1,23 @@
+2012-05-31 Keyar Hood <[email protected]>
+
+ the imageSmoothingEnabled flag needs to be in the state object
+ https://bugs.webkit.org/show_bug.cgi?id=87853
+
+ Reviewed by Darin Adler.
+
+ Updated fast/canvas/canvas-imageSmoothingEnabled.html instead of
+ adding a new test.
+
+ The imageSmoothingEnabled flag is saved in the draw state now.
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
+ (WebCore::CanvasRenderingContext2D::State::State):
+ (WebCore::CanvasRenderingContext2D::State::operator=):
+ (WebCore::CanvasRenderingContext2D::webkitImageSmoothingEnabled):
+ (WebCore::CanvasRenderingContext2D::setWebkitImageSmoothingEnabled):
+ * html/canvas/CanvasRenderingContext2D.h:
+ (State):
+
2012-05-31 Eugene Klyuchnikov <[email protected]>
Web Inspector: Fix checkbox position on Settings screen.
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (119099 => 119100)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2012-05-31 14:08:10 UTC (rev 119099)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2012-05-31 14:32:13 UTC (rev 119100)
@@ -120,7 +120,6 @@
#if ENABLE(DASHBOARD_SUPPORT)
, m_usesDashboardCompatibilityMode(usesDashboardCompatibilityMode)
#endif
- , m_imageSmoothingEnabled(true)
{
#if !ENABLE(DASHBOARD_SUPPORT)
ASSERT_UNUSED(usesDashboardCompatibilityMode, !usesDashboardCompatibilityMode);
@@ -181,6 +180,7 @@
, m_globalComposite(CompositeSourceOver)
, m_invertibleCTM(true)
, m_lineDashOffset(0)
+ , m_imageSmoothingEnabled(true)
, m_textAlign(StartTextAlign)
, m_textBaseline(AlphabeticTextBaseline)
, m_unparsedFont(defaultFont)
@@ -206,6 +206,7 @@
, m_transform(other.m_transform)
, m_invertibleCTM(other.m_invertibleCTM)
, m_lineDashOffset(other.m_lineDashOffset)
+ , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled)
, m_textAlign(other.m_textAlign)
, m_textBaseline(other.m_textBaseline)
, m_unparsedFont(other.m_unparsedFont)
@@ -239,6 +240,7 @@
m_globalComposite = other.m_globalComposite;
m_transform = other.m_transform;
m_invertibleCTM = other.m_invertibleCTM;
+ m_imageSmoothingEnabled = other.m_imageSmoothingEnabled;
m_textAlign = other.m_textAlign;
m_textBaseline = other.m_textBaseline;
m_unparsedFont = other.m_unparsedFont;
@@ -2268,16 +2270,17 @@
bool CanvasRenderingContext2D::webkitImageSmoothingEnabled() const
{
- return m_imageSmoothingEnabled;
+ return state().m_imageSmoothingEnabled;
}
void CanvasRenderingContext2D::setWebkitImageSmoothingEnabled(bool enabled)
{
- if (enabled == m_imageSmoothingEnabled)
+ if (enabled == state().m_imageSmoothingEnabled)
return;
+ realizeSaves();
+ modifiableState().m_imageSmoothingEnabled = enabled;
drawingContext()->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone);
- m_imageSmoothingEnabled = enabled;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (119099 => 119100)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2012-05-31 14:08:10 UTC (rev 119099)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2012-05-31 14:32:13 UTC (rev 119100)
@@ -252,6 +252,7 @@
bool m_invertibleCTM;
DashArray m_lineDash;
float m_lineDashOffset;
+ bool m_imageSmoothingEnabled;
// Text state.
TextAlign m_textAlign;
@@ -336,7 +337,6 @@
#if ENABLE(DASHBOARD_SUPPORT)
bool m_usesDashboardCompatibilityMode;
#endif
- bool m_imageSmoothingEnabled;
};
} // namespace WebCore