- fixed <rdar://problem/
3974246> REGRESSION (125-180): popup menus are missing item text on Harmony Remote web site
* khtml/html/html_formimpl.cpp: (DOM::HTMLOptionElementImpl::text): Change this function to traverse the entire tree
and gather all the text rather than just looking at immediate children.
* khtml/xml/dom_nodeimpl.h: Added const.
* khtml/xml/dom_nodeimpl.cpp:
(NodeImpl::traverseNextNode): Added const.
(NodeImpl::traverseNextSibling): Ditto.
(NodeImpl::traversePreviousNodePostOrder): Ditto.
(NodeImpl::detach): Add a missing nil check.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8478
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-01-30 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed <rdar://problem/3974246> REGRESSION (125-180): popup menus are missing item text on Harmony Remote web site
+
+ * khtml/html/html_formimpl.cpp: (DOM::HTMLOptionElementImpl::text): Change this function to traverse the entire tree
+ and gather all the text rather than just looking at immediate children.
+
+ * khtml/xml/dom_nodeimpl.h: Added const.
+ * khtml/xml/dom_nodeimpl.cpp:
+ (NodeImpl::traverseNextNode): Added const.
+ (NodeImpl::traverseNextSibling): Ditto.
+ (NodeImpl::traversePreviousNodePostOrder): Ditto.
+ (NodeImpl::detach): Add a missing nil check.
+
2005-01-30 Darin Adler <darin@apple.com>
Reviewed by John.
DOMString HTMLOptionElementImpl::text() const
{
- DOMString label;
+ DOMString text;
+
// WinIE does not use the label attribute, so as a quirk, we ignore it.
- if (getDocument() && !getDocument()->inCompatMode())
- label = getAttribute(ATTR_LABEL);
- if (label.isEmpty() && firstChild() && firstChild()->nodeType() == Node::TEXT_NODE) {
- if (firstChild()->nextSibling()) {
- DOMString ret = "";
- NodeImpl *n = firstChild();
- for (; n; n = n->nextSibling()) {
- if (n->nodeType() == Node::TEXT_NODE ||
- n->nodeType() == Node::CDATA_SECTION_NODE)
- ret += n->nodeValue();
- }
- return ret;
- }
- else
- return firstChild()->nodeValue();
+ if (getDocument() && !getDocument()->inCompatMode()) {
+ DOMString text = getAttribute(ATTR_LABEL);
+ if (!text.isEmpty())
+ return text;
}
- else
- return label;
+
+ const NodeImpl *n = this;
+ while ((n = n->traverseNextNode(this))) {
+ if (n->nodeType() == Node::TEXT_NODE || n->nodeType() == Node::CDATA_SECTION_NODE)
+ text += n->nodeValue();
+ }
+
+ return text;
}
long HTMLOptionElementImpl::index() const
// Bubbling second. -dwh
if (!evt->propagationStopped())
- it.current()->handleLocalEvents(evt,false);
+ it.current()->handleLocalEvents(evt,false);
}
--it;
return 0;
}
-NodeImpl *NodeImpl::traverseNextNode(NodeImpl *stayWithin) const
+NodeImpl *NodeImpl::traverseNextNode(const NodeImpl *stayWithin) const
{
if (firstChild()) {
assert(!stayWithin || firstChild()->isAncestor(stayWithin));
return 0;
}
-NodeImpl *NodeImpl::traverseNextSibling(NodeImpl *stayWithin) const
+NodeImpl *NodeImpl::traverseNextSibling(const NodeImpl *stayWithin) const
{
if (this == stayWithin)
return 0;
}
}
-NodeImpl *NodeImpl::traversePreviousNodePostOrder(NodeImpl *stayWithin) const
+NodeImpl *NodeImpl::traversePreviousNodePostOrder(const NodeImpl *stayWithin) const
{
if (lastChild()) {
assert(!stayWithin || lastChild()->isAncestor(stayWithin));
m_render->detach();
m_render = 0;
- getDocument()->incDOMTreeVersion();
+ DocumentImpl *doc = getDocument();
+ if (doc)
+ doc->incDOMTreeVersion();
m_attached = false;
}
*
* see @ref traversePreviousNode()
*/
- NodeImpl *traverseNextNode(NodeImpl *stayWithin = 0) const;
+ NodeImpl *traverseNextNode(const NodeImpl *stayWithin = 0) const;
/* Like traverseNextNode, but skips children and starts with the next sibling. */
- NodeImpl *traverseNextSibling(NodeImpl *stayWithin = 0) const;
+ NodeImpl *traverseNextSibling(const NodeImpl *stayWithin = 0) const;
/**
* Does a reverse pre-order traversal to find the node that comes before the current one in document order
NodeImpl *traversePreviousNode() const;
/* Like traversePreviousNode, but visits nodes before their children. */
- NodeImpl *traversePreviousNodePostOrder(NodeImpl *stayWithin = 0) const;
+ NodeImpl *traversePreviousNodePostOrder(const NodeImpl *stayWithin = 0) const;
DocumentPtr *docPtr() const { return document; }