[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml/xml
From:       Maks Orlovich <maksim () kde ! org>
Date:       2010-01-06 17:12:14
Message-ID: 1262797934.023097.22838.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1070748 by orlovich:

Properly set hasID bit on XML elements, too, so that the ID cache doesn't 
get out of sync.

(Makes me wonder about the classname bit, too, though)

BUG: 145612
BUG: 214127


 M  +17 -9     dom_elementimpl.cpp  
 M  +10 -8     dom_elementimpl.h  


--- trunk/KDE/kdelibs/khtml/xml/dom_elementimpl.cpp #1070747:1070748
@@ -6,7 +6,7 @@
  *           (C) 2001 Peter Kelly (pmk@post.com)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
  *           (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
- *           (C) 2005, 2008 Maksim Orlovich (maksim@kde.org)  
+ *           (C) 2005, 2008 Maksim Orlovich (maksim@kde.org)
  *           (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -84,7 +84,7 @@
     // so we don't attempt to update the getElementById cache or
     // call parseAttribute, etc. This is because we're normally lazily,
     // from previous attributes, so there is nothing really changing
-    m_element = 0; 
+    m_element = 0;
     createTextChild();
     m_element = element;
 }
@@ -317,11 +317,11 @@
 {
     if (m_localName.id()) {
 	// We may have m_data.value == null if we were given a normalized value
-	// off a removeAttribute (which would call parseNullAttribute()). 
+	// off a removeAttribute (which would call parseNullAttribute()).
 	// Ignore such requests.
 	if (!m_data.value)
 	    return;
-	
+
 	DOMStringImpl* value = newValue.implementation();
 	if (m_data.value == value)
 	    return;
@@ -551,7 +551,7 @@
     else {
         int ec;
         removeAttribute(id, ec);
-    }       
+    }
 }
 
 void ElementImpl::setAttributeMap( NamedAttrMapImpl* list )
@@ -771,8 +771,8 @@
     }
 
     NamespaceName namespacename = NamespaceName::fromString(namespaceURI);
-    LocalName localname = LocalName::fromString(localName, m_htmlCompat ? \
                IDS_NormalizeLower : IDS_CaseSensitive);    
-    
+    LocalName localname = LocalName::fromString(localName, m_htmlCompat ? \
IDS_NormalizeLower : IDS_CaseSensitive); +
     NodeImpl::Id id = makeId(namespacename.id(), localname.id());
     if (!attributes(true)) return 0;
     return static_cast<AttrImpl*>(attributes()->getNamedItem(id, emptyPrefixName, \
true)); @@ -812,8 +812,8 @@
     m_prefix = PrefixName::fromString(_prefix);
 }
 
-short ElementImpl::tabIndex() const 
-{ 
+short ElementImpl::tabIndex() const
+{
     return m_elementHasRareData ? rareData()->tabIndex() : 0;
 }
 
@@ -1411,6 +1411,14 @@
     return clone;
 }
 
+void XMLElementImpl::parseAttribute(AttributeImpl *attr)
+{
+    if (attr->id() == ATTR_ID) {
+        setHasID();
+        document()->incDOMTreeVersion(DocumentImpl::TV_IDNameHref);
+    }
+}
+
 // -------------------------------------------------------------------------
 
 NamedAttrMapImpl::NamedAttrMapImpl(ElementImpl *element)
--- trunk/KDE/kdelibs/khtml/xml/dom_elementimpl.h #1070747:1070748
@@ -186,12 +186,12 @@
     bool hasAttribute(const QualifiedName& name) const { return \
hasAttribute(name.tagName()); }  DOMString getAttribute(const QualifiedName& name) \
const { int ec; return \
const_cast<ElementImpl*>(this)->getAttributeNS(name.namespaceURI(), name.localName(), \
ec); }  DOMString getAttributeNS(const DOMString& namespaceURI, const DOMString& \
localName, int& exceptionCode) const { return \
const_cast<ElementImpl*>(this)->getAttributeNS(namespaceURI, localName, \
                exceptionCode); }
-    // FIXME: get rid of const_cast hacks (the const qualifiers of getAttribute \
                should be reviewed 
-    // as for external API it should look like const,hower we can replace \
AttributeImpl (small version)  +    // FIXME: get rid of const_cast hacks (the const \
qualifiers of getAttribute should be reviewed +    // as for external API it should \
look like const,hower we can replace AttributeImpl (small version)  // with normal \
AttrImpl (NodeImpl)  // END OF FIXME
     // enf of WC api compatibility stuff
-    
+
     //Higher-level DOM stuff
     virtual bool hasAttributes() const;
     bool hasAttribute( const DOMString& name ) const;
@@ -240,7 +240,7 @@
 
     // DOM methods overridden from  parent classes
     virtual DOMString tagName() const;
-    virtual DOMString localName() const;    
+    virtual DOMString localName() const;
     virtual unsigned short nodeType() const;
     virtual WTF::PassRefPtr<NodeImpl> cloneNode ( bool deep );
     virtual DOMString nodeName() const;
@@ -303,7 +303,7 @@
     virtual void attributeChanged(NodeImpl::Id attrId);
     // for WebCore API compatibility
     virtual void attributeChanged(AttributeImpl* attribute, bool /*preserveDecls*/) \
                { attributeChanged(attribute->id()); }
-    
+
     virtual void defaultEventHandler(EventImpl *evt);
 
     virtual khtml::RenderStyle *styleForRenderer(khtml::RenderObject *parent);
@@ -325,7 +325,7 @@
     virtual DOMString toString() const;
     virtual DOMString selectionToString(NodeImpl *selectionStart, NodeImpl \
*selectionEnd, int startOffset, int endOffset, bool &found) const;  
-    virtual bool isFocusable() const;	    
+    virtual bool isFocusable() const;
     virtual bool isContentEditable() const;
     void setContentEditable(bool enabled);
 
@@ -344,7 +344,7 @@
      *  DOM::RangeImpl uses this which is why it is public.
      */
     DOMString openTagStartToString(bool expandurls = false) const;
-    
+
     void updateId(DOMStringImpl* oldId, DOMStringImpl* newId);
     //Called when mapping from id to this node in document should be removed
     virtual void removeId(const DOMString& id);
@@ -363,7 +363,7 @@
 private:
     // There is some information such as computed style for display:none
     // elements that is needed only for a few elements. We store it
-    // in one of these. 
+    // in one of these.
     ElementRareDataImpl* rareData();
     const ElementRareDataImpl* rareData() const;
     ElementRareDataImpl* createRareData();
@@ -387,6 +387,8 @@
     XMLElementImpl(DocumentImpl *doc, NamespaceName namespacename, LocalName \
localName, PrefixName prefix);  ~XMLElementImpl();
 
+    void parseAttribute(AttributeImpl *attr);
+
     virtual WTF::PassRefPtr<NodeImpl> cloneNode ( bool deep );
 
     // Other methods (not part of DOM)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic