LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Feb 2007 15:46:40 +0000 (15:46 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Feb 2007 15:46:40 +0000 (15:46 +0000)
        Reviewed by Maciej.

        - test for http://bugs.webkit.org/show_bug.cgi?id=12911
        GoogleDocs: Ordered lists don't update immediately when start attribute changed

        * fast/lists/ol-start-dynamic-expected.checksum: Added.
        * fast/lists/ol-start-dynamic-expected.png: Added.
        * fast/lists/ol-start-dynamic-expected.txt: Added.
        * fast/lists/ol-start-dynamic.html: Added.

WebCore:

        Reviewed by Maciej.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12911
        GoogleDocs: Ordered lists don't update immediately when start attribute changed

        Update list marker value when start attribute changes.

        * html/HTMLOListElement.cpp:
        (WebCore::HTMLOListElement::parseMappedAttribute):

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

LayoutTests/ChangeLog
LayoutTests/fast/lists/ol-start-dynamic-expected.checksum [new file with mode: 0644]
LayoutTests/fast/lists/ol-start-dynamic-expected.png [new file with mode: 0644]
LayoutTests/fast/lists/ol-start-dynamic-expected.txt [new file with mode: 0644]
LayoutTests/fast/lists/ol-start-dynamic.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLOListElement.cpp

index bd66d7aadfcbee528a058393ab55c5c34059310c..4e7af5c34bba6c7bf38a3b62bbc964563a6f02ad 100644 (file)
@@ -1,3 +1,15 @@
+2007-02-27  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+
+        - test for http://bugs.webkit.org/show_bug.cgi?id=12911
+        GoogleDocs: Ordered lists don't update immediately when start attribute changed
+
+        * fast/lists/ol-start-dynamic-expected.checksum: Added.
+        * fast/lists/ol-start-dynamic-expected.png: Added.
+        * fast/lists/ol-start-dynamic-expected.txt: Added.
+        * fast/lists/ol-start-dynamic.html: Added.
+        
 2007-02-28  Rob Buis  <buis@kde.org>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/lists/ol-start-dynamic-expected.checksum b/LayoutTests/fast/lists/ol-start-dynamic-expected.checksum
new file mode 100644 (file)
index 0000000..3456962
--- /dev/null
@@ -0,0 +1 @@
+9d15c74db6a82b8551ae9e1702feec8c
\ No newline at end of file
diff --git a/LayoutTests/fast/lists/ol-start-dynamic-expected.png b/LayoutTests/fast/lists/ol-start-dynamic-expected.png
new file mode 100644 (file)
index 0000000..f7b054f
Binary files /dev/null and b/LayoutTests/fast/lists/ol-start-dynamic-expected.png differ
diff --git a/LayoutTests/fast/lists/ol-start-dynamic-expected.txt b/LayoutTests/fast/lists/ol-start-dynamic-expected.txt
new file mode 100644 (file)
index 0000000..4be2c62
--- /dev/null
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x576
+      RenderBlock {DIV} at (0,0) size 784x36
+        RenderBlock {OL} at (0,0) size 784x36
+          RenderListItem {LI} at (40,0) size 744x18
+            RenderListMarker at (-20,0) size 16x18: "2"
+            RenderText {#text} at (0,0) size 21x18
+              text run at (0,0) width 21: "foo"
+          RenderListItem {LI} at (40,18) size 744x18
+            RenderListMarker at (-20,0) size 16x18: "3"
+            RenderText {#text} at (0,0) size 20x18
+              text run at (0,0) width 20: "bar"
diff --git a/LayoutTests/fast/lists/ol-start-dynamic.html b/LayoutTests/fast/lists/ol-start-dynamic.html
new file mode 100644 (file)
index 0000000..74e019f
--- /dev/null
@@ -0,0 +1,13 @@
+<div>
+<ol id="ol">
+<li>foo</li>
+<li>bar</li>
+</ol>
+
+<script>
+//force layout
+document.body.offsetTop;
+var ol = document.getElementById("ol");
+ol.start = "2";
+
+</script>
index 76c451190c24ebc29a68d5cd38a8a0aade2bd234..bd99ed6b38d42cf23f1949d72a068663c0350bd3 100644 (file)
@@ -1,3 +1,15 @@
+2007-02-27  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=12911
+        GoogleDocs: Ordered lists don't update immediately when start attribute changed
+        
+        Update list marker value when start attribute changes.
+
+        * html/HTMLOListElement.cpp:
+        (WebCore::HTMLOListElement::parseMappedAttribute):
+
 2007-02-28  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Maciej.
index ea5dcf2befdf22f653882fb741aa17ca42c8851b..806c0d01fffd5728484c33a2ce526b7df7300fbe 100644 (file)
@@ -26,6 +26,7 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "RenderListItem.h"
 
 namespace WebCore {
 
@@ -60,9 +61,15 @@ void HTMLOListElement::parseMappedAttribute(MappedAttribute* attr)
             addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ROMAN);
         else if (attr->value() == "1")
             addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
-    } else if (attr->name() == startAttr)
-        m_start = !attr->isNull() ? attr->value().toInt() : 1;
-    else
+    } else if (attr->name() == startAttr) {
+        int s = !attr->isNull() ? attr->value().toInt() : 1;
+        if (s != m_start) {
+            m_start = s;
+            for (RenderObject* r = renderer(); r; r = r->nextInPreOrder(renderer()))
+                if (r->isListItem())
+                    static_cast<RenderListItem*>(r)->updateValue();
+        }
+    } else
         HTMLElement::parseMappedAttribute(attr);
 }