Title: [125448] trunk
Revision
125448
Author
[email protected]
Date
2012-08-13 14:06:29 -0700 (Mon, 13 Aug 2012)

Log Message

CSS quotes output quotes when depth is negative
https://bugs.webkit.org/show_bug.cgi?id=92690

Patch by Elliott Sprehn <[email protected]> on 2012-08-13
Reviewed by Eric Seidel.

Source/WebCore:

Previously if the quote depth would go negative we would output the close quote from the
first pair of quotes again instead of outputting no quotes as required by the spec.

See: http://www.w3.org/TR/CSS21/generate.html#quotes-insert

Test: fast/css-generated-content/nested-quote-more-than-pairs.html

* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::originalText): Allow the value passed to getOpenQuote to go negative by removing std::max.
* rendering/style/QuotesData.cpp:
(WebCore::QuotesData::getOpenQuote): Bounds check for negative values for safety.
(WebCore::QuotesData::getCloseQuote): Allow index to be >= -1 and return an empty string for -1.

LayoutTests:

Make the expected output of close-quote-negative-depth.html follow the spec and
add another test that ensures the last quote pair is repeated when the depth is
greater than the number of quote pairs.

* fast/css-generated-content/close-quote-negative-depth-expected.html:
* fast/css-generated-content/close-quote-negative-depth.html:
* fast/css-generated-content/nested-quote-more-than-pairs-expected.html: Added.
* fast/css-generated-content/nested-quote-more-than-pairs.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125447 => 125448)


--- trunk/LayoutTests/ChangeLog	2012-08-13 21:01:48 UTC (rev 125447)
+++ trunk/LayoutTests/ChangeLog	2012-08-13 21:06:29 UTC (rev 125448)
@@ -1,3 +1,19 @@
+2012-08-13  Elliott Sprehn  <[email protected]>
+
+        CSS quotes output quotes when depth is negative
+        https://bugs.webkit.org/show_bug.cgi?id=92690
+
+        Reviewed by Eric Seidel.
+
+        Make the expected output of close-quote-negative-depth.html follow the spec and
+        add another test that ensures the last quote pair is repeated when the depth is
+        greater than the number of quote pairs.
+
+        * fast/css-generated-content/close-quote-negative-depth-expected.html:
+        * fast/css-generated-content/close-quote-negative-depth.html:
+        * fast/css-generated-content/nested-quote-more-than-pairs-expected.html: Added.
+        * fast/css-generated-content/nested-quote-more-than-pairs.html: Added.
+
 2012-08-13  Simon Hausmann  <[email protected]>
 
         Unreviewed skip: Skip faling test after r125428.

Modified: trunk/LayoutTests/fast/css-generated-content/close-quote-negative-depth-expected.html (125447 => 125448)


--- trunk/LayoutTests/fast/css-generated-content/close-quote-negative-depth-expected.html	2012-08-13 21:01:48 UTC (rev 125447)
+++ trunk/LayoutTests/fast/css-generated-content/close-quote-negative-depth-expected.html	2012-08-13 21:06:29 UTC (rev 125448)
@@ -1,5 +1,7 @@
 <!DOCTYPE html>
 
-There should be no quotes when the depth of the quote is negative, but this is currently broken. See WKBug 92690.
+<p>There should be no quotes when the depth of the quote is negative, and the depth
+should restart from 0 next. Should see the same line printed twice.</p>
 
-<q></q>
+ACDABAB<br>
+ACDABAB

Modified: trunk/LayoutTests/fast/css-generated-content/close-quote-negative-depth.html (125447 => 125448)


--- trunk/LayoutTests/fast/css-generated-content/close-quote-negative-depth.html	2012-08-13 21:01:48 UTC (rev 125447)
+++ trunk/LayoutTests/fast/css-generated-content/close-quote-negative-depth.html	2012-08-13 21:06:29 UTC (rev 125448)
@@ -1,11 +1,14 @@
 <!DOCTYPE html>
 
 <style type="text/css">
+    * { quotes: "A" "B" "C" "D"; }
     q:before {
-        content: close-quote;
+        content: close-quote open-quote open-quote close-quote no-close-quote open-quote close-quote close-quote open-quote;
     }
 </style>
 
-There should be no quotes when the depth of the quote is negative, but this is currently broken. See WKBug 92690.
+<p>There should be no quotes when the depth of the quote is negative, and the depth
+should restart from 0 next. Should see the same line printed twice.</p>
 
+ACDABAB<br>
 <q></q>

Added: trunk/LayoutTests/fast/css-generated-content/nested-quote-more-than-pairs-expected.html (0 => 125448)


--- trunk/LayoutTests/fast/css-generated-content/nested-quote-more-than-pairs-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/nested-quote-more-than-pairs-expected.html	2012-08-13 21:06:29 UTC (rev 125448)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+
+<p>
+    The last pair should be repeated when nested beyond the number of pairs. 
+    You should see the below line printed twice.
+</p>
+
+ACCCDDDB<br>
+ACCCDDDB

Added: trunk/LayoutTests/fast/css-generated-content/nested-quote-more-than-pairs.html (0 => 125448)


--- trunk/LayoutTests/fast/css-generated-content/nested-quote-more-than-pairs.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/nested-quote-more-than-pairs.html	2012-08-13 21:06:29 UTC (rev 125448)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+
+<style>
+    q { quotes: "A" "B" "C" "D"; }
+</style>
+
+<p>
+    The last pair should be repeated when nested beyond the number of pairs. 
+    You should see the below line printed twice.
+</p>
+
+ACCCDDDB<br>
+<q><q><q><q></q></q></q></q>

Modified: trunk/Source/WebCore/ChangeLog (125447 => 125448)


--- trunk/Source/WebCore/ChangeLog	2012-08-13 21:01:48 UTC (rev 125447)
+++ trunk/Source/WebCore/ChangeLog	2012-08-13 21:06:29 UTC (rev 125448)
@@ -1,3 +1,23 @@
+2012-08-13  Elliott Sprehn  <[email protected]>
+
+        CSS quotes output quotes when depth is negative
+        https://bugs.webkit.org/show_bug.cgi?id=92690
+
+        Reviewed by Eric Seidel.
+
+        Previously if the quote depth would go negative we would output the close quote from the
+        first pair of quotes again instead of outputting no quotes as required by the spec.
+ 
+        See: http://www.w3.org/TR/CSS21/generate.html#quotes-insert
+
+        Test: fast/css-generated-content/nested-quote-more-than-pairs.html
+
+        * rendering/RenderQuote.cpp:
+        (WebCore::RenderQuote::originalText): Allow the value passed to getOpenQuote to go negative by removing std::max.
+        * rendering/style/QuotesData.cpp:
+        (WebCore::QuotesData::getOpenQuote): Bounds check for negative values for safety.
+        (WebCore::QuotesData::getCloseQuote): Allow index to be >= -1 and return an empty string for -1.
+
 2012-08-13  Vangelis Kokkevis  <[email protected]>
 
         [chromium] Clear HUD canvas contents before drawing into it.

Modified: trunk/Source/WebCore/rendering/RenderQuote.cpp (125447 => 125448)


--- trunk/Source/WebCore/rendering/RenderQuote.cpp	2012-08-13 21:01:48 UTC (rev 125447)
+++ trunk/Source/WebCore/rendering/RenderQuote.cpp	2012-08-13 21:06:29 UTC (rev 125448)
@@ -77,8 +77,7 @@
     case NO_CLOSE_QUOTE:
         return StringImpl::empty();
     case CLOSE_QUOTE:
-        // FIXME: When m_depth is 0 we should return empty string.
-        return quotesData()->getCloseQuote(std::max(m_depth - 1, 0)).impl();
+        return quotesData()->getCloseQuote(m_depth - 1).impl();
     case OPEN_QUOTE:
         return quotesData()->getOpenQuote(m_depth).impl();
     }

Modified: trunk/Source/WebCore/rendering/style/QuotesData.cpp (125447 => 125448)


--- trunk/Source/WebCore/rendering/style/QuotesData.cpp	2012-08-13 21:01:48 UTC (rev 125447)
+++ trunk/Source/WebCore/rendering/style/QuotesData.cpp	2012-08-13 21:06:29 UTC (rev 125448)
@@ -47,7 +47,7 @@
 const String QuotesData::getOpenQuote(int index) const
 {
     ASSERT(index >= 0);
-    if (!m_quotePairs.size())
+    if (!m_quotePairs.size() || index < 0)
         return emptyString();
     if ((size_t)index >= m_quotePairs.size())
         return m_quotePairs.last().first;
@@ -56,8 +56,8 @@
 
 const String QuotesData::getCloseQuote(int index) const
 {
-    ASSERT(index >= 0);
-    if (!m_quotePairs.size())
+    ASSERT(index >= -1);
+    if (!m_quotePairs.size() || index < 0)
         return emptyString();
     if ((size_t)index >= m_quotePairs.size())
         return m_quotePairs.last().second;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to