Commit f353d761 authored by darin's avatar darin

LayoutTests:

        Reviewed by Darin.

        - added test case for http://bugzilla.opendarwin.org/show_bug.cgi?id=7338
          Incorrect selectorText for multiple subselectors

        * fast/dom/css-selectorText-expected.checksum: Updated.
        * fast/dom/css-selectorText-expected.png: Updated.
        * fast/dom/css-selectorText-expected.txt: Updated.
        * fast/dom/css-selectorText.html: Added a case with multiple subselectors.

WebCore:

        Test: added to fast/dom/css-selectorText.html

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7338
          Incorrect selectorText for multiple subselectors.

        * css/css_base.cpp:
        (CSSSelector::selectorText): Iterate over subselectors



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13048 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1fb5641e
2006-02-27 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin.
- added test case for http://bugzilla.opendarwin.org/show_bug.cgi?id=7338
Incorrect selectorText for multiple subselectors
* fast/dom/css-selectorText-expected.checksum: Updated.
* fast/dom/css-selectorText-expected.png: Updated.
* fast/dom/css-selectorText-expected.txt: Updated.
* fast/dom/css-selectorText.html: Added a case with multiple subselectors.
2006-02-27 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin.
......
640609fe21178e25fe100e7b1622f885
\ No newline at end of file
66b411f2c64251610c8b70a7b48c2160
\ No newline at end of file
......@@ -3,8 +3,8 @@ layer at (0,0) size 800x600
layer at (2,2) size 796x596
RenderBlock {HTML} at (2,2) size 796x596
RenderBody {BODY} at (2,2) size 792x592
RenderBlock {PRE} at (2,0) size 788x270
RenderText {TEXT} at (0,0) size 208x270
RenderBlock {PRE} at (2,0) size 788x285
RenderText {TEXT} at (0,0) size 264x285
text run at (0,0) width 8: "*"
text run at (0,15) width 24: "div"
text run at (0,30) width 64: "div span"
......@@ -23,3 +23,4 @@ layer at (2,2) size 796x596
text run at (0,225) width 56: "[title]"
text run at (0,240) width 48: "a:link"
text run at (0,255) width 192: "div, span > div:hover, a"
text run at (0,270) width 264: "div span#foo.test div:hover#bar a"
......@@ -19,6 +19,7 @@ div[title] { margin: 2px; }
[title] { margin: 2px; }
a:link { margin: 2px; }
div, span > div:hover, a { margin: 2px; }
div span#foo.test div:hover#bar a { margin: 2px; }
</style>
</head>
<body>
......
2006-02-27 Mitz Pettel <opendarwin.org@mitzpettel.com>
Test: added to fast/dom/css-selectorText.html
Reviewed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7338
Incorrect selectorText for multiple subselectors.
* css/css_base.cpp:
(CSSSelector::selectorText): Iterate over subselectors
2006-02-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
......
......@@ -265,54 +265,59 @@ DOMString CSSSelector::selectorText() const
const AtomicString& localName = cs->tag.localName();
if (cs->match == CSSSelector::None || localName != starAtom)
str = localName;
if (cs->match == CSSSelector::Id) {
str += "#";
str += cs->value;
} else if (cs->match == CSSSelector::Class) {
str += ".";
str += cs->value;
} else if (cs->match == CSSSelector::PseudoClass) {
str += ":";
str += cs->value;
} else if (cs->match == CSSSelector::PseudoElement) {
str += "::";
str += cs->value;
} else if (cs->hasAttribute()) {
// FIXME: Add support for dumping namespaces.
DOMString attrName = cs->attr.localName();
str += "[";
str += attrName;
switch (cs->match) {
case CSSSelector::Exact:
str += "=";
break;
case CSSSelector::Set:
// set has no operator or value, just the attrName
str += "]";
break;
case CSSSelector::List:
str += "~=";
break;
case CSSSelector::Hyphen:
str += "|=";
break;
case CSSSelector::Begin:
str += "^=";
break;
case CSSSelector::End:
str += "$=";
break;
case CSSSelector::Contain:
str += "*=";
break;
default:
break;
}
if (cs->match != CSSSelector::Set) {
str += "\"";
while (true) {
if (cs->match == CSSSelector::Id) {
str += "#";
str += cs->value;
} else if (cs->match == CSSSelector::Class) {
str += ".";
str += cs->value;
} else if (cs->match == CSSSelector::PseudoClass) {
str += ":";
str += cs->value;
} else if (cs->match == CSSSelector::PseudoElement) {
str += "::";
str += cs->value;
str += "\"]";
} else if (cs->hasAttribute()) {
// FIXME: Add support for dumping namespaces.
DOMString attrName = cs->attr.localName();
str += "[";
str += attrName;
switch (cs->match) {
case CSSSelector::Exact:
str += "=";
break;
case CSSSelector::Set:
// set has no operator or value, just the attrName
str += "]";
break;
case CSSSelector::List:
str += "~=";
break;
case CSSSelector::Hyphen:
str += "|=";
break;
case CSSSelector::Begin:
str += "^=";
break;
case CSSSelector::End:
str += "$=";
break;
case CSSSelector::Contain:
str += "*=";
break;
default:
break;
}
if (cs->match != CSSSelector::Set) {
str += "\"";
str += cs->value;
str += "\"]";
}
}
if (cs->relation != CSSSelector::SubSelector || !cs->tagHistory)
break;
cs = cs->tagHistory;
}
if (cs->tagHistory) {
DOMString tagHistoryText = cs->tagHistory->selectorText();
......@@ -322,8 +327,6 @@ DOMString CSSSelector::selectorText() const
str = tagHistoryText + " ~ " + str;
else if (cs->relation == CSSSelector::Child)
str = tagHistoryText + " > " + str;
else if (cs->relation == CSSSelector::SubSelector)
str += tagHistoryText; // the ":" is provided by selectorText()
else // Descendant
str = tagHistoryText + " " + str;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment