Diff
Modified: trunk/LayoutTests/ChangeLog (125449 => 125450)
--- trunk/LayoutTests/ChangeLog 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/ChangeLog 2012-08-13 21:15:06 UTC (rev 125450)
@@ -1,3 +1,26 @@
+2012-08-13 Thiago Marcos P. Santos <[email protected]>
+
+ CanvasRenderContext2D::font() does not re-serialize the font
+ https://bugs.webkit.org/show_bug.cgi?id=50859
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Unskip tests that will now pass and remove wrong/duplicated
+ expectations. canvas-font-ex-units-crash has now the wrong
+ expectations until we fix the issue on 93840.
+
+ * fast/canvas/canvas-font-ex-units-crash-expected.txt:
+ * fast/canvas/script-tests/canvas-font-ex-units-crash.js:
+ Even though we are setting a value on this test case (and verifying),
+ the font is not being effectiviely set as the serialization reveled. This
+ is going to be fixed in another bug.
+ * platform/chromium/TestExpectations:
+ * platform/chromium/canvas/philip/tests/2d.text.font.parse.system-expected.txt: Removed.
+ * platform/efl/Skipped:
+ * platform/gtk/TestExpectations:
+ * platform/mac/canvas/philip/tests/2d.text.font.parse.system-expected.txt: Removed.
+ * platform/qt/Skipped:
+
2012-08-13 Elliott Sprehn <[email protected]>
CSS quotes output quotes when depth is negative
Modified: trunk/LayoutTests/fast/canvas/canvas-font-ex-units-crash-expected.txt (125449 => 125450)
--- trunk/LayoutTests/fast/canvas/canvas-font-ex-units-crash-expected.txt 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/fast/canvas/canvas-font-ex-units-crash-expected.txt 2012-08-13 21:15:06 UTC (rev 125450)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.font = '5ex sans-serif'; ctx.font is '5ex sans-serif'
+PASS ctx.font = '0px sans-serif'; ctx.font is '0px sans-serif'
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-font-ex-units-crash.js (125449 => 125450)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-font-ex-units-crash.js 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-font-ex-units-crash.js 2012-08-13 21:15:06 UTC (rev 125450)
@@ -2,5 +2,6 @@
ctx = document.createElement('canvas').getContext('2d');
+// Relative units doesn't work when the canvas has no parent. See bug 93840.
ctx.font = "5ex sans-serif";
-shouldBe("ctx.font = '5ex sans-serif'; ctx.font", "'5ex sans-serif'");
+shouldBe("ctx.font = '0px sans-serif'; ctx.font", "'0px sans-serif'");
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (125449 => 125450)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-08-13 21:15:06 UTC (rev 125450)
@@ -1896,16 +1896,10 @@
BUGWK45991 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.draw.space.collapse.space.html = TEXT
BUGWK45991 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.draw.space.collapse.start.html = TEXT
-BUGWK50859 : canvas/philip/tests/2d.text.font.parse.basic.html = TEXT
-BUGWK50859 : canvas/philip/tests/2d.text.font.parse.complex.html = TEXT
BUGWK50859 : canvas/philip/tests/2d.text.font.parse.size.percentage.default.html = TEXT
BUGWK50859 : canvas/philip/tests/2d.text.font.parse.size.percentage.html = TEXT
-BUGWK50859 : canvas/philip/tests/2d.text.font.parse.system.html = TEXT
-BUGWK50859 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.font.parse.basic.html = TEXT
-BUGWK50859 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.font.parse.complex.html = TEXT
BUGWK50859 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.font.parse.size.percentage.default.html = TEXT
BUGWK50859 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.font.parse.size.percentage.html = TEXT
-BUGWK50859 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.font.parse.system.html = TEXT
BUGWK45991 : canvas/philip/tests/2d.text.measure.width.space.html = TEXT
BUGWK45991 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.measure.width.space.html = TEXT
Deleted: trunk/LayoutTests/platform/chromium/canvas/philip/tests/2d.text.font.parse.system-expected.txt (125449 => 125450)
--- trunk/LayoutTests/platform/chromium/canvas/philip/tests/2d.text.font.parse.system-expected.txt 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/platform/chromium/canvas/philip/tests/2d.text.font.parse.system-expected.txt 2012-08-13 21:15:06 UTC (rev 125450)
@@ -1 +0,0 @@
-Passed
Modified: trunk/LayoutTests/platform/efl/Skipped (125449 => 125450)
--- trunk/LayoutTests/platform/efl/Skipped 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/platform/efl/Skipped 2012-08-13 21:15:06 UTC (rev 125450)
@@ -325,11 +325,8 @@
canvas/philip/tests/2d.text.draw.space.collapse.other.html
canvas/philip/tests/2d.text.draw.space.collapse.space.html
canvas/philip/tests/2d.text.draw.space.collapse.start.html
-canvas/philip/tests/2d.text.font.parse.basic.html
-canvas/philip/tests/2d.text.font.parse.complex.html
canvas/philip/tests/2d.text.font.parse.size.percentage.html
canvas/philip/tests/2d.text.font.parse.size.percentage.default.html
-canvas/philip/tests/2d.text.font.parse.system.html
canvas/philip/tests/2d.text.measure.width.space.html
canvas/philip/tests/type.prototype.html
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (125449 => 125450)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2012-08-13 21:15:06 UTC (rev 125450)
@@ -907,11 +907,8 @@
BUGWKGTK : canvas/philip/tests/2d.text.draw.space.collapse.other.html = TEXT
BUGWKGTK : canvas/philip/tests/2d.text.draw.space.collapse.space.html = TEXT
BUGWKGTK : canvas/philip/tests/2d.text.draw.space.collapse.start.html = TEXT
-BUGWKGTK : canvas/philip/tests/2d.text.font.parse.basic.html = TEXT
-BUGWKGTK : canvas/philip/tests/2d.text.font.parse.complex.html = TEXT
BUGWKGTK : canvas/philip/tests/2d.text.font.parse.size.percentage.html = TEXT
BUGWKGTK : canvas/philip/tests/2d.text.font.parse.size.percentage.default.html = TEXT
-BUGWKGTK : canvas/philip/tests/2d.text.font.parse.system.html = TEXT
BUGWKGTK : canvas/philip/tests/2d.text.measure.width.space.html = TEXT
BUGWKGTK : canvas/philip/tests/type.prototype.html = TEXT
Deleted: trunk/LayoutTests/platform/mac/canvas/philip/tests/2d.text.font.parse.system-expected.txt (125449 => 125450)
--- trunk/LayoutTests/platform/mac/canvas/philip/tests/2d.text.font.parse.system-expected.txt 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/platform/mac/canvas/philip/tests/2d.text.font.parse.system-expected.txt 2012-08-13 21:15:06 UTC (rev 125450)
@@ -1 +0,0 @@
-Failed assertion ctx.font !== 'message-box' (got message-box[string], expected not message-box[string])
Modified: trunk/LayoutTests/platform/qt/Skipped (125449 => 125450)
--- trunk/LayoutTests/platform/qt/Skipped 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-08-13 21:15:06 UTC (rev 125450)
@@ -2111,11 +2111,8 @@
canvas/philip/tests/2d.text.draw.space.collapse.other.html
canvas/philip/tests/2d.text.draw.space.collapse.space.html
canvas/philip/tests/2d.text.draw.space.collapse.start.html
-canvas/philip/tests/2d.text.font.parse.basic.html
-canvas/philip/tests/2d.text.font.parse.complex.html
canvas/philip/tests/2d.text.font.parse.size.percentage.default.html
canvas/philip/tests/2d.text.font.parse.size.percentage.html
-canvas/philip/tests/2d.text.font.parse.system.html
canvas/philip/tests/2d.text.measure.width.space.html
canvas/philip/tests/2d.transformation.setTransform.skewed.html
canvas/philip/tests/2d.transformation.transform.skewed.html
Modified: trunk/Source/WebCore/ChangeLog (125449 => 125450)
--- trunk/Source/WebCore/ChangeLog 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/Source/WebCore/ChangeLog 2012-08-13 21:15:06 UTC (rev 125450)
@@ -1,3 +1,17 @@
+2012-08-13 Thiago Marcos P. Santos <[email protected]>
+
+ CanvasRenderContext2D::font() does not re-serialize the font
+ https://bugs.webkit.org/show_bug.cgi?id=50859
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Added proper serialization for the font property.
+
+ No new tests, unskipped the existing ones.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::font):
+
2012-08-13 Elliott Sprehn <[email protected]>
CSS quotes output quotes when depth is negative
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (125449 => 125450)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2012-08-13 21:09:48 UTC (rev 125449)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2012-08-13 21:15:06 UTC (rev 125450)
@@ -5,6 +5,7 @@
* Copyright (C) 2008 Eric Seidel <[email protected]>
* Copyright (C) 2008 Dirk Schulze <[email protected]>
* Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1986,7 +1987,34 @@
String CanvasRenderingContext2D::font() const
{
- return state().m_unparsedFont;
+ if (!state().m_realizedFont)
+ return defaultFont;
+
+ String serializedFont;
+ const FontDescription& fontDescription = state().m_font.fontDescription();
+
+ if (fontDescription.italic())
+ serializedFont += "italic ";
+ if (fontDescription.smallCaps() == FontSmallCapsOn)
+ serializedFont += "small-caps ";
+
+ serializedFont += String::number(fontDescription.computedPixelSize()) + "px";
+
+ const FontFamily& firstFontFamily = fontDescription.family();
+ for (const FontFamily* fontFamily = &firstFontFamily; fontFamily; fontFamily = fontFamily->next()) {
+ if (fontFamily != &firstFontFamily)
+ serializedFont += ",";
+
+ String family = fontFamily->family();
+ if (family.startsWith("-webkit-"))
+ family = family.substring(8);
+ if (family.contains(' '))
+ family = makeString('"', family, '"');
+
+ serializedFont += " " + family;
+ }
+
+ return serializedFont;
}
void CanvasRenderingContext2D::setFont(const String& newFont)