[Webkit-unassigned] [Bug 15960] View source mode displays the attributes after an attribute with an empty value incorrectly.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jan 2 16:40:20 PST 2008
http://bugs.webkit.org/show_bug.cgi?id=15960
anyang.ren at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #18076|0 |1
is obsolete| |
Attachment #18245| |review?
Flag| |
------- Comment #21 from anyang.ren at gmail.com 2008-01-02 16:40 PDT -------
Created an attachment (id=18245)
--> (http://bugs.webkit.org/attachment.cgi?id=18245&action=view)
Proposed patch v4
Mitz, thanks a lot for the review. I made your suggested changes in this
patch.
Note that I set attr to NULL if (token->attrs && currAttr <
token->attrs->length())
is false, and test for a non-NULL attr to match the behavior of the original
code as
much as possible. I considered making the simpler change below, but am not
sure
if it's safe:
Index: HTMLViewSourceDocument.cpp
===================================================================
--- HTMLViewSourceDocument.cpp (revision 29095)
+++ HTMLViewSourceDocument.cpp (working copy)
@@ -128,6 +128,7 @@
unsigned size = guide->size();
unsigned begin = 0;
unsigned currAttr = 0;
+ Attribute* attr = NULL;
for (unsigned i = 0; i < size; i++) {
if (guide->at(i) == 'a' || guide->at(i) == 'x' || guide->at(i)
== 'v') {
// Add in the string.
@@ -135,9 +136,8 @@
begin = i + 1;
- if (token->attrs && currAttr < token->attrs->length()) {
if (guide->at(i) == 'a') {
- Attribute* attr =
token->attrs->attributeItem(currAttr);
+ attr = token->attrs->attributeItem(currAttr++);
String name = attr->name().toString();
if (doctype)
addText(name, "webkit-html-doctype");
@@ -147,10 +147,7 @@
if (m_current != m_tbody)
m_current =
static_cast<Element*>(m_current->parent());
}
- if (attr->value().isNull() ||
attr->value().isEmpty())
- currAttr++;
} else {
- Attribute* attr =
token->attrs->attributeItem(currAttr);
String value = attr->value().domString();
if (doctype)
addText(value, "webkit-html-doctype");
@@ -164,9 +161,7 @@
if (m_current != m_tbody)
m_current =
static_cast<Element*>(m_current->parent());
}
- currAttr++;
}
- }
}
}
--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list