Commit bbf2fa2b authored by darin's avatar darin

LayoutTests:

        Reviewed by Darin.

        - Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7761
          Tabs in class attribute not treated as whitespace

        * fast/dom/Element/class-attribute-whitespace-expected.checksum: Added.
        * fast/dom/Element/class-attribute-whitespace-expected.png: Added.
        * fast/dom/Element/class-attribute-whitespace-expected.txt: Added.
        * fast/dom/Element/class-attribute-whitespace.html: Added.
        NOTE: This test will get broken if "eol-style" processing is done on it.

WebCore:

        Test: fast/dom/Element/class-attribute-whitespace.html

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7761
          Tabs in class attribute not treated as whitespace

        * dom/dom_elementimpl.cpp:
        (WebCore::isClassWhitespace): Helper function to check if a character
        in the class attribute should be treated as whitespace. Added \r and \t.
        (WebCore::NamedMappedAttrMapImpl::parseClassAttribute): Instead of creating
        a QStringList and iterating it, do everything in one pass over the string.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 47b9e2c5
2006-03-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin.
- Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7761
Tabs in class attribute not treated as whitespace
* fast/dom/Element/class-attribute-whitespace-expected.checksum: Added.
* fast/dom/Element/class-attribute-whitespace-expected.png: Added.
* fast/dom/Element/class-attribute-whitespace-expected.txt: Added.
* fast/dom/Element/class-attribute-whitespace.html: Added.
NOTE: This test will get broken if "eol-style" processing is done on it.
2006-03-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Hyatt.
......
715b520b3c8d403c5504f28046ada5c7
\ No newline at end of file
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {TEXT} at (0,0) size 53x18
text run at (0,0) width 53: "Test for "
RenderInline {I} at (0,0) size 655x18
RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
RenderText {TEXT} at (53,0) size 348x18
text run at (53,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=7761"
RenderText {TEXT} at (401,0) size 307x18
text run at (401,0) width 307: " Tabs in class attribute not treated as whitespace"
RenderText {TEXT} at (708,0) size 4x18
text run at (708,0) width 4: "."
RenderBlock {P} at (0,34) size 784x18
RenderText {TEXT} at (0,0) size 233x18
text run at (0,0) width 233: "All of the following should be green:"
RenderBlock {DIV} at (0,68) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 57x18
text run at (0,0) width 57: "Tab after"
RenderBlock {DIV} at (0,86) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 69x18
text run at (0,0) width 69: "Tab before"
RenderBlock {DIV} at (0,104) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 86x18
text run at (0,0) width 86: "Newline after"
RenderBlock {DIV} at (0,122) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 98x18
text run at (0,0) width 98: "Newline before"
RenderBlock {DIV} at (0,140) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 76x18
text run at (0,0) width 76: "Spaces after"
RenderBlock {DIV} at (0,158) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 88x18
text run at (0,0) width 88: "Spaces before"
RenderBlock {DIV} at (0,176) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 54x18
text run at (0,0) width 54: "CR after"
RenderBlock {DIV} at (0,194) size 784x18 [color=#008000]
RenderText {TEXT} at (0,0) size 66x18
text run at (0,0) width 66: "CR before"
<html>
<head>
<style type="text/css">
div { color: red; }
div.green { color: green; }
</style>
<title></title>
</head>
<body>
<p>
Test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7761">http://bugzilla.opendarwin.org/show_bug.cgi?id=7761</a>
Tabs in class attribute not treated as whitespace</i>.
</p>
<p>All of the following should be green:</p>
<div class="green ">Tab after</div>
<div class=" green">Tab before</div>
<div class="green
">Newline after</div>
<div class="
green">Newline before</div>
<div class="green ">Spaces after</div>
<div class=" green">Spaces before</div>
<div class="green foo">CR after</div>
<div class="foo green">CR before</div>
</body>
</html>
2006-03-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
Test: fast/dom/Element/class-attribute-whitespace.html
Reviewed by Darin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7761
Tabs in class attribute not treated as whitespace
* dom/dom_elementimpl.cpp:
(WebCore::isClassWhitespace): Helper function to check if a character
in the class attribute should be treated as whitespace. Added \r and \t.
(WebCore::NamedMappedAttrMapImpl::parseClassAttribute): Instead of creating
a QStringList and iterating it, do everything in one pass over the string.
2006-03-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
Test: fast/block/float/vertical-move-relayout.html
......@@ -1246,6 +1246,11 @@ bool NamedMappedAttrMapImpl::mapsEquivalent(const NamedMappedAttrMapImpl* otherM
return true;
}
inline static bool isClassWhitespace(QChar c)
{
return c == ' ' || c == '\r' || c == '\n' || c == '\t';
}
void NamedMappedAttrMapImpl::parseClassAttribute(const DOMString& classStr)
{
m_classList.clear();
......@@ -1256,27 +1261,32 @@ void NamedMappedAttrMapImpl::parseClassAttribute(const DOMString& classStr)
(classStr.impl()->isLower() ? classStr : DOMString(classStr.impl()->lower())) :
classStr;
if (classAttr.find(' ') == -1 && classAttr.find('\n') == -1)
m_classList.setString(AtomicString(classAttr));
else {
QString val = classAttr.qstring();
val.replace('\n', ' ');
QStringList list = QStringList::split(' ', val);
AtomicStringList* curr = 0;
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) {
const QString& singleClass = *it;
if (!singleClass.isEmpty()) {
if (curr) {
curr->setNext(new AtomicStringList(AtomicString(singleClass)));
curr = curr->next();
}
else {
m_classList.setString(AtomicString(singleClass));
curr = &m_classList;
}
AtomicStringList* curr = 0;
const QChar* str = classAttr.unicode();
int length = classAttr.length();
int sPos = 0;
while (true) {
while (sPos < length && isClassWhitespace(str[sPos]))
++sPos;
if (sPos >= length)
break;
int ePos = sPos + 1;
while (ePos < length && !isClassWhitespace(str[ePos]))
++ePos;
if (curr) {
curr->setNext(new AtomicStringList(AtomicString(str + sPos, ePos - sPos)));
curr = curr->next();
} else {
if (sPos == 0 && ePos == length) {
m_classList.setString(AtomicString(classAttr));
break;
}
m_classList.setString(AtomicString(str + sPos, ePos - sPos));
curr = &m_classList;
}
sPos = ePos + 1;
}
}
......
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