[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hamaji at chromium.org hamaji at chromium.org
Wed Apr 7 23:13:20 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 47244a6c5a89da9fca1c6650b455c7acb5b10e81
Author: hamaji at chromium.org <hamaji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 28 20:14:13 2009 +0000

    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            * Api/qwebframe.cpp:
            (QWebFrame::counterValueForElementById):
            (QWebHitTestResult::frame):
            * Api/qwebframe.h:
    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            * webkit/webkitprivate.h:
            * webkit/webkitwebframe.cpp:
            (webkit_web_frame_counter_value_for_element_by_id):
    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            * Interfaces/IWebFramePrivate.idl:
            * WebFrame.cpp:
            (WebFrame::counterValueForElementById):
            * WebFrame.h:
    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            Add counterValueForElement in WebFrame to call WebCore::counterValueForElement.
    
            * Misc/WebCoreStatistics.h:
            * Misc/WebCoreStatistics.mm:
            (-[WebFrame counterValueForElement:]):
    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            Expose WebCore::counterValueForElement as a WebCore API.
    
            * WebCore.base.exp:
            * rendering/RenderTreeAsText.cpp:
            (WebCore::writeCounterValuesFromChildren):
            (WebCore::counterValueForElement):
            * rendering/RenderTreeAsText.h:
    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            Convert two pixel tests to dumpAsText tests using counterValueForElementById.
    
            * fast/css/counters/t1204-increment-00-c-o-expected.txt: Added.
            * fast/css/counters/t1204-increment-00-c-o.html:
            * fast/css/counters/t1204-increment-01-c-o-expected.txt: Added.
            * fast/css/counters/t1204-increment-01-c-o.html:
            * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum: Removed.
            * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png: Removed.
            * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt: Removed.
            * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum: Removed.
            * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png: Removed.
            * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt: Removed.
            * platform/qt/fast/css/counters/t1204-increment-00-c-o-expected.txt: Removed.
            * platform/qt/fast/css/counters/t1204-increment-01-c-o-expected.txt: Removed.
    2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to get counter values with layoutTestContoller
            https://bugs.webkit.org/show_bug.cgi?id=30555
    
            Define layoutTestContoller.counterValueForElementById.
    
            * DumpRenderTree/LayoutTestController.cpp:
            (counterValueForElementByIdCallback):
            (LayoutTestController::staticFunctions):
            * DumpRenderTree/LayoutTestController.h:
            * DumpRenderTree/mac/LayoutTestControllerMac.mm:
            (LayoutTestController::counterValueForElementById):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50233 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 286540c..6c8555d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        Convert two pixel tests to dumpAsText tests using counterValueForElementById.
+
+        * fast/css/counters/t1204-increment-00-c-o-expected.txt: Added.
+        * fast/css/counters/t1204-increment-00-c-o.html:
+        * fast/css/counters/t1204-increment-01-c-o-expected.txt: Added.
+        * fast/css/counters/t1204-increment-01-c-o.html:
+        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum: Removed.
+        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png: Removed.
+        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt: Removed.
+        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum: Removed.
+        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png: Removed.
+        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt: Removed.
+        * platform/qt/fast/css/counters/t1204-increment-00-c-o-expected.txt: Removed.
+        * platform/qt/fast/css/counters/t1204-increment-01-c-o-expected.txt: Removed.
+
 2009-10-28  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/css/counters/t1204-increment-00-c-o-expected.txt b/LayoutTests/fast/css/counters/t1204-increment-00-c-o-expected.txt
new file mode 100644
index 0000000..c459c80
--- /dev/null
+++ b/LayoutTests/fast/css/counters/t1204-increment-00-c-o-expected.txt
@@ -0,0 +1,14 @@
+This is the WebKit version of CSS 2.1 Test Suite: dynamic changes to 'counter-increment'.
+
+Before the dynamic change:
+PASS layoutTestController.counterValueForElementById('one') is '1'
+PASS layoutTestController.counterValueForElementById('three') is '2'
+PASS layoutTestController.counterValueForElementById('four') is '3'
+After the dynamic change:
+PASS layoutTestController.counterValueForElementById('one') is '1'
+PASS layoutTestController.counterValueForElementById('two') is '2'
+PASS layoutTestController.counterValueForElementById('three') is '3'
+PASS layoutTestController.counterValueForElementById('four') is '4'
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html b/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html
index e2cd9a3..7b5e7be 100644
--- a/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html
+++ b/LayoutTests/fast/css/counters/t1204-increment-00-c-o.html
@@ -9,38 +9,67 @@
   .increment { counter-increment: c; }
 
   </style>
+  <script src="../../js/resources/js-test-pre.js"></script>
   <script type="text/javascript">
 
-  if (window.layoutTestController)
+  if (window.layoutTestController) {
       layoutTestController.waitUntilDone();
+      layoutTestController.dumpAsText();
+  }
+
+  function checkCounterValuesBeforeChange()
+  {
+      debug('Before the dynamic change:');
+      shouldBe("layoutTestController.counterValueForElementById('one')", "'1'");
+      shouldBe("layoutTestController.counterValueForElementById('three')", "'2'");
+      shouldBe("layoutTestController.counterValueForElementById('four')", "'3'");
+  }
+
+  function checkCounterValuesAfterChange()
+  {
+      debug('After the dynamic change:');
+      shouldBe("layoutTestController.counterValueForElementById('one')", "'1'");
+      shouldBe("layoutTestController.counterValueForElementById('two')", "'2'");
+      shouldBe("layoutTestController.counterValueForElementById('three')", "'3'");
+      shouldBe("layoutTestController.counterValueForElementById('four')", "'4'");
+
+      debug('');
+      debug('TEST COMPLETE');
+      // Eliminate confusing messages (counter values won't be dumped by dumpAsText).
+      var viewElement = document.getElementById("view");
+      viewElement.parentNode.removeChild(viewElement);
+      layoutTestController.notifyDone();
+  }
+
+  function run()
+  {
+      if (window.layoutTestController)
+          checkCounterValuesBeforeChange();
 
-  function run() {
       var t = document.getElementById("test");
       var s = document.createElement("span");
       s.setAttribute("class", "increment");
+      s.setAttribute("id", "two");
       s.appendChild(document.createTextNode("new-"));
       t.insertBefore(s, t.childNodes.item(1));
 
       if (window.layoutTestController)
-          layoutTestController.notifyDone();
+          checkCounterValuesAfterChange();
   }
-
-  // We cannot use dumpAsText() because the counters are CSS properties and
-  // they aren't dumped by the function. Let's use render tree...
   </script>
  </head>
 
- <!-- This test checks if the counters work properly when some elements are
- added/removed *after* the first rendering finishes. If we put the script in
- <body>, this only checks the results of first rendering and this isn't
- the purpose of this test. That's why we use timeout for this test. -->
- <body onload="setTimeout('run()', 0)">
-
- <p>The following two lines should be the same:</p>
+ <body onload="run();">
 
- <div id="test"><span class="increment"></span><span class="increment"></span><span class="increment"></span></div>
+ <p>This is the WebKit version of <a href="http://www.w3.org/Style/CSS/Test/CSS2.1/20061011/html4/t1204-increment-00-c-o.htm">CSS 2.1 Test Suite: dynamic changes to 'counter-increment'</a>.</p>
 
+ <div id="view">
+ <p>The following two lines should be the same:</p>
+ <div id="test"><span id="one" class="increment"></span><span id="three" class="increment"></span><span id="four" class="increment"></span></div>
  <div id="reference">1-2-new-3-4-</div>
+ </div>
+
+ <div id="console"></div>
 
  </body>
 </html>
diff --git a/LayoutTests/fast/css/counters/t1204-increment-01-c-o-expected.txt b/LayoutTests/fast/css/counters/t1204-increment-01-c-o-expected.txt
new file mode 100644
index 0000000..23f45b9
--- /dev/null
+++ b/LayoutTests/fast/css/counters/t1204-increment-01-c-o-expected.txt
@@ -0,0 +1,13 @@
+This is the WebKit version of CSS 2.1 Test Suite: dynamic changes to 'counter-increment'.
+
+Before the dynamic change:
+PASS layoutTestController.counterValueForElementById('one') is '1'
+PASS layoutTestController.counterValueForElementById('two') is '3'
+PASS layoutTestController.counterValueForElementById('three') is '4'
+After the dynamic change:
+PASS layoutTestController.counterValueForElementById('one') is '1'
+PASS layoutTestController.counterValueForElementById('two') is '2'
+PASS layoutTestController.counterValueForElementById('three') is '3'
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html b/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html
index a05d8d9..851f3d7 100644
--- a/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html
+++ b/LayoutTests/fast/css/counters/t1204-increment-01-c-o.html
@@ -9,35 +9,62 @@
   .increment { counter-increment: c; }
 
   </style>
+  <script src="../../js/resources/js-test-pre.js"></script>
   <script type="text/javascript">
 
-  if (window.layoutTestController)
+  if (window.layoutTestController) {
       layoutTestController.waitUntilDone();
+      layoutTestController.dumpAsText();
+  }
+
+  function checkCounterValuesBeforeChange()
+  {
+      debug('Before the dynamic change:');
+      shouldBe("layoutTestController.counterValueForElementById('one')", "'1'");
+      shouldBe("layoutTestController.counterValueForElementById('two')", "'3'");
+      shouldBe("layoutTestController.counterValueForElementById('three')", "'4'");
+  }
+
+  function checkCounterValuesAfterChange()
+  {
+      debug('After the dynamic change:');
+      shouldBe("layoutTestController.counterValueForElementById('one')", "'1'");
+      shouldBe("layoutTestController.counterValueForElementById('two')", "'2'");
+      shouldBe("layoutTestController.counterValueForElementById('three')", "'3'");
+
+      debug('');
+      debug('TEST COMPLETE');
+      // Eliminate confusing messages (counter values won't be dumped by dumpAsText).
+      var viewElement = document.getElementById("view");
+      viewElement.parentNode.removeChild(viewElement);
+      layoutTestController.notifyDone();
+  }
+
+  function run()
+  {
+      if (window.layoutTestController)
+          checkCounterValuesBeforeChange();
 
-  function run() {
       var t = document.getElementById("test");
       t.removeChild(t.childNodes.item(1));
 
       if (window.layoutTestController)
-          layoutTestController.notifyDone();
+          checkCounterValuesAfterChange();
   }
-
-  // We cannot use dumpAsText() because the counters are CSS properties and
-  // they aren't dumped by the function. Let's use render tree...
   </script>
  </head>
 
- <!-- This test checks if the counters work properly when some elements are
- added/removed *after* the first rendering finishes. If we put the script in
- <body>, this only checks the results of first rendering and this isn't
- the purpose of this test. That's why we use timeout for this test. -->
- <body onload="setTimeout('run()', 0)">
-
- <p>The following two lines should be the same:</p>
+ <body onload="run();">
 
- <div id="test"><span class="increment"></span><span class="increment">FAIL-</span><span class="increment"></span><span class="increment"></span></div>
+ <p>This is the WebKit version of <a href="http://www.w3.org/Style/CSS/Test/CSS2.1/20061011/html4/t1204-increment-01-c-o.htm">CSS 2.1 Test Suite: dynamic changes to 'counter-increment'</a>.</p>
 
+ <div id="view">
+ <p>The following two lines should be the same:</p>
+ <div id="test"><span id="one" class="increment"></span><span class="increment">FAIL-</span><span id="two" class="increment"></span><span id="three" class="increment"></span></div>
  <div id="reference">1-2-3-</div>
+ </div>
+
+ <div id="console"></div>
 
  </body>
 </html>
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum
deleted file mode 100644
index b0b922a..0000000
--- a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum
+++ /dev/null
@@ -1 +0,0 @@
-ec7ee4a896519f9148a52bd4b0513729
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png
deleted file mode 100644
index 319ebde..0000000
Binary files a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png and /dev/null differ
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt
deleted file mode 100644
index 1d81a08..0000000
--- a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x94
-  RenderBlock {HTML} at (0,0) size 800x94
-    RenderBody {BODY} at (8,16) size 784x70
-      RenderBlock {P} at (0,0) size 784x18
-        RenderText {#text} at (0,0) size 279x18
-          text run at (0,0) width 279: "The following two lines should be the same:"
-      RenderBlock {DIV} at (0,34) size 784x18
-        RenderInline {SPAN} at (0,0) size 13x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (0,0) size 8x18
-              text run at (0,0) width 8: "1"
-            RenderText at (8,0) size 5x18
-              text run at (8,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 45x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (13,0) size 8x18
-              text run at (13,0) width 8: "2"
-            RenderText at (21,0) size 5x18
-              text run at (21,0) width 5: "-"
-          RenderText {#text} at (26,0) size 32x18
-            text run at (26,0) width 32: "new-"
-        RenderInline {SPAN} at (0,0) size 13x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (58,0) size 8x18
-              text run at (58,0) width 8: "3"
-            RenderText at (66,0) size 5x18
-              text run at (66,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 13x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (71,0) size 8x18
-              text run at (71,0) width 8: "4"
-            RenderText at (79,0) size 5x18
-              text run at (79,0) width 5: "-"
-      RenderBlock {DIV} at (0,52) size 784x18
-        RenderText {#text} at (0,0) size 84x18
-          text run at (0,0) width 84: "1-2-new-3-4-"
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum
deleted file mode 100644
index 170e2e1..0000000
--- a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum
+++ /dev/null
@@ -1 +0,0 @@
-487407b6817ccdb167c78e75035f636a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png
deleted file mode 100644
index 9f0f4b6..0000000
Binary files a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png and /dev/null differ
diff --git a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt b/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt
deleted file mode 100644
index bd62a79..0000000
--- a/LayoutTests/platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x94
-  RenderBlock {HTML} at (0,0) size 800x94
-    RenderBody {BODY} at (8,16) size 784x70
-      RenderBlock {P} at (0,0) size 784x18
-        RenderText {#text} at (0,0) size 279x18
-          text run at (0,0) width 279: "The following two lines should be the same:"
-      RenderBlock {DIV} at (0,34) size 784x18
-        RenderInline {SPAN} at (0,0) size 13x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (0,0) size 8x18
-              text run at (0,0) width 8: "1"
-            RenderText at (8,0) size 5x18
-              text run at (8,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 13x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (13,0) size 8x18
-              text run at (13,0) width 8: "2"
-            RenderText at (21,0) size 5x18
-              text run at (21,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 13x18
-          RenderInline (generated) at (0,0) size 13x18
-            RenderCounter at (26,0) size 8x18
-              text run at (26,0) width 8: "3"
-            RenderText at (34,0) size 5x18
-              text run at (34,0) width 5: "-"
-      RenderBlock {DIV} at (0,52) size 784x18
-        RenderText {#text} at (0,0) size 39x18
-          text run at (0,0) width 39: "1-2-3-"
diff --git a/LayoutTests/platform/qt/fast/css/counters/t1204-increment-00-c-o-expected.txt b/LayoutTests/platform/qt/fast/css/counters/t1204-increment-00-c-o-expected.txt
deleted file mode 100644
index 6afac6f..0000000
--- a/LayoutTests/platform/qt/fast/css/counters/t1204-increment-00-c-o-expected.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x103
-  RenderBlock {HTML} at (0,0) size 800x103
-    RenderBody {BODY} at (8,16) size 784x79
-      RenderBlock {P} at (0,0) size 784x21
-        RenderText {#text} at (0,0) size 310x21
-          text run at (0,0) width 310: "The following two lines should be the same:"
-      RenderBlock {DIV} at (0,37) size 784x21
-        RenderInline {SPAN} at (0,0) size 14x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (0,0) size 9x21
-              text run at (0,0) width 9: "1"
-            RenderText at (9,0) size 5x21
-              text run at (9,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 49x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (14,0) size 9x21
-              text run at (14,0) width 9: "2"
-            RenderText at (23,0) size 5x21
-              text run at (23,0) width 5: "-"
-          RenderText {#text} at (28,0) size 35x21
-            text run at (28,0) width 35: "new-"
-        RenderInline {SPAN} at (0,0) size 14x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (63,0) size 9x21
-              text run at (63,0) width 9: "3"
-            RenderText at (72,0) size 5x21
-              text run at (72,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 14x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (77,0) size 9x21
-              text run at (77,0) width 9: "4"
-            RenderText at (86,0) size 5x21
-              text run at (86,0) width 5: "-"
-      RenderBlock {DIV} at (0,58) size 784x21
-        RenderText {#text} at (0,0) size 91x21
-          text run at (0,0) width 91: "1-2-new-3-4-"
diff --git a/LayoutTests/platform/qt/fast/css/counters/t1204-increment-01-c-o-expected.txt b/LayoutTests/platform/qt/fast/css/counters/t1204-increment-01-c-o-expected.txt
deleted file mode 100644
index 708fb12..0000000
--- a/LayoutTests/platform/qt/fast/css/counters/t1204-increment-01-c-o-expected.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x103
-  RenderBlock {HTML} at (0,0) size 800x103
-    RenderBody {BODY} at (8,16) size 784x79
-      RenderBlock {P} at (0,0) size 784x21
-        RenderText {#text} at (0,0) size 310x21
-          text run at (0,0) width 310: "The following two lines should be the same:"
-      RenderBlock {DIV} at (0,37) size 784x21
-        RenderInline {SPAN} at (0,0) size 14x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (0,0) size 9x21
-              text run at (0,0) width 9: "1"
-            RenderText at (9,0) size 5x21
-              text run at (9,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 14x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (14,0) size 9x21
-              text run at (14,0) width 9: "2"
-            RenderText at (23,0) size 5x21
-              text run at (23,0) width 5: "-"
-        RenderInline {SPAN} at (0,0) size 14x21
-          RenderInline (generated) at (0,0) size 14x21
-            RenderCounter at (28,0) size 9x21
-              text run at (28,0) width 9: "3"
-            RenderText at (37,0) size 5x21
-              text run at (37,0) width 5: "-"
-      RenderBlock {DIV} at (0,58) size 784x21
-        RenderText {#text} at (0,0) size 42x21
-          text run at (0,0) width 42: "1-2-3-"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c8cd1a4..4e5e73d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        Expose WebCore::counterValueForElement as a WebCore API.
+
+        * WebCore.base.exp:
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::writeCounterValuesFromChildren):
+        (WebCore::counterValueForElement):
+        * rendering/RenderTreeAsText.h:
+
 2009-10-28  Nate Chapin  <japhet at chromium.org>
 
         Unreviewed, Chromium build fix for r50225.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index c0a0e67..a8bed54 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -422,6 +422,7 @@ __ZN7WebCore22GeolocationServiceMock11setPositionEN3WTF10PassRefPtrINS_11Geoposi
 __ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErrorEEE
 __ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv
 __ZN7WebCore22applicationIsAppleMailEv
+__ZN7WebCore22counterValueForElementEPNS_7ElementE
 __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE
 __ZN7WebCore22externalRepresentationEPNS_12RenderObjectE
 __ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index 5c6e738..b7ab191 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -28,6 +28,7 @@
 
 #include "CSSMutableStyleDeclaration.h"
 #include "CharacterNames.h"
+#include "CString.h"
 #include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -553,4 +554,31 @@ String externalRepresentation(RenderObject* o)
     return ts.release();
 }
 
+static void writeCounterValuesFromChildren(TextStream& stream, RenderObject* parent)
+{
+    for (RenderObject* child = parent->firstChild(); child; child = child->nextSibling()) {
+        if (child->isCounter()) {
+            String str(toRenderText(child)->text());
+            stream << str;
+        }
+    }
+}
+
+String counterValueForElement(Element* element)
+{
+    // Make sure the element is not freed during the layout.
+    RefPtr<Element> elementRef(element);
+    element->document()->updateLayout();
+    TextStream stream;
+    // The counter renderers should be children of anonymous children
+    // (i.e., :before or :after pseudo-elements).
+    if (RenderObject* renderer = element->renderer()) {
+        for (RenderObject* child = renderer->firstChild(); child; child = child->nextSibling()) {
+            if (child->isAnonymous())
+                writeCounterValuesFromChildren(stream, child);
+        }
+    }
+    return stream.release();
+}
+
 } // namespace WebCore
diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h
index daca253..325f109 100644
--- a/WebCore/rendering/RenderTreeAsText.h
+++ b/WebCore/rendering/RenderTreeAsText.h
@@ -28,15 +28,18 @@
 
 namespace WebCore {
 
-    class RenderObject;
-    class String;
-    class TextStream;
+class Element;
+class RenderObject;
+class String;
+class TextStream;
 
-    String externalRepresentation(RenderObject*);
-    void write(TextStream&, const RenderObject&, int indent = 0);
+String externalRepresentation(RenderObject*);
+void write(TextStream&, const RenderObject&, int indent = 0);
 
-    // Helper function shared with SVGRenderTreeAsText
-    String quoteAndEscapeNonPrintables(const String&);
+// Helper function shared with SVGRenderTreeAsText
+String quoteAndEscapeNonPrintables(const String&);
+
+String counterValueForElement(Element*);
 
 } // namespace WebCore
 
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 5eba6de..9a155fd 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        * webkit/webkitprivate.h:
+        * webkit/webkitwebframe.cpp:
+        (webkit_web_frame_counter_value_for_element_by_id):
+
 2009-10-28  Joe Mason  <jmason at rim.com>
 
         Reviewed by Adam Treat.
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 44dac04..0be0c04 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -285,6 +285,9 @@ extern "C" {
     WEBKIT_API gchar*
     webkit_web_frame_dump_render_tree (WebKitWebFrame* frame);
 
+    WEBKIT_API gchar*
+    webkit_web_frame_counter_value_for_element_by_id (WebKitWebFrame* frame, const gchar* id);
+
     WEBKIT_API guint
     webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
 
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index 15b11e5..843f923 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -799,6 +799,28 @@ gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame)
 }
 
 /**
+ * webkit_web_frame_counter_value_for_element_by_id:
+ * @frame: a #WebKitWebFrame
+ * @id: an element ID string
+ *
+ * Return value: The counter value of element @id in @frame
+ */
+gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return 0;
+
+    Element* coreElement = coreFrame->document()->getElementById(AtomicString(id));
+    if (!coreElement)
+        return 0;
+    String counterValue = counterValueForElement(coreElement);
+    return g_strdup(counterValue.utf8().data());
+}
+
+/**
  * webkit_web_frame_get_pending_unload_event_count:
  * @frame: a #WebKitWebFrame
  *
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index e29833d..906d571 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,16 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        Add counterValueForElement in WebFrame to call WebCore::counterValueForElement.
+
+        * Misc/WebCoreStatistics.h:
+        * Misc/WebCoreStatistics.mm:
+        (-[WebFrame counterValueForElement:]):
+
 2009-10-27  Geoffrey Garen  <ggaren at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h
index d4370bf..7a189ae 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.h
+++ b/WebKit/mac/Misc/WebCoreStatistics.h
@@ -30,6 +30,8 @@
 
 #import <WebKit/WebFrame.h>
 
+ at class DOMElement;
+
 @interface WebCoreStatistics : NSObject
 {
 }
@@ -81,4 +83,5 @@
 
 @interface WebFrame (WebKitDebug)
 - (NSString *)renderTreeAsExternalRepresentation;
+- (NSString *)counterValueForElement:(DOMElement*)element;
 @end
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index 57b59a4..6bac46e 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -28,6 +28,7 @@
 
 #import "WebCoreStatistics.h"
 
+#import "DOMElementInternal.h"
 #import "WebCache.h"
 #import "WebFrameInternal.h"
 #import <runtime/JSLock.h>
@@ -244,4 +245,9 @@ using namespace WebCore;
     return externalRepresentation(_private->coreFrame->contentRenderer());
 }
 
+- (NSString *)counterValueForElement:(DOMElement*)element
+{
+    return counterValueForElement(core(element));
+}
+
 @end
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index 4ef7250..5996b74 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -476,6 +476,19 @@ QString QWebFrame::renderTreeDump() const
 }
 
 /*!
+    Returns the value of counter in the element specified by \a id.
+*/
+QString QWebFrame::counterValueForElementById(const QString &id) const
+{
+    if (Document *document = d->frame->document()) {
+        Element *element = document->getElementById(id);
+        return WebCore::counterValueForElement(element);
+    }
+    return QString();
+
+}
+
+/*!
     \property QWebFrame::title
     \brief the title of the frame as defined by the HTML &lt;title&gt; element
 
@@ -1686,4 +1699,3 @@ QWebFrame *QWebHitTestResult::frame() const
         return 0;
     return d->frame;
 }
-
diff --git a/WebKit/qt/Api/qwebframe.h b/WebKit/qt/Api/qwebframe.h
index 08285f8..89e0be2 100644
--- a/WebKit/qt/Api/qwebframe.h
+++ b/WebKit/qt/Api/qwebframe.h
@@ -138,6 +138,7 @@ public:
     QString toHtml() const;
     QString toPlainText() const;
     QString renderTreeDump() const;
+    QString counterValueForElementById(const QString &id) const;
 
     QString title() const;
     void setUrl(const QUrl &url);
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index de1ca5f..3f93e6b 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        * Api/qwebframe.cpp:
+        (QWebFrame::counterValueForElementById):
+        (QWebHitTestResult::frame):
+        * Api/qwebframe.h:
+
 2009-10-28  Antonio Gomes  <tonikitoo at webkit.org>
 
         Pushing missing WebKit/qt/tests/qwebframe/resources/ dir from bug 29248.
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 576834b..89d22b6 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        * Interfaces/IWebFramePrivate.idl:
+        * WebFrame.cpp:
+        (WebFrame::counterValueForElementById):
+        * WebFrame.h:
+
 2009-10-28  Joe Mason  <jmason at rim.com>
 
         Reviewed by Adam Treat.
diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl
index c29ed3d..d56239b 100644
--- a/WebKit/win/Interfaces/IWebFramePrivate.idl
+++ b/WebKit/win/Interfaces/IWebFramePrivate.idl
@@ -57,6 +57,7 @@ typedef enum {
 interface IWebFramePrivate : IUnknown
 {
     HRESULT renderTreeAsExternalRepresentation([out, retval] BSTR* result);
+    HRESULT counterValueForElementById([in] BSTR id, [out, retval] BSTR* result);
     HRESULT scrollOffset([out, retval] SIZE* offset);
 
     // FIXME: This shouldn't be needed once IWebDocumentView is implemented.
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index 2f09660..0a1f6d0 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -824,6 +824,25 @@ HRESULT STDMETHODCALLTYPE WebFrame::renderTreeAsExternalRepresentation(
     return S_OK;
 }
 
+HRESULT STDMETHODCALLTYPE WebFrame::counterValueForElementById(
+    /* [in] */ BSTR id, /* [retval][out] */ BSTR *result)
+{
+    if (!result)
+        return E_POINTER;
+
+    Frame* coreFrame = core(this);
+    if (!coreFrame)
+        return E_FAIL;
+
+    String coreId = String(id, SysStringLen(id));
+
+    Element* element = coreFrame->document()->getElementById(coreId);
+    if (!element)
+        return E_FAIL;
+    *result = BString(counterValueForElement(element)).release();
+    return S_OK;
+}
+
 HRESULT STDMETHODCALLTYPE WebFrame::scrollOffset(
         /* [retval][out] */ SIZE* offset)
 {
diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h
index fc3785d..d0f6adf 100644
--- a/WebKit/win/WebFrame.h
+++ b/WebKit/win/WebFrame.h
@@ -158,6 +158,10 @@ public:
     virtual HRESULT STDMETHODCALLTYPE renderTreeAsExternalRepresentation(
         /* [retval][out] */ BSTR *result);
 
+    virtual HRESULT STDMETHODCALLTYPE counterValueForElementById(
+        /* [in] */ BSTR id,
+        /* [retval][out] */ BSTR *result);
+
     virtual HRESULT STDMETHODCALLTYPE scrollOffset(
         /* [retval][out] */ SIZE* offset);
 
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index ca679bc..d01dcd3 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-27  Shinichiro Hamaji  <hamaji at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to get counter values with layoutTestContoller
+        https://bugs.webkit.org/show_bug.cgi?id=30555
+
+        Define layoutTestContoller.counterValueForElementById.
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (counterValueForElementByIdCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::counterValueForElementById):
+
 2009-10-27  Kenneth Rohde Christiansen  <kenneth at webkit.org>
 
         Rubberstamped by Oliver Hunt.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index e3fe727..daf888f 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -385,6 +385,22 @@ static JSValueRef execCommandCallback(JSContextRef context, JSObjectRef function
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef counterValueForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+    if (*exception)
+        return JSValueMakeUndefined(context);
+
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    JSRetainPtr<JSStringRef> counterValue(controller->counterValueForElementById(elementId.get()));
+    if (!counterValue.get())
+        return JSValueMakeUndefined(context);
+    return JSValueMakeString(context, counterValue.get());
+}
+
 static JSValueRef grantDesktopNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     // Has Windows implementation
@@ -1201,6 +1217,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "evaluateScriptInIsolatedWorld", evaluateScriptInIsolatedWorldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 
         { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 6c34b1b..79ffb99 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -30,6 +30,7 @@
 #define LayoutTestController_h
 
 #include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSRetainPtr.h>
 #include <wtf/RefCounted.h>
 #include <string>
 #include <vector>
@@ -51,6 +52,7 @@ public:
     void dispatchPendingLoadRequests();
     void display();
     void execCommand(JSStringRef name, JSStringRef value);
+    JSRetainPtr<JSStringRef> counterValueForElementById(JSStringRef id);
     bool isCommandEnabled(JSStringRef name);
     void keepWebHistory();
     void notifyDone();
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index b01dcf4..fd41391 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -52,6 +52,7 @@ unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
 void webkit_application_cache_set_maximum_size(unsigned long long size);
 unsigned int webkit_worker_thread_count(void);
 void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
+gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id);
 }
 
 static gchar* copyWebSettingKey(gchar* preferenceKey)
@@ -118,6 +119,17 @@ void LayoutTestController::display()
     displayWebView();
 }
 
+JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
+{
+    gchar* idGChar = JSStringCopyUTF8CString(id);
+    gchar* counterValueGChar = webkit_web_frame_counter_value_for_element_by_id(mainFrame, idGChar);
+    g_free(idGChar);
+    if (!counterValueGChar)
+        return 0;
+    JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueGChar));
+    return counterValue;
+}
+
 void LayoutTestController::keepWebHistory()
 {
     // FIXME: implement
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index cb944e9..4d6a609 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -42,6 +42,7 @@
 #import <WebKit/DOMElement.h>
 #import <WebKit/WebApplicationCache.h>
 #import <WebKit/WebBackForwardList.h>
+#import <WebKit/WebCoreStatistics.h>
 #import <WebKit/WebDatabaseManagerPrivate.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebFrame.h>
@@ -151,6 +152,19 @@ void LayoutTestController::display()
     displayWebView();
 }
 
+JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
+{
+    RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, id));
+    NSString *idNS = (NSString *)idCF.get();
+
+    DOMElement *element = [[mainFrame DOMDocument] getElementById:idNS];
+    if (!element)
+        return 0;
+
+    JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame counterValueForElement:element]));
+    return counterValue;
+}
+
 void LayoutTestController::keepWebHistory()
 {
     if (![WebHistory optionalSharedHistory]) {
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 76b5514..8a7b869 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -109,6 +109,11 @@ void LayoutTestController::waitUntilDone()
     m_timeoutTimer.start(11000, this);
 }
 
+QString LayoutTestController::counterValueForElementById(const QString& id)
+{
+    return m_drt->webPage()->mainFrame()->counterValueForElementById(id);
+}
+
 void LayoutTestController::keepWebHistory()
 {
     // FIXME: implement
@@ -308,4 +313,3 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian
     else if (name == "WebKitDefaultFontSize")
         settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt());
 }
-
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 278ba27..cab014c 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -83,6 +83,7 @@ public slots:
     void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
     void setCanOpenWindows() { m_canOpenWindows = true; }
     void waitUntilDone();
+    QString counterValueForElementById(const QString& id);
     void keepWebHistory();
     void notifyDone();
     void dumpBackForwardList() { m_dumpBackForwardList = true; }
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index b5ee2de..d3cac7a 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -975,3 +975,23 @@ void LayoutTestController::removeAllVisitedLinks()
 
     sharedHistoryPrivate->removeAllVisitedLinks();
 }
+
+JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
+{
+    COMPtr<IWebFramePrivate> framePrivate(Query, frame);
+    if (!framePrivate)
+        return 0;
+
+    wstring idWstring = jsStringRefToWString(id);
+    BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length());
+    BSTR counterValueBSTR;
+    if (FAILED(framePrivate->counterValueForElementById(idBSTR, &counterValueBSTR)))
+        return 0;
+
+    wstring counterValue(counterValueBSTR, SysStringLen(counterValueBSTR));
+    SysFreeString(idBSTR);
+    SysFreeString(counterValueBSTR);
+    JSRetainPtr<JSStringRef> counterValueJS(Adopt, JSStringCreateWithCharacters(counterValue.data(), counterValue.length()));
+    return counterValueJS;
+}
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list