CanvasRenderContext2D::setFont() should ignore inherited properties and default keywo...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2012 23:59:34 +0000 (23:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2012 23:59:34 +0000 (23:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93491

Patch by Thiago Marcos P. Santos <thiago.santos@intel.com> on 2012-08-08
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Treat "inherit" as an invalid value. Also ignore the "default"
keyword that was previously treated as a font family. This second
change was done in the property validation and will also affect the
CSS font parsing, but it is probably harmless since font doesn't
recognize the default keyword anyway.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseFontFamily):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):

LayoutTests:

Unskipped tests that are now passing after this fix and removed wrong
expectations.

* platform/chromium/TestExpectations:
* platform/chromium/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt: Removed.
* platform/efl/Skipped:
* platform/gtk/TestExpectations:
* platform/mac/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt: Removed.
* platform/qt/Skipped:

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

LayoutTests/ChangeLog
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/chromium/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt [deleted file]
LayoutTests/platform/efl/Skipped
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt [deleted file]
LayoutTests/platform/qt/Skipped
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

index a2151c4..c0dca10 100644 (file)
@@ -1,3 +1,20 @@
+2012-08-08  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        CanvasRenderContext2D::setFont() should ignore inherited properties and default keyword value
+        https://bugs.webkit.org/show_bug.cgi?id=93491
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Unskipped tests that are now passing after this fix and removed wrong
+        expectations.
+
+        * platform/chromium/TestExpectations:
+        * platform/chromium/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt: Removed.
+        * platform/efl/Skipped:
+        * platform/gtk/TestExpectations:
+        * platform/mac/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt: Removed.
+        * platform/qt/Skipped:
+
 2012-08-08  Roger Fong  <roger_fong@apple.com>
 
         css3/calc/transitions-dependent.html was causing css3/calc/transitions.html to fail
index 47a88fe..23eda73 100644 (file)
@@ -1910,13 +1910,11 @@ BUGWK45991 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.text.draw.spac
 
 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.invalid.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.invalid.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
diff --git a/LayoutTests/platform/chromium/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt b/LayoutTests/platform/chromium/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt
deleted file mode 100644 (file)
index 863339f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Passed
index 92ba7e3..ddb91bd 100644 (file)
@@ -327,7 +327,6 @@ 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.invalid.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
index 8731641..fdf76d0 100644 (file)
@@ -900,7 +900,6 @@ 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.invalid.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
diff --git a/LayoutTests/platform/mac/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt b/LayoutTests/platform/mac/canvas/philip/tests/2d.text.font.parse.invalid-expected.txt
deleted file mode 100644 (file)
index be55f62..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Failed assertion ctx.font === '20px serif' (got inherit[string], expected 20px serif[string])
-Failed assertion ctx.font === '20px serif' (got 10px default[string], expected 20px serif[string])
index 6460573..c3815e0 100644 (file)
@@ -2115,7 +2115,6 @@ 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.invalid.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
index 1d1f69a..6b97299 100644 (file)
@@ -1,3 +1,21 @@
+2012-08-08  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        CanvasRenderContext2D::setFont() should ignore inherited properties and default keyword value
+        https://bugs.webkit.org/show_bug.cgi?id=93491
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Treat "inherit" as an invalid value. Also ignore the "default"
+        keyword that was previously treated as a font family. This second
+        change was done in the property validation and will also affect the
+        CSS font parsing, but it is probably harmless since font doesn't
+        recognize the default keyword anyway.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseFontFamily):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setFont):
+
 2012-08-08  James Robinson  <jamesr@chromium.org>
 
         [chromium] Add missing OVERRIDE and virtual annotations in compositor
index 3ea6447..695cd88 100644 (file)
@@ -4854,7 +4854,7 @@ PassRefPtr<CSSValueList> CSSParser::parseFontFamily()
     bool inFamily = false;
 
     while (value) {
-        if (value->id == CSSValueInitial || value->id == CSSValueInherit)
+        if (value->id == CSSValueInitial || value->id == CSSValueInherit || value->id == CSSValueDefault)
             return 0;
         CSSParserValue* nextValue = m_valueList->next();
         bool nextValBreaksFont = !nextValue ||
index aced0bd..722c9c5 100644 (file)
@@ -1996,6 +1996,10 @@ void CanvasRenderingContext2D::setFont(const String& newFont)
     if (parsedStyle->isEmpty())
         return;
 
+    RefPtr<CSSValue> fontValue = parsedStyle->getPropertyCSSValue(CSSPropertyFont);
+    if (fontValue && fontValue->isInheritedValue())
+        return;
+
     // The parse succeeded.
     realizeSaves();
     modifiableState().m_unparsedFont = newFont;