Changeset 10935 in webkit
- Timestamp:
- Oct 24, 2005, 2:42:15 PM (20 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog-2005-12-19
r10934 r10935 1 2005-10-24 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 3 Reviewed by Darin. Committed by David Harrison. 4 5 http://bugzilla.opendarwin.org/show_bug.cgi?id=5449 6 "OBJECT should be accessible by id/name as document property only if its only children are PARAMs" 7 8 Test added: 9 * fast/js/object-by-name-or-id-expected.txt: Added. 10 * fast/js/object-by-name-or-id.html: Added. 11 12 Files changed: 13 * khtml/html/html_miscimpl.cpp: 14 (DOM::HTMLNameCollectionImpl::traverseNextItem): 15 * khtml/html/html_objectimpl.cpp: 16 (DOM::HTMLObjectElementImpl::HTMLObjectElementImpl): 17 (DOM::HTMLObjectElementImpl::parseMappedAttribute): 18 (DOM::HTMLObjectElementImpl::insertedIntoDocument): 19 (DOM::HTMLObjectElementImpl::removedFromDocument): 20 (DOM::HTMLObjectElementImpl::childrenChanged): 21 (DOM::HTMLObjectElementImpl::updateDocNamedItem): 22 * khtml/html/html_objectimpl.h: 23 (DOM::HTMLObjectElementImpl::isDocNamedItem): 24 * manual-tests/drag_select_highlighting.html: Added. 25 1 26 2005-10-24 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 27 -
trunk/WebCore/khtml/html/html_miscimpl.cpp
r10701 r10935 28 28 #include "html/html_imageimpl.h" 29 29 #include "html/html_documentimpl.h" 30 #include "html/html_objectimpl.h" 30 31 31 32 #include "dom/dom_node.h" … … 394 395 e->hasTagName(iframeTag)) 395 396 found = e->getAttribute(nameAttr) == m_name; 396 else if (e->hasTagName(appletTag) || 397 e->hasTagName(objectTag)) 397 else if (e->hasTagName(appletTag)) 398 398 found = e->getAttribute(nameAttr) == m_name || 399 399 e->getAttribute(idAttr) == m_name; 400 else if (e->hasTagName(objectTag)) 401 found = (e->getAttribute(nameAttr) == m_name || e->getAttribute(idAttr) == m_name) && 402 static_cast<HTMLObjectElementImpl *>(e)->isDocNamedItem(); 400 403 break; 401 404 default: -
trunk/WebCore/khtml/html/html_objectimpl.cpp
r10930 r10935 43 43 #include "rendering/render_image.h" 44 44 #include "xml/dom2_eventsimpl.h" 45 #include "xml/dom_textimpl.h" 45 46 #include "xml/EventNames.h" 46 47 … … 562 563 needWidgetUpdate = false; 563 564 m_useFallbackContent = false; 565 m_docNamedItem = true; 564 566 } 565 567 … … 679 681 } else if (attr->name() == nameAttr) { 680 682 DOMString newNameAttr = attr->value(); 681 if (i nDocument() && getDocument()->isHTMLDocument()) {683 if (isDocNamedItem() && inDocument() && getDocument()->isHTMLDocument()) { 682 684 HTMLDocumentImpl *document = static_cast<HTMLDocumentImpl *>(getDocument()); 683 685 document->removeNamedItem(oldNameAttr); … … 687 689 } else if (attr->name() == idAttr) { 688 690 DOMString newIdAttr = attr->value(); 689 if (i nDocument() && getDocument()->isHTMLDocument()) {691 if (isDocNamedItem() && inDocument() && getDocument()->isHTMLDocument()) { 690 692 HTMLDocumentImpl *document = static_cast<HTMLDocumentImpl *>(getDocument()); 691 693 document->removeDocExtraNamedItem(oldIdAttr); … … 780 782 void HTMLObjectElementImpl::insertedIntoDocument() 781 783 { 782 if ( getDocument()->isHTMLDocument()) {784 if (isDocNamedItem() && getDocument()->isHTMLDocument()) { 783 785 HTMLDocumentImpl *document = static_cast<HTMLDocumentImpl *>(getDocument()); 784 786 document->addNamedItem(oldNameAttr); … … 791 793 void HTMLObjectElementImpl::removedFromDocument() 792 794 { 793 if ( getDocument()->isHTMLDocument()) {795 if (isDocNamedItem() && getDocument()->isHTMLDocument()) { 794 796 HTMLDocumentImpl *document = static_cast<HTMLDocumentImpl *>(getDocument()); 795 797 document->removeNamedItem(oldNameAttr); … … 811 813 void HTMLObjectElementImpl::childrenChanged() 812 814 { 815 updateDocNamedItem(); 813 816 if (inDocument() && !m_useFallbackContent) { 814 817 needWidgetUpdate = true; … … 853 856 detach(); 854 857 attach(); 858 } 859 860 void HTMLObjectElementImpl::updateDocNamedItem() 861 { 862 // The rule is "<object> elements with no children other than 863 // <param> elements and whitespace can be found by name in a 864 // document, and other <object> elements cannot." 865 bool wasNamedItem = m_docNamedItem; 866 bool isNamedItem = true; 867 NodeImpl *child = firstChild(); 868 while (child && isNamedItem) { 869 if (child->isElementNode()) { 870 if (!static_cast<ElementImpl *>(child)->hasTagName(paramTag)) 871 isNamedItem = false; 872 } else if (child->isTextNode()) { 873 if (!static_cast<TextImpl *>(child)->containsOnlyWhitespace()) 874 isNamedItem = false; 875 } else 876 isNamedItem = false; 877 child = child->nextSibling(); 878 } 879 if (isNamedItem != wasNamedItem && getDocument()->isHTMLDocument()) { 880 HTMLDocumentImpl *document = static_cast<HTMLDocumentImpl *>(getDocument()); 881 if (isNamedItem) { 882 document->addNamedItem(oldNameAttr); 883 document->addDocExtraNamedItem(oldIdAttr); 884 } else { 885 document->removeNamedItem(oldNameAttr); 886 document->removeDocExtraNamedItem(oldIdAttr); 887 } 888 } 889 m_docNamedItem = isNamedItem; 855 890 } 856 891 -
trunk/WebCore/khtml/html/html_objectimpl.h
r10556 r10935 237 237 void setWidth(const DOMString &); 238 238 239 bool isDocNamedItem() const { return m_docNamedItem; } 239 240 #if APPLE_CHANGES 240 241 KJS::Bindings::Instance *getObjectInstance() const; … … 249 250 250 251 private: 252 void updateDocNamedItem(); 251 253 DOMString oldIdAttr; 252 254 DOMString oldNameAttr; … … 254 256 mutable KJS::Bindings::Instance *objectInstance; 255 257 #endif 258 bool m_docNamedItem; 256 259 }; 257 260
Note:
See TracChangeset
for help on using the changeset viewer.