Title: [102290] trunk
- Revision
- 102290
- Author
- [email protected]
- Date
- 2011-12-07 17:44:52 -0800 (Wed, 07 Dec 2011)
Log Message
<li value="0"> behaves like <li> (the same for negative numbers)
https://bugs.webkit.org/show_bug.cgi?id=73911
Patch by Florin Malita <[email protected]> on 2011-12-07
Reviewed by Alexey Proskuryakov.
Source/WebCore:
Allow LI values <= 0 and consolidate the value processing logic.
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::parseMappedAttribute):
Delegated value parsing to parseValue().
(WebCore::HTMLLIElement::attach):
Ditto. Explicit value null testing is no longer necessary,
as parseValue's toInt() performs an equivalent check.
(WebCore::HTMLLIElement::parseValue):
Consolidated value parsing logic.
* html/HTMLLIElement.h:
LayoutTests:
Added tests for values <= 0.
* fast/lists/li-values-expected.txt:
* fast/lists/li-values.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (102289 => 102290)
--- trunk/LayoutTests/ChangeLog 2011-12-08 01:33:29 UTC (rev 102289)
+++ trunk/LayoutTests/ChangeLog 2011-12-08 01:44:52 UTC (rev 102290)
@@ -1,3 +1,15 @@
+2011-12-07 Florin Malita <[email protected]>
+
+ <li value="0"> behaves like <li> (the same for negative numbers)
+ https://bugs.webkit.org/show_bug.cgi?id=73911
+
+ Reviewed by Alexey Proskuryakov.
+
+ Added tests for values <= 0.
+
+ * fast/lists/li-values-expected.txt:
+ * fast/lists/li-values.html:
+
2011-12-07 Kentaro Hara <[email protected]>
REGRESSION (r95249): Right side can be truncated when printing
Modified: trunk/LayoutTests/fast/lists/li-values-expected.txt (102289 => 102290)
--- trunk/LayoutTests/fast/lists/li-values-expected.txt 2011-12-08 01:33:29 UTC (rev 102289)
+++ trunk/LayoutTests/fast/lists/li-values-expected.txt 2011-12-08 01:44:52 UTC (rev 102290)
@@ -1,4 +1,22 @@
1 The list marker should show 1 because this item had a value of 4 but it was removed.
-2 The list marker should show 2 even though this item has a value of 0.
-3 The list marker should show 3 even though this item has a value of -1.
+-1 The list marker should show -1 (negative values are allowed).
+0 The list marker should show 0.
+1 The list marker should show 1 (invalid values are ignored).
+-5 The list marker should show -5 (updated programmatically).
+-1 The list marker should fall back to decimal -1 (hebrew: 1-infinite).
+0 The list marker should fall back to decimal 0 (simple-upper-roman: 1-4999).
+0 The list marker should fall back to decimal 0 (simple-lower-roman: 1-4999).
+0 The list marker should fall back to decimal 0 (upper-roman: 1-4999).
+0 The list marker should fall back to decimal 0 (lower-roman: 1-4999).
+0 The list marker should fall back to decimal 0 (lower-armenian: 1-9999).
+0 The list marker should fall back to decimal 0 (upper-armenian: 1-9999).
+0 The list marker should fall back to decimal 0 (armenian: 1-9999).
+0 The list marker should fall back to decimal 0 (georgian: 1-19999).
+0 The list marker should fall back to decimal 0 (ancient-tamil: 1-9999).
+-1 The list marker should fall back to cjk-decimal -1 (japanese-informal: 0-9999).
+-1 The list marker should fall back to cjk-decimal -1 (japanese-formal: 0-9999).
+-1 The list marker should fall back to decimal -1 (korean-hangul-formal: 0-9999).
+-1 The list marker should fall back to decimal -1 (korean-hanja-informal: 0-9999).
+-1 The list marker should fall back to decimal -1 (korean-hanja-formal: 0-9999).
+0 The list marker should fall back to decimal 0 (greek: 1-999).
Modified: trunk/LayoutTests/fast/lists/li-values.html (102289 => 102290)
--- trunk/LayoutTests/fast/lists/li-values.html 2011-12-08 01:33:29 UTC (rev 102289)
+++ trunk/LayoutTests/fast/lists/li-values.html 2011-12-08 01:44:52 UTC (rev 102290)
@@ -4,6 +4,7 @@
function finishTest()
{
document.getElementById("removeMyValue").removeAttribute("value");
+ document.getElementById("changeMyValue").setAttribute("value", "-5");
filterListsWithReplacement(document.querySelectorAll("ol"));
if (window.layoutTestController)
layoutTestController.notifyDone();
@@ -23,7 +24,29 @@
<body _onload_="init()">
<ol>
<li value="4" id="removeMyValue">The list marker should show 1 because this item had a value of 4 but it was removed.</li>
- <li value="0">The list marker should show 2 even though this item has a value of 0.</li>
- <li value="-1">The list marker should show 3 even though this item has a value of -1.</li>
+ <li value="-1">The list marker should show -1 (negative values are allowed).</li>
+ <li>The list marker should show 0.</li>
+ <li value="invalid">The list marker should show 1 (invalid values are ignored).</li>
+ <li value="2" id="changeMyValue">The list marker should show -5 (updated programmatically).</li>
+
+ <!-- For the following styles the values are out-of-range, and should fall-back to decimal -->
+ <li value="-1" style="list-style-type: hebrew;">The list marker should fall back to decimal -1 (hebrew: 1-infinite).</li>
+ <li value="0" style="list-style-type: simple-upper-roman;">The list marker should fall back to decimal 0 (simple-upper-roman: 1-4999).</li>
+ <li value="0" style="list-style-type: simple-lower-roman;">The list marker should fall back to decimal 0 (simple-lower-roman: 1-4999).</li>
+ <li value="0" style="list-style-type: upper-roman;">The list marker should fall back to decimal 0 (upper-roman: 1-4999).</li>
+ <li value="0" style="list-style-type: lower-roman;">The list marker should fall back to decimal 0 (lower-roman: 1-4999).</li>
+ <li value="0" style="list-style-type: lower-armenian;">The list marker should fall back to decimal 0 (lower-armenian: 1-9999).</li>
+ <li value="0" style="list-style-type: upper-armenian;">The list marker should fall back to decimal 0 (upper-armenian: 1-9999).</li>
+ <li value="0" style="list-style-type: armenian;">The list marker should fall back to decimal 0 (armenian: 1-9999).</li>
+ <li value="0" style="list-style-type: georgian;">The list marker should fall back to decimal 0 (georgian: 1-19999).</li>
+ <li value="0" style="list-style-type: ancient-tamil;">The list marker should fall back to decimal 0 (ancient-tamil: 1-9999).</li>
+ <!-- FIXME: We don't currently support this list-style-type -> fall back to decimal -->
+ <li value="-1" style="list-style-type: japanese-informal;">The list marker should fall back to cjk-decimal -1 (japanese-informal: 0-9999).</li>
+ <!-- FIXME: We don't currently support this list-style-type -> fall back to decimal -->
+ <li value="-1" style="list-style-type: japanese-formal;">The list marker should fall back to cjk-decimal -1 (japanese-formal: 0-9999).</li>
+ <li value="-1" style="list-style-type: korean-hangul-formal;">The list marker should fall back to decimal -1 (korean-hangul-formal: 0-9999).</li>
+ <li value="-1" style="list-style-type: korean-hanja-informal;">The list marker should fall back to decimal -1 (korean-hanja-informal: 0-9999).</li>
+ <li value="-1" style="list-style-type: korean-hanja-formal;">The list marker should fall back to decimal -1 (korean-hanja-formal: 0-9999).</li>
+ <li value="0" style="list-style-type: greek;">The list marker should fall back to decimal 0 (greek: 1-999).</li>
</ol>
</body>
Modified: trunk/Source/WebCore/ChangeLog (102289 => 102290)
--- trunk/Source/WebCore/ChangeLog 2011-12-08 01:33:29 UTC (rev 102289)
+++ trunk/Source/WebCore/ChangeLog 2011-12-08 01:44:52 UTC (rev 102290)
@@ -1,3 +1,25 @@
+2011-12-07 Florin Malita <[email protected]>
+
+ <li value="0"> behaves like <li> (the same for negative numbers)
+ https://bugs.webkit.org/show_bug.cgi?id=73911
+
+ Reviewed by Alexey Proskuryakov.
+
+ Allow LI values <= 0 and consolidate the value processing logic.
+
+ * html/HTMLLIElement.cpp:
+ (WebCore::HTMLLIElement::parseMappedAttribute):
+ Delegated value parsing to parseValue().
+
+ (WebCore::HTMLLIElement::attach):
+ Ditto. Explicit value null testing is no longer necessary,
+ as parseValue's toInt() performs an equivalent check.
+
+ (WebCore::HTMLLIElement::parseValue):
+ Consolidated value parsing logic.
+
+ * html/HTMLLIElement.h:
+
2011-12-07 Joshua Bell <[email protected]>
IndexedDB: Replace bool args in IDBKeyRange private methods with enum
Modified: trunk/Source/WebCore/html/HTMLLIElement.cpp (102289 => 102290)
--- trunk/Source/WebCore/html/HTMLLIElement.cpp 2011-12-08 01:33:29 UTC (rev 102289)
+++ trunk/Source/WebCore/html/HTMLLIElement.cpp 2011-12-08 01:44:52 UTC (rev 102290)
@@ -62,13 +62,8 @@
void HTMLLIElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == valueAttr) {
- if (renderer() && renderer()->isListItem()) {
- int requestedValue = attr->value().toInt();
- if (requestedValue > 0)
- toRenderListItem(renderer())->setExplicitValue(requestedValue);
- else
- toRenderListItem(renderer())->clearExplicitValue();
- }
+ if (renderer() && renderer()->isListItem())
+ parseValue(attr->value());
} else if (attr->name() == typeAttr) {
if (attr->value() == "a")
addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerAlpha);
@@ -108,17 +103,20 @@
if (!listNode)
render->setNotInList(true);
- const AtomicString& requestedValueString = fastGetAttribute(valueAttr);
- if (requestedValueString.isNull())
- render->clearExplicitValue();
- else {
- int requestedValue = requestedValueString.toInt();
- if (requestedValue > 0)
- render->setExplicitValue(requestedValue);
- else
- render->clearExplicitValue();
- }
+ parseValue(fastGetAttribute(valueAttr));
}
}
+inline void HTMLLIElement::parseValue(const AtomicString& value)
+{
+ ASSERT(renderer() && renderer()->isListItem());
+
+ bool valueOK;
+ int requestedValue = value.toInt(&valueOK);
+ if (valueOK)
+ toRenderListItem(renderer())->setExplicitValue(requestedValue);
+ else
+ toRenderListItem(renderer())->clearExplicitValue();
}
+
+}
Modified: trunk/Source/WebCore/html/HTMLLIElement.h (102289 => 102290)
--- trunk/Source/WebCore/html/HTMLLIElement.h 2011-12-08 01:33:29 UTC (rev 102289)
+++ trunk/Source/WebCore/html/HTMLLIElement.h 2011-12-08 01:44:52 UTC (rev 102290)
@@ -39,6 +39,8 @@
virtual void parseMappedAttribute(Attribute*);
virtual void attach();
+
+ void parseValue(const AtomicString&);
};
} //namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes