2007-02-09  Nicholas Shanks  <[email protected]>

        Reviewed by Dave Hyatt.

        Removed broken recognition of :last-* and :only-* selectors

        * css/CSSGrammar.y:
        * css/CSSSelector.cpp:
        (WebCore::CSSSelector::extractPseudoType):
        * css/CSSSelector.h:
        (WebCore::CSSSelector::):
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::checkOneSelector):

2007-02-09  Nicholas Shanks  <[email protected]>

        Reviewed by Dave Hyatt.

        Removed broken recognition of :last-* and :only-* selectors
        Test results show red indicating property unsupported
        Previous behaviour was to erroneously make everything green

        * css3/expected_failures/css3-modsel-33-expected.checksum: Added.
        * css3/expected_failures/css3-modsel-33-expected.png: Added.
        * css3/expected_failures/css3-modsel-33-expected.txt: Added.
        * css3/expected_failures/css3-modsel-33.html: Added.
        * css3/expected_failures/css3-modsel-35-expected.checksum: Added.
        * css3/expected_failures/css3-modsel-35-expected.png: Added.
        * css3/expected_failures/css3-modsel-35-expected.txt: Added.
        * css3/expected_failures/css3-modsel-35.html: Added.
        * css3/expected_failures/css3-modsel-36-expected.checksum: Added.
        * css3/expected_failures/css3-modsel-36-expected.png: Added.
        * css3/expected_failures/css3-modsel-36-expected.txt: Added.
        * css3/expected_failures/css3-modsel-36.html: Added.
        * css3/expected_failures/css3-modsel-37-expected.checksum: Added.
        * css3/expected_failures/css3-modsel-37-expected.png: Added.
        * css3/expected_failures/css3-modsel-37-expected.txt: Added.
        * css3/expected_failures/css3-modsel-37.html: Added.


git-svn-id: svn://svn.chromium.org/blink/trunk@19528 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog
index f04a6d7..8684e21 100644
--- a/third_party/WebKit/LayoutTests/ChangeLog
+++ b/third_party/WebKit/LayoutTests/ChangeLog
@@ -1,3 +1,28 @@
+2007-02-09  Nicholas Shanks  <[email protected]>
+
+        Reviewed by Dave Hyatt.
+
+        Removed broken recognition of :last-* and :only-* selectors
+        Test results show red indicating property unsupported
+        Previous behaviour was to erroneously make everything green
+
+        * css3/expected_failures/css3-modsel-33-expected.checksum: Added.
+        * css3/expected_failures/css3-modsel-33-expected.png: Added.
+        * css3/expected_failures/css3-modsel-33-expected.txt: Added.
+        * css3/expected_failures/css3-modsel-33.html: Added.
+        * css3/expected_failures/css3-modsel-35-expected.checksum: Added.
+        * css3/expected_failures/css3-modsel-35-expected.png: Added.
+        * css3/expected_failures/css3-modsel-35-expected.txt: Added.
+        * css3/expected_failures/css3-modsel-35.html: Added.
+        * css3/expected_failures/css3-modsel-36-expected.checksum: Added.
+        * css3/expected_failures/css3-modsel-36-expected.png: Added.
+        * css3/expected_failures/css3-modsel-36-expected.txt: Added.
+        * css3/expected_failures/css3-modsel-36.html: Added.
+        * css3/expected_failures/css3-modsel-37-expected.checksum: Added.
+        * css3/expected_failures/css3-modsel-37-expected.png: Added.
+        * css3/expected_failures/css3-modsel-37-expected.txt: Added.
+        * css3/expected_failures/css3-modsel-37.html: Added.
+
 2007-02-08  Adele Peterson  <[email protected]>
 
         Reviewed by Brady.
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33-expected.checksum b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33-expected.checksum
new file mode 100644
index 0000000..0a7b207
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33-expected.checksum
@@ -0,0 +1 @@
+73463500cbee4f2438458169a79ed651
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33-expected.txt b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33-expected.txt
new file mode 100644
index 0000000..34ebf804
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33-expected.txt
@@ -0,0 +1,45 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x134
+  RenderBlock {HTML} at (0,0) size 800x134
+    RenderBody {BODY} at (8,8) size 784x110
+      RenderBlock {DIV} at (0,0) size 784x76
+        RenderTable {TABLE} at (0,0) size 123x76 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 121x74
+            RenderTableRow {TR} at (0,2) size 121x22
+              RenderTableCell {TD} at (2,2) size 24x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 20x18
+                  text run at (2,2) width 20: "1.1"
+              RenderTableCell {TD} at (28,2) size 24x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 20x18
+                  text run at (2,2) width 20: "1.2"
+              RenderTableCell {TD} at (54,2) size 65x22 [bgcolor=#FF0000] [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 61x18
+                  text run at (2,2) width 61: "green cell"
+            RenderTableRow {TR} at (0,26) size 121x22
+              RenderTableCell {TD} at (2,26) size 24x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 20x18
+                  text run at (2,2) width 20: "2.1"
+              RenderTableCell {TD} at (28,26) size 24x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 20x18
+                  text run at (2,2) width 20: "2.2"
+              RenderTableCell {TD} at (54,26) size 65x22 [bgcolor=#FF0000] [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 61x18
+                  text run at (2,2) width 61: "green cell"
+            RenderTableRow {TR} at (0,50) size 121x22
+              RenderTableCell {TD} at (2,50) size 24x22 [border: (1px inset #808080)] [r=2 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 20x18
+                  text run at (2,2) width 20: "3.1"
+              RenderTableCell {TD} at (28,50) size 24x22 [border: (1px inset #808080)] [r=2 c=1 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 20x18
+                  text run at (2,2) width 20: "3.2"
+              RenderTableCell {TD} at (54,50) size 65x22 [bgcolor=#FF0000] [border: (1px inset #808080)] [r=2 c=2 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 61x18
+                  text run at (2,2) width 61: "green cell"
+      RenderBlock {P} at (0,92) size 784x18
+        RenderInline {SPAN} at (0,0) size 431x18
+          RenderText {#text} at (0,0) size 431x18
+            text run at (0,0) width 272: "This paragraph contains a span that should "
+            text run at (272,0) width 159: "have a green background"
+        RenderText {#text} at (431,0) size 139x18
+          text run at (431,0) width 139: " and some text after it."
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33.html b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33.html
new file mode 100644
index 0000000..326910c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-33.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+  <title>:last-child pseudo-class</title>
+  <style type="text/css">.red { background-color : red }
+.t1 td:last-child { background-color : lime }
+p > *:last-child { background-color : lime }
+</style>
+  <link rel="first" href="css3-modsel-1.html" title="Groups of selectors">
+  <link rel="prev" href="css3-modsel-32.html" title=":first-child pseudo-class">
+  <link rel="next" href="css3-modsel-34.html" title=":first-of-type pseudo-class">
+  <link rel="last" href="css3-modsel-d5e.html" title="NEGATED :indeterminate with :checked">
+  <link rel="up" href="./index.html">
+  <link rel="top" href="../../index.html">
+ </head>
+ <body>
+<div>
+<table class="t1" border="1">
+  <tr>
+    <td>1.1</td>
+    <td>1.2</td>
+    <td class="red">green cell</td>
+  </tr>
+  <tr>
+    <td>2.1</td>
+    <td>2.2</td>
+    <td class="red">green cell</td>
+  </tr>
+  <tr>
+    <td>3.1</td>
+    <td>3.2</td>
+    <td class="red">green cell</td>
+  </tr>
+</table>
+</div>
+<p>
+<span>This paragraph contains a span that should
+     have a green background</span> and some text after it.</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35-expected.checksum b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35-expected.checksum
new file mode 100644
index 0000000..be12ec2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35-expected.checksum
@@ -0,0 +1 @@
+57ad0a59166f682446f22a1c63677bb8
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35-expected.txt b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35-expected.txt
new file mode 100644
index 0000000..0192b82a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x136
+  RenderBlock {HTML} at (0,0) size 800x136
+    RenderBody {BODY} at (8,8) size 784x120
+      RenderBlock {DIV} at (0,0) size 784x120
+        RenderBlock {ADDRESS} at (16,0) size 768x18
+          RenderText {#text} at (0,0) size 252x18
+            text run at (0,0) width 252: "A first address with normal background"
+        RenderBlock {ADDRESS} at (16,34) size 768x18
+          RenderText {#text} at (0,0) size 272x18
+            text run at (0,0) width 272: "A second address with normal background"
+        RenderBlock {ADDRESS} at (16,68) size 768x18 [bgcolor=#FF0000]
+          RenderText {#text} at (0,0) size 337x18
+            text run at (0,0) width 337: "A third address that should have a green background"
+        RenderBlock (anonymous) at (0,102) size 784x18
+          RenderText {#text} at (0,0) size 314x18
+            text run at (0,0) width 314: "This div contains 3 addresses above this sentence."
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35.html b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35.html
new file mode 100644
index 0000000..d99db25
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-35.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+  <title>:last-of-type pseudo-class</title>
+  <style type="text/css">.red { background-color : red }
+address { margin-bottom : 1em ; margin-left : 1em }
+address:last-of-type { background-color : lime }
+</style>
+  <link rel="first" href="css3-modsel-1.html" title="Groups of selectors">
+  <link rel="prev" href="css3-modsel-34.html" title=":first-of-type pseudo-class">
+  <link rel="next" href="css3-modsel-36.html" title=":only-child pseudo-class">
+  <link rel="last" href="css3-modsel-d5e.html" title="NEGATED :indeterminate with :checked">
+  <link rel="up" href="./index.html">
+  <link rel="top" href="../../index.html">
+ </head>
+ <body>
+<div>
+<address>A first address with normal background</address>
+<address>A second address with normal background</address>
+<address class="red">A third address that should have a green background</address>
+This div contains 3 addresses above this sentence.</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36-expected.checksum b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36-expected.checksum
new file mode 100644
index 0000000..43e88eab
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36-expected.checksum
@@ -0,0 +1 @@
+f16b3c5d593bc6f64bdab268bf2d84c8
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36-expected.txt b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36-expected.txt
new file mode 100644
index 0000000..483a69b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x118
+  RenderBlock {HTML} at (0,0) size 800x118
+    RenderBody {BODY} at (8,16) size 784x86
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 302x18
+          text run at (0,0) width 302: "This paragraph should have normal background"
+      RenderBlock {DIV} at (0,34) size 784x52
+        RenderBlock (anonymous) at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 234x18
+            text run at (0,0) width 234: "This div contains only one paragraph"
+        RenderBlock {P} at (0,34) size 784x18 [bgcolor=#FF0000]
+          RenderText {#text} at (0,0) size 293x18
+            text run at (0,0) width 293: "This paragraph should have green background"
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36.html b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36.html
new file mode 100644
index 0000000..109baad
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-36.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+  <title>:only-child pseudo-class</title>
+  <style type="text/css">.red { background-color : red }
+p:only-child { background-color : lime }
+div.testText > div > p { margin-left : 1em }
+</style>
+  <link rel="first" href="css3-modsel-1.html" title="Groups of selectors">
+  <link rel="prev" href="css3-modsel-35.html" title=":last-of-type pseudo-class">
+  <link rel="next" href="css3-modsel-37.html" title=":only-of-type pseudo-class">
+  <link rel="last" href="css3-modsel-d5e.html" title="NEGATED :indeterminate with :checked">
+  <link rel="up" href="./index.html">
+  <link rel="top" href="../../index.html">
+ </head>
+ <body>
+<p>This paragraph should have normal background</p>
+<div>This div contains only one paragraph
+    <p class="red">This paragraph should have green background</p>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37-expected.checksum b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37-expected.checksum
new file mode 100644
index 0000000..537c50df
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37-expected.checksum
@@ -0,0 +1 @@
+42edbe4ed1adae0e132a5889eb6ecef4
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37-expected.txt b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37-expected.txt
new file mode 100644
index 0000000..484c811
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x118
+  RenderBlock {HTML} at (0,0) size 800x118
+    RenderBody {BODY} at (8,16) size 784x86
+      RenderBlock {DIV} at (0,0) size 784x86
+        RenderBlock {P} at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 302x18
+            text run at (0,0) width 302: "This paragraph should have normal background"
+        RenderBlock {ADDRESS} at (0,34) size 784x18 [bgcolor=#FF0000]
+          RenderText {#text} at (0,0) size 301x18
+            text run at (0,0) width 301: "But this address should have green background"
+        RenderBlock {P} at (0,68) size 784x18
+          RenderText {#text} at (0,0) size 302x18
+            text run at (0,0) width 302: "This paragraph should have normal background"
diff --git a/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37.html b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37.html
new file mode 100644
index 0000000..6c0cb438
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/expected_failures/css3-modsel-37.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+  <title>:only-of-type pseudo-class</title>
+  <style type="text/css">.red { background-color : red }
+.t1 :only-of-type { background-color : lime }
+</style>
+  <link rel="first" href="css3-modsel-1.html" title="Groups of selectors">
+  <link rel="prev" href="css3-modsel-36.html" title=":only-child pseudo-class">
+  <link rel="next" href="css3-modsel-38.html" title="::first-line pseudo-element">
+  <link rel="last" href="css3-modsel-d5e.html" title="NEGATED :indeterminate with :checked">
+  <link rel="up" href="./index.html">
+  <link rel="top" href="../../index.html">
+ </head>
+ <body>
+<div class="t1">
+<p>This paragraph should have normal background</p>
+<address class="red">But this address should have green background</address>
+<p>This paragraph should have normal background</p>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/WebCore/ChangeLog b/third_party/WebKit/WebCore/ChangeLog
index 0cae068..9e009463 100644
--- a/third_party/WebKit/WebCore/ChangeLog
+++ b/third_party/WebKit/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2007-02-09  Nicholas Shanks  <[email protected]>
+
+        Reviewed by Dave Hyatt.
+
+        Removed broken recognition of :last-* and :only-* selectors
+
+        * css/CSSGrammar.y:
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::extractPseudoType):
+        * css/CSSSelector.h:
+        (WebCore::CSSSelector::):
+        * css/cssstyleselector.cpp:
+        (WebCore::CSSStyleSelector::checkOneSelector):
+
 2007-02-09  Maciej Stachowiak  <[email protected]>
 
         Reviewed by Mark.
diff --git a/third_party/WebKit/WebCore/css/CSSGrammar.y b/third_party/WebKit/WebCore/css/CSSGrammar.y
index b279b7b..095d7a7 100644
--- a/third_party/WebKit/WebCore/css/CSSGrammar.y
+++ b/third_party/WebKit/WebCore/css/CSSGrammar.y
@@ -846,8 +846,8 @@
         CSSSelector::PseudoType type = $$->pseudoType();
         if (type == CSSSelector::PseudoUnknown)
             $$ = 0;
-        else if (type == CSSSelector::PseudoEmpty || type == CSSSelector::PseudoOnlyChild ||
-                 type == CSSSelector::PseudoFirstChild || type == CSSSelector::PseudoLastChild) {
+        else if (type == CSSSelector::PseudoEmpty ||
+                 type == CSSSelector::PseudoFirstChild) {
             CSSParser* p = static_cast<CSSParser*>(parser);
             Document* doc = p->document();
             if (doc)
diff --git a/third_party/WebKit/WebCore/css/CSSSelector.cpp b/third_party/WebKit/WebCore/css/CSSSelector.cpp
index 2ffd440c..95c7664f 100644
--- a/third_party/WebKit/WebCore/css/CSSSelector.cpp
+++ b/third_party/WebKit/WebCore/css/CSSSelector.cpp
@@ -90,11 +90,7 @@
     static AtomicString indeterminate("indeterminate");
     static AtomicString link("link");
     static AtomicString lang("lang(");
-    static AtomicString lastChild("last-child");
-    static AtomicString lastOfType("last-of-type");
     static AtomicString notStr("not(");
-    static AtomicString onlyChild("only-child");
-    static AtomicString onlyOfType("only-of-type");
     static AtomicString root("root");
     static AtomicString searchCancelButton("-webkit-search-cancel-button");
     static AtomicString searchDecoration("-webkit-search-decoration");
@@ -158,16 +154,8 @@
         m_pseudoType = PseudoLink;
     else if (m_value == lang)
         m_pseudoType = PseudoLang;
-    else if (m_value == lastChild)
-        m_pseudoType = PseudoLastChild;
-    else if (m_value == lastOfType)
-        m_pseudoType = PseudoLastOfType;
     else if (m_value == notStr)
         m_pseudoType = PseudoNot;
-    else if (m_value == onlyChild)
-        m_pseudoType = PseudoOnlyChild;
-    else if (m_value == onlyOfType)
-        m_pseudoType = PseudoOnlyOfType;
     else if (m_value == root)
         m_pseudoType = PseudoRoot;
     else if (m_value == searchCancelButton) {
diff --git a/third_party/WebKit/WebCore/css/CSSSelector.h b/third_party/WebKit/WebCore/css/CSSSelector.h
index 7aec7ea..48c0d10 100644
--- a/third_party/WebKit/WebCore/css/CSSSelector.h
+++ b/third_party/WebKit/WebCore/css/CSSSelector.h
@@ -121,10 +121,6 @@
             PseudoEmpty,
             PseudoFirstChild,
             PseudoFirstOfType,
-            PseudoLastChild,
-            PseudoLastOfType,
-            PseudoOnlyChild,
-            PseudoOnlyOfType,
             PseudoFirstLine,
             PseudoFirstLetter,
             PseudoLink,
diff --git a/third_party/WebKit/WebCore/css/cssstyleselector.cpp b/third_party/WebKit/WebCore/css/cssstyleselector.cpp
index 5b47c7f..b29a09c 100644
--- a/third_party/WebKit/WebCore/css/cssstyleselector.cpp
+++ b/third_party/WebKit/WebCore/css/cssstyleselector.cpp
@@ -1452,65 +1452,6 @@
                 }
                 break;
             }
-            case CSSSelector::PseudoLastChild: {
-                // last-child matches the last child that is an element!
-                if (e->parentNode() && e->parentNode()->isElementNode()) {
-                    Node *n = e->nextSibling();
-                    while (n && !n->isElementNode())
-                        n = n->nextSibling();
-                    if (!n)
-                        return true;
-                }
-                break;
-            }
-            case CSSSelector::PseudoLastOfType: {
-                // last-of-type matches the last element of its type!
-                if (e->parentNode() && e->parentNode()->isElementNode()) {
-                    const QualifiedName& type = e->tagQName();
-                    Node *n = e->nextSibling();
-                    while (n) {
-                        if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type))
-                            break;
-                        n = n->nextSibling();
-                    }
-                    if (!n)
-                        return true;
-                }
-                break;
-            }
-            case CSSSelector::PseudoOnlyChild: {
-                // If both first-child and last-child apply, then only-child applies.
-                if (e->parentNode() && e->parentNode()->isElementNode()) {
-                    Node *n = e->previousSibling();
-                    while (n && !n->isElementNode())
-                        n = n->previousSibling();
-                    if (!n) {
-                        n = e->nextSibling();
-                        while (n && !n->isElementNode())
-                            n = n->nextSibling();
-                        if (!n)
-                            return true;
-                    }
-                }
-                break;
-            }
-            case CSSSelector::PseudoOnlyOfType: {
-                // If both first-of-type and last-of-type apply, then only-of-type applies.
-                if (e->parentNode() && e->parentNode()->isElementNode()) {
-                    const QualifiedName& type = e->tagQName();
-                    Node *n = e->previousSibling();
-                    while (n && !static_cast<Element*>(n)->hasTagName(type))
-                        n = n->previousSibling();
-                    if (!n) {
-                        n = e->nextSibling();
-                        while (n && !static_cast<Element*>(n)->hasTagName(type))
-                            n = n->nextSibling();
-                        if (!n)
-                            return true;
-                    }
-                }
-                break;
-            }
             case CSSSelector::PseudoTarget:
                 if (e == e->document()->getCSSTarget())
                     return true;