Changeset 21184

Show
Ignore:
Timestamp:
04/29/07 13:32:51 (3 years ago)
Author:
darin
Message:

Reviewed by Adele.

This patch changes things so that resizing can make things larger than their
initial size, but not smaller. I believe this resolves the problem for Gmail,
but you can still get strange behavior if you have a small right-aligned <textarea>.

  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::resize): Rewrote to use more IntPoint and IntSize and add in a new minimum-size algorithm. This function now has the side effect of storing a new minimumSizeForResizing in the element being resized, and respects any existing minimum as well. (WebCore::RenderLayer::offsetFromResizeCorner): Reversed this so it converts the point into coordinates relative to the resize corner, hence negative numbers mean the point is above and to the left. This is used only in the algorithm above.
  • dom/Element.h: Removed unneeded include of Attr.h, and added forward declarations as needed. Removed all friend declarations; there was no need for any of them. Tweaked formatting of various declarations and removed unneeded parameter names. Made as much as possible private, and a couple things public to avoid the need for friend classes. Added minimumSizeForResizing, setMinimumSizeForResizing, rareData, and createRareData functions.
  • dom/Element.cpp: (WebCore::rareDataMap): Added. Function to return the single global map. (WebCore::rareDataFromMap): Added. For use by inlined functions to get the data from the map in the case where it's present. (WebCore::ElementRareData::ElementRareData): Added. (WebCore::Element::~Element): Added code to delete the element from the rare data map when appropriate. (WebCore::Element::rareData): Added. (WebCore::Element::createRareData): Added. (WebCore::Element::setAttributeNodeNS): Got rid of the old inline version of this, since it was the sole reason we had to include Attr.h in Element.h. (WebCore::Element::minimumSizeForResizing): Added. Accesses rare data. (WebCore::Element::setMinimumSizeForResizing): Ditto.
  • dom/Node.h: Renamed the m_specified bit since it's now used for two purposes. Its new long name is m_attrWasSpecifiedOrElementHasRareData.
  • dom/Attr.cpp: (WebCore::Attr::Attr): Updated for bit name change.
  • dom/Attr.h: (WebCore::Attr::specified): Ditto. (WebCore::Attr::setSpecified): Added, since setting the bit directly is pretty ugly now.
  • dom/Document.cpp: (WebCore::Document::adoptNode): Updated for bit name change.
  • dom/Node.cpp: (WebCore::Node::Node): Ditto. (WebCore::Node::dump): Ditto.
  • dom/NamedAttrMap.cpp: (WebCore::NamedAttrMap::isReadOnlyNode): Moved out of line, since this was the sole reason we had to include Element.h in NamedAttrMap.h.
  • html/HTMLElement.cpp: (WebCore::HTMLElement::nodeName): Changed to use tagQName() since that's a public way to do something that's now private. (WebCore::HTMLElement::cloneNode): Ditto.
  • dom/Attribute.cpp:
  • dom/NamedAttrMap.h:
  • dom/NamedMappedAttrMap.cpp:
  • dom/StyledElement.h:
  • html/HTMLTokenizer.h:
  • xml/XPathFunctions.cpp:
  • xml/XPathStep.cpp: Updated includes, and other administrivia.
Location:
trunk/WebCore
Files:
18 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r21183 r21184  
     12007-04-29  Darin Adler  <darin@apple.com> 
     2 
     3        Reviewed by Adele. 
     4 
     5        - fix the Gmail part of http://bugs.webkit.org/show_bug.cgi?id=12798 
     6          and <rdar://problem/4118559> 
     7 
     8        This patch changes things so that resizing can make things larger than their 
     9        initial size, but not smaller. I believe this resolves the problem for Gmail, 
     10        but you can still get strange behavior if you have a small right-aligned <textarea>. 
     11 
     12        * rendering/RenderLayer.cpp: 
     13        (WebCore::RenderLayer::resize): Rewrote to use more IntPoint and IntSize and add 
     14        in a new minimum-size algorithm. This function now has the side effect of storing 
     15        a new minimumSizeForResizing in the element being resized, and respects any existing 
     16        minimum as well. 
     17        (WebCore::RenderLayer::offsetFromResizeCorner): Reversed this so it converts the 
     18        point into coordinates relative to the resize corner, hence negative numbers mean 
     19        the point is above and to the left. This is used only in the algorithm above. 
     20 
     21        * dom/Element.h: Removed unneeded include of Attr.h, and added forward declarations 
     22        as needed. Removed all friend declarations; there was no need for any of them. 
     23        Tweaked formatting of various declarations and removed unneeded parameter names. 
     24        Made as much as possible private, and a couple things public to avoid the need for 
     25        friend classes. Added minimumSizeForResizing, setMinimumSizeForResizing, rareData, 
     26        and createRareData functions. 
     27 
     28        * dom/Element.cpp: 
     29        (WebCore::rareDataMap): Added. Function to return the single global map. 
     30        (WebCore::rareDataFromMap): Added. For use by inlined functions to get the 
     31        data from the map in the case where it's present. 
     32        (WebCore::ElementRareData::ElementRareData): Added. 
     33        (WebCore::Element::~Element): Added code to delete the element from the rare 
     34        data map when appropriate. 
     35        (WebCore::Element::rareData): Added. 
     36        (WebCore::Element::createRareData): Added. 
     37        (WebCore::Element::setAttributeNodeNS): Got rid of the old inline version of this, 
     38        since it was the sole reason we had to include Attr.h in Element.h. 
     39        (WebCore::Element::minimumSizeForResizing): Added. Accesses rare data. 
     40        (WebCore::Element::setMinimumSizeForResizing): Ditto. 
     41 
     42        * dom/Node.h: Renamed the m_specified bit since it's now used for two purposes. 
     43        Its new long name is m_attrWasSpecifiedOrElementHasRareData. 
     44 
     45        * dom/Attr.cpp: (WebCore::Attr::Attr): Updated for bit name change. 
     46        * dom/Attr.h: 
     47        (WebCore::Attr::specified): Ditto. 
     48        (WebCore::Attr::setSpecified): Added, since setting the bit directly is pretty ugly now. 
     49        * dom/Document.cpp: (WebCore::Document::adoptNode): Updated for bit name change. 
     50        * dom/Node.cpp: 
     51        (WebCore::Node::Node): Ditto. 
     52        (WebCore::Node::dump): Ditto. 
     53 
     54        * dom/NamedAttrMap.cpp: (WebCore::NamedAttrMap::isReadOnlyNode): Moved out of line, 
     55        since this was the sole reason we had to include Element.h in NamedAttrMap.h. 
     56 
     57        * html/HTMLElement.cpp: 
     58        (WebCore::HTMLElement::nodeName): Changed to use tagQName() since that's a public 
     59        way to do something that's now private. 
     60        (WebCore::HTMLElement::cloneNode): Ditto. 
     61 
     62        * dom/Attribute.cpp: 
     63        * dom/NamedAttrMap.h: 
     64        * dom/NamedMappedAttrMap.cpp: 
     65        * dom/StyledElement.h: 
     66        * html/HTMLTokenizer.h: 
     67        * xml/XPathFunctions.cpp: 
     68        * xml/XPathStep.cpp: 
     69        Updated includes, and other administrivia. 
     70 
    1712007-04-29  Mitz Pettel  <mitz@webkit.org> 
    272 
  • trunk/WebCore/dom/Attr.cpp

    r20495 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    4139    ASSERT(!m_attribute->attr()); 
    4240    m_attribute->m_impl = this; 
    43     m_specified = true; 
     41    m_attrWasSpecifiedOrElementHasRareData = true; 
    4442} 
    4543 
  • trunk/WebCore/dom/Attr.h

    r13480 r21184  
    11/* 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    3331namespace WebCore { 
    3432 
    35  
    3633// this has no counterpart in DOM, purely internal 
    3734// representation of the nodevalue of an Attr. 
     
    5956    // DOM methods & attributes for Attr 
    6057    String name() const { return qualifiedName().toString(); } 
    61     bool specified() const { return m_specified; } 
     58    bool specified() const { return m_attrWasSpecifiedOrElementHasRareData; } 
    6259    Element* ownerElement() const { return m_element; } 
    6360 
     
    9087    CSSStyleDeclaration* style() { return m_attribute->style(); } 
    9188 
     89    void setSpecified(bool specified) { m_attrWasSpecifiedOrElementHasRareData = specified; } 
     90 
    9291private: 
    9392    Element* m_element; 
  • trunk/WebCore/dom/Attribute.cpp

    r13821 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    2725#include "Attribute.h" 
    2826 
     27#include "Attr.h" 
    2928#include "Element.h" 
    3029 
     
    3837PassRefPtr<Attr> Attribute::createAttrIfNeeded(Element* e) 
    3938{ 
    40     RefPtr<Attr> r(m_impl); 
     39    RefPtr<Attr> r = m_impl; 
    4140    if (!r) { 
    4241        r = new Attr(e, e->document(), this); 
  • trunk/WebCore/dom/Document.cpp

    r21179 r21184  
    637637            if (attr->ownerElement()) 
    638638                attr->ownerElement()->removeAttributeNode(attr, ec); 
    639             attr->m_specified = true; 
     639            attr->m_attrWasSpecifiedOrElementHasRareData = true; 
    640640            break; 
    641641        }        
  • trunk/WebCore/dom/Element.cpp

    r20950 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    5048using namespace XMLNames; 
    5149 
     50class ElementRareData { 
     51public: 
     52    ElementRareData(Element*); 
     53    IntSize m_minimumSizeForResizing; 
     54}; 
     55 
     56typedef HashMap<const Element*, ElementRareData*> ElementRareDataMap; 
     57 
     58static ElementRareDataMap& rareDataMap() 
     59{ 
     60    static ElementRareDataMap* dataMap = new ElementRareDataMap; 
     61    return *dataMap; 
     62} 
     63 
     64static ElementRareData* rareDataFromMap(const Element* element) 
     65{ 
     66    return rareDataMap().get(element); 
     67} 
     68 
     69static inline IntSize defaultMinimumSizeForResizing() 
     70{ 
     71    return IntSize(INT_MAX, INT_MAX); 
     72} 
     73 
     74inline ElementRareData::ElementRareData(Element* element) 
     75    : m_minimumSizeForResizing(defaultMinimumSizeForResizing()) 
     76{ 
     77} 
     78 
    5279Element::Element(const QualifiedName& qName, Document *doc) 
    5380    : ContainerNode(doc) 
     
    6289    if (namedAttrMap) 
    6390        namedAttrMap->detachFromElement(); 
     91 
     92    if (!m_attrWasSpecifiedOrElementHasRareData) 
     93        ASSERT(!rareDataMap().contains(this)); 
     94    else { 
     95        ElementRareDataMap& dataMap = rareDataMap(); 
     96        ElementRareDataMap::iterator it = dataMap.find(this); 
     97        ASSERT(it != dataMap.end()); 
     98        delete it->second; 
     99        dataMap.remove(it); 
     100    } 
     101} 
     102 
     103inline ElementRareData* Element::rareData() 
     104{ 
     105    return m_attrWasSpecifiedOrElementHasRareData ? rareDataFromMap(this) : 0; 
     106} 
     107 
     108inline const ElementRareData* Element::rareData() const 
     109{ 
     110    return m_attrWasSpecifiedOrElementHasRareData ? rareDataFromMap(this) : 0; 
     111} 
     112 
     113ElementRareData* Element::createRareData() 
     114{ 
     115    if (m_attrWasSpecifiedOrElementHasRareData) 
     116        return rareDataMap().get(this); 
     117    ASSERT(!rareDataMap().contains(this)); 
     118    ElementRareData* data = new ElementRareData(this); 
     119    rareDataMap().set(this, data); 
     120    m_attrWasSpecifiedOrElementHasRareData = true; 
     121    return data; 
    64122} 
    65123 
     
    816874} 
    817875 
     876PassRefPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionCode& ec) 
     877{ 
     878    ASSERT(attr); 
     879    return static_pointer_cast<Attr>(attributes(false)->setNamedItem(attr, ec)); 
     880} 
     881 
    818882PassRefPtr<Attr> Element::removeAttributeNode(Attr *attr, ExceptionCode& ec) 
    819883{ 
     
    9861050} 
    9871051 
    988 } 
     1052IntSize Element::minimumSizeForResizing() const 
     1053{ 
     1054    const ElementRareData* rd = rareData(); 
     1055    return rd ? rd->m_minimumSizeForResizing : defaultMinimumSizeForResizing(); 
     1056} 
     1057 
     1058void Element::setMinimumSizeForResizing(const IntSize& size) 
     1059{ 
     1060    if (size == defaultMinimumSizeForResizing() && !rareData()) 
     1061        return; 
     1062    createRareData()->m_minimumSizeForResizing = size; 
     1063} 
     1064 
     1065} 
  • trunk/WebCore/dom/Element.h

    r20072 r21184  
    11/* 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    2826#define Element_h 
    2927 
    30 #include "Attr.h" 
     28#include "ContainerNode.h" 
     29#include "QualifiedName.h" 
    3130#include "ScrollTypes.h" 
    3231#include "Timer.h" 
     
    3534 
    3635class AtomicStringList; 
     36class Attr; 
    3737class Attribute; 
     38class CSSStyleDeclaration; 
     39class ElementRareData; 
     40class IntSize; 
    3841 
    3942class Element : public ContainerNode { 
    40     friend class Document; 
    41     friend class NamedAttrMap; 
    42     friend class Attr; 
    43     friend class Node; 
    44     friend class CSSStyleSelector; 
    4543public: 
    4644    Element(const QualifiedName&, Document*); 
     
    5048    virtual const AtomicStringList* getClassList() const; 
    5149    const AtomicString& getIDAttribute() const; 
    52     bool hasAttribute(const QualifiedName& name) const; 
    53     const AtomicString& getAttribute(const QualifiedName& name) const; 
    54     void setAttribute(const QualifiedName& name, StringImpl* value, ExceptionCode&); 
    55     void removeAttribute(const QualifiedName& name, ExceptionCode&); 
     50    bool hasAttribute(const QualifiedName&) const; 
     51    const AtomicString& getAttribute(const QualifiedName&) const; 
     52    void setAttribute(const QualifiedName&, StringImpl* value, ExceptionCode&); 
     53    void removeAttribute(const QualifiedName&, ExceptionCode&); 
    5654 
    5755    bool hasAttributes() const; 
     
    8987    int scrollHeight(); 
    9088 
    91     void removeAttribute(const String &name, ExceptionCode& ec); 
    92     void removeAttributeNS(const String &namespaceURI, const String& localName, ExceptionCode&); 
     89    void removeAttribute(const String& name, ExceptionCode&); 
     90    void removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode&); 
    9391 
    9492    PassRefPtr<Attr> getAttributeNode(const String& name); 
    9593    PassRefPtr<Attr> getAttributeNodeNS(const String& namespaceURI, const String& localName); 
    9694    PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionCode&); 
    97     PassRefPtr<Attr> setAttributeNodeNS(Attr* newAttr, ExceptionCode& ec) { return setAttributeNode(newAttr, ec); } 
     95    PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionCode&); 
    9896    PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionCode&); 
    9997     
    100     virtual CSSStyleDeclaration *style(); 
     98    virtual CSSStyleDeclaration* style(); 
    10199 
    102100    const QualifiedName& tagQName() const { return m_tagName; } 
     
    126124 
    127125    // convenience methods which ignore exceptions 
    128     void setAttribute(const QualifiedName& name, const String& value); 
    129  
    130     virtual NamedAttrMap *attributes() const; 
     126    void setAttribute(const QualifiedName&, const String& value); 
     127 
     128    virtual NamedAttrMap* attributes() const; 
    131129    NamedAttrMap* attributes(bool readonly) const; 
    132130 
    133131    // This method is called whenever an attribute is added, changed or removed. 
    134     virtual void attributeChanged(Attribute* attr, bool preserveDecls = false) {} 
     132    virtual void attributeChanged(Attribute*, bool preserveDecls = false) {} 
    135133 
    136134    // not part of the DOM 
    137135    void setAttributeMap(NamedAttrMap*); 
    138136 
    139     virtual void copyNonAttributeProperties(const Element *source) {} 
     137    virtual void copyNonAttributeProperties(const Element* source) {} 
    140138 
    141139    virtual void attach(); 
    142140    virtual void detach(); 
    143     virtual RenderStyle *styleForRenderer(RenderObject *parent); 
    144     virtual RenderObject *createRenderer(RenderArena *, RenderStyle *); 
    145     virtual void recalcStyle( StyleChange = NoChange ); 
     141    virtual RenderStyle* styleForRenderer(RenderObject* parent); 
     142    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 
     143    virtual void recalcStyle(StyleChange = NoChange); 
    146144 
    147145    virtual bool childTypeAllowed(NodeType); 
     
    149147    virtual Attribute* createAttribute(const QualifiedName& name, StringImpl* value); 
    150148     
    151     void dispatchAttrRemovalEvent(Attribute *attr); 
    152     void dispatchAttrAdditionEvent(Attribute *attr); 
     149    void dispatchAttrRemovalEvent(Attribute*); 
     150    void dispatchAttrAdditionEvent(Attribute*); 
    153151 
    154152    virtual void accessKeyAction(bool sendToAnyEvent) { } 
     
    156154    virtual String toString() const; 
    157155 
    158     virtual bool isURLAttribute(Attribute *attr) const; 
     156    virtual bool isURLAttribute(Attribute*) const; 
    159157    virtual String target() const { return String(); } 
    160158         
     
    164162    bool needsFocusAppearanceUpdate() const { return m_needsFocusAppearanceUpdate; } 
    165163    void setNeedsFocusAppearanceUpdate(bool b) { m_needsFocusAppearanceUpdate = b; } 
    166      
     164 
    167165#ifndef NDEBUG 
    168     virtual void dump(TextStream *stream, DeprecatedString ind = "") const; 
    169     virtual void formatForDebugger(char *buffer, unsigned length) const; 
     166    virtual void dump(TextStream* , DeprecatedString ind = "") const; 
     167    virtual void formatForDebugger(char* buffer, unsigned length) const; 
    170168#endif 
    171169 
    172     Node* insertAdjacentElement(const String& where, Node* newChild, int& exception); 
     170    Node* insertAdjacentElement(const String& where, Node* newChild, ExceptionCode&); 
    173171    bool contains(const Node*) const; 
    174172 
     
    178176    virtual String title() const; 
    179177 
    180 protected: 
     178    String openTagStartToString() const; 
     179 
     180    void updateId(const AtomicString& oldId, const AtomicString& newId); 
     181 
     182    IntSize minimumSizeForResizing() const; 
     183    void setMinimumSizeForResizing(const IntSize&); 
     184 
     185private: 
     186    ElementRareData* rareData(); 
     187    const ElementRareData* rareData() const; 
     188    ElementRareData* createRareData(); 
     189 
    181190    virtual void createAttributeMap() const; 
    182     String openTagStartToString() const; 
    183  
    184 private: 
    185     void updateId(const AtomicString& oldId, const AtomicString& newId); 
    186191 
    187192    virtual void updateStyleAttributeIfNeeded() const {} 
     
    192197    bool m_needsFocusAppearanceUpdate; 
    193198 
    194 protected: // member variables 
     199protected: 
    195200    mutable RefPtr<NamedAttrMap> namedAttrMap; 
     201 
     202private: 
    196203    QualifiedName m_tagName; 
    197204}; 
  • trunk/WebCore/dom/NamedAttrMap.cpp

    r18428 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    2321 * Boston, MA 02111-1307, USA. 
    2422 */ 
     23 
    2524#include "config.h" 
    2625#include "NamedAttrMap.h" 
    2726 
    2827#include "Document.h" 
     28#include "Element.h" 
    2929#include "ExceptionCode.h" 
    3030#include "HTMLNames.h" 
     
    359359} 
    360360 
    361 } 
     361bool NamedAttrMap::isReadOnlyNode() 
     362{ 
     363    return element && element->isReadOnlyNode(); 
     364} 
     365 
     366} 
  • trunk/WebCore/dom/NamedAttrMap.h

    r20495 r21184  
    2828#define NamedAttrMap_h 
    2929 
    30 #include "Element.h" 
     30#include "Attribute.h" 
    3131#include "NamedNodeMap.h" 
    3232 
     
    4141    friend class Element; 
    4242public: 
    43     NamedAttrMap(Element *e); 
     43    NamedAttrMap(Element*); 
    4444    virtual ~NamedAttrMap(); 
    4545    NamedAttrMap(const NamedAttrMap&); 
     
    6565    Attribute* getAttributeItem(const QualifiedName& name) const; 
    6666    Attribute* getAttributeItem(const String& name) const; 
    67     virtual bool isReadOnlyNode() { return element ? element->isReadOnlyNode() : false; } 
     67    virtual bool isReadOnlyNode(); 
    6868 
    6969    // used during parsing: only inserts if not already there 
  • trunk/WebCore/dom/NamedMappedAttrMap.cpp

    r14273 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    2321 * Boston, MA 02111-1307, USA. 
    2422 */ 
     23 
    2524#include "config.h" 
    2625#include "NamedMappedAttrMap.h" 
    2726 
    2827#include "Document.h" 
     28#include "Element.h" 
    2929 
    3030namespace WebCore { 
  • trunk/WebCore/dom/Node.cpp

    r21169 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    7  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    86 * Copyright (C) 2007 Trolltech ASA 
    97 * 
     
    3129#include "DOMImplementation.h" 
    3230#include "Document.h" 
     31#include "Element.h" 
    3332#include "ExceptionCode.h" 
    3433#include "Frame.h" 
     
    150149      m_inDocument(false), 
    151150      m_isLink(false), 
    152       m_specified(false), 
     151      m_attrWasSpecifiedOrElementHasRareData(false), 
    153152      m_focused(false), 
    154153      m_active(false), 
     
    798797    if (m_hasClass) { *stream << " hasClass"; } 
    799798    if (m_hasStyle) { *stream << " hasStyle"; } 
    800     if (m_specified) { *stream << " specified"; } 
    801799    if (m_focused) { *stream << " focused"; } 
    802800    if (m_active) { *stream << " active"; } 
  • trunk/WebCore/dom/Node.h

    r21003 r21184  
    11/* 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    7  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 
     5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    86 * 
    97 * This library is free software; you can redistribute it and/or 
     
    472470 
    473471    bool m_isLink : 1; 
    474     bool m_specified : 1; // used in Attr; accessor functions there 
     472    bool m_attrWasSpecifiedOrElementHasRareData : 1; // used in Attr for one thing and Element for another 
    475473    bool m_focused : 1; 
    476474    bool m_active : 1; 
  • trunk/WebCore/dom/StyledElement.h

    r18386 r21184  
    11/* 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
    64 *           (C) 2001 Peter Kelly (pmk@post.com) 
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org) 
    8  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 
     6 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 
    97 * 
    108 * This library is free software; you can redistribute it and/or 
     
    2826#define StyledElement_h 
    2927 
     28#include "Element.h" 
    3029#include "NamedMappedAttrMap.h" 
    3130 
     
    3534class MappedAttribute; 
    3635 
    37 class StyledElement : public Element 
    38 { 
     36class StyledElement : public Element { 
    3937public: 
    4038    StyledElement(const QualifiedName&, Document*); 
  • trunk/WebCore/html/HTMLElement.cpp

    r20495 r21184  
    1 /** 
    2  * This file is part of the DOM implementation for KDE. 
    3  * 
     1/* 
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
     
    6664    // the string on a hit in the hash. 
    6765    if (document()->isHTMLDocument()) 
    68         return m_tagName.localName().impl()->upper(); 
     66        return tagQName().localName().impl()->upper(); 
    6967    return Element::nodeName(); 
    7068} 
     
    9492PassRefPtr<Node> HTMLElement::cloneNode(bool deep) 
    9593{ 
    96     RefPtr<HTMLElement> clone = HTMLElementFactory::createHTMLElement(m_tagName.localName(), document(), 0, false); 
     94    RefPtr<HTMLElement> clone = HTMLElementFactory::createHTMLElement(tagQName().localName(), document(), 0, false); 
    9795    if (!clone) 
    9896        return 0; 
  • trunk/WebCore/html/HTMLTokenizer.h

    r18848 r21184  
    11/* 
    2     This file is part of the KDE libraries 
    3  
    42    Copyright (C) 1997 Martin Jones (mjones@kde.org) 
    53              (C) 1997 Torben Weis (weis@kde.org) 
     
    115113    State parseProcessingInstruction(SegmentedString&, State); 
    116114    State scriptHandler(State); 
    117     State scriptExecution(const DeprecatedString& script, State state, DeprecatedString scriptURL = DeprecatedString(), int baseLine = 0); 
     115    State scriptExecution(const DeprecatedString& script, State, DeprecatedString scriptURL, int baseLine = 0); 
    118116    void setSrc(const SegmentedString&); 
    119117 
  • trunk/WebCore/rendering/RenderLayer.cpp

    r21183 r21184  
    11/* 
    2  * Copyright (C) 2006 Apple Computer, Inc. 
     2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 
    33 * 
    44 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 
     
    865865} 
    866866 
    867 void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& offsetFromResizeCorner) 
    868 { 
    869     if (!inResizeMode() || !renderer()->hasOverflowClip() || m_object->style()->resize() == RESIZE_NONE) 
    870         return; 
    871  
    872     if (!m_object->document()->frame()->eventHandler()->mousePressed()) 
    873         return; 
    874  
    875     // FIXME Radar 4118559: This behaves very oddly for textareas that are in blocks with right-aligned text; you have 
    876     // to drag the bottom-right corner to make the bottom-left corner move. 
    877     // FIXME Radar 4118564: ideally we'd autoscroll the window as necessary to keep the point under 
    878     // the cursor in view. 
    879  
    880     IntPoint currentPoint = m_object->document()->view()->windowToContents(evt.pos()); 
    881     currentPoint += offsetFromResizeCorner; 
    882  
    883     int x; 
    884     int y; 
    885     m_object->absolutePosition(x, y); 
    886     int right = x + m_object->width(); 
    887     int bottom = y + m_object->height(); 
    888     int diffWidth =  max(currentPoint.x() - right, min(0, MinimumWidthWhileResizing - m_object->width())); 
    889     int diffHeight = max(currentPoint.y() - bottom, min(0, MinimumHeightWhileResizing - m_object->height())); 
    890      
    891     ExceptionCode ec = 0; 
    892     // Set the width and height for the shadow ancestor node.  This is necessary for textareas since the resizable layer is on the inner div. 
    893     // For non-shadow content, this will set the width and height on the original node. 
    894     RenderObject* renderer = m_object->node()->shadowAncestorNode()->renderer(); 
    895     if (diffWidth && (m_object->style()->resize() == RESIZE_HORIZONTAL || m_object->style()->resize() == RESIZE_BOTH)) { 
    896         CSSStyleDeclaration* style = static_cast<Element*>(m_object->node()->shadowAncestorNode())->style(); 
    897         if (renderer->element() && renderer->element()->isControl()) { 
     867void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset) 
     868{ 
     869    if (!inResizeMode() || !m_object->hasOverflowClip()) 
     870        return; 
     871 
     872    // Set the width and height of the shadow ancestor node if there is one. 
     873    // This is necessary for textarea elements since the resizable layer is in the shadow content. 
     874    Element* element = static_cast<Element*>(m_object->node()->shadowAncestorNode()); 
     875    RenderBox* renderer = static_cast<RenderBox*>(element->renderer()); 
     876 
     877    EResize resize = renderer->style()->resize(); 
     878    if (resize == RESIZE_NONE) 
     879        return; 
     880 
     881    Document* document = element->document(); 
     882    if (!document->frame()->eventHandler()->mousePressed()) 
     883        return; 
     884 
     885    IntSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos())); 
     886 
     887    IntSize currentSize = IntSize(renderer->width(), renderer->height()); 
     888 
     889    IntSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize); 
     890    element->setMinimumSizeForResizing(minimumSize); 
     891 
     892    IntSize difference = (currentSize + newOffset - oldOffset).expandedTo(minimumSize) - currentSize; 
     893 
     894    CSSStyleDeclaration* style = element->style(); 
     895    bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX; 
     896 
     897    ExceptionCode ec; 
     898 
     899    if (difference.width()) { 
     900        if (element && element->isControl()) { 
     901            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>). 
    898902            style->setProperty(CSS_PROP_MARGIN_LEFT, String::number(renderer->marginLeft()) + "px", false, ec); 
    899903            style->setProperty(CSS_PROP_MARGIN_RIGHT, String::number(renderer->marginRight()) + "px", false, ec); 
    900904        } 
    901         int baseWidth = renderer->width() - (renderer->style()->boxSizing() == BORDER_BOX ? 0 : renderer->borderLeft() + renderer->paddingLeft() + renderer->borderRight() + renderer->paddingRight()); 
    902         style->setProperty(CSS_PROP_WIDTH, String::number(baseWidth + diffWidth) + "px", false, ec); 
    903     } 
    904  
    905     if (diffHeight && (m_object->style()->resize() == RESIZE_VERTICAL || m_object->style()->resize() == RESIZE_BOTH)) { 
    906         CSSStyleDeclaration* style = static_cast<Element*>(m_object->node()->shadowAncestorNode())->style(); 
    907         if (renderer->element() && renderer->element()->isControl()) { 
     905        int baseWidth = renderer->width() - (isBoxSizingBorder ? 0 
     906            : renderer->borderLeft() + renderer->paddingLeft() + renderer->borderRight() + renderer->paddingRight()); 
     907        style->setProperty(CSS_PROP_WIDTH, String::number(baseWidth + difference.width()) + "px", false, ec); 
     908    } 
     909 
     910    if (difference.height()) { 
     911        if (element && element->isControl()) { 
     912            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>). 
    908913            style->setProperty(CSS_PROP_MARGIN_TOP, String::number(renderer->marginTop()) + "px", false, ec); 
    909914            style->setProperty(CSS_PROP_MARGIN_BOTTOM, String::number(renderer->marginBottom()) + "px", false, ec); 
    910915        } 
    911         int baseHeight = renderer->height() - (renderer->style()->boxSizing() == BORDER_BOX ? 0 : renderer->borderTop() + renderer->paddingTop() + renderer->borderBottom() + renderer->paddingBottom()); 
    912         style->setProperty(CSS_PROP_HEIGHT, String::number(baseHeight + diffHeight) + "px", false, ec); 
    913     } 
    914      
    915     ASSERT(ec == 0); 
    916  
    917     if (m_object->style()->resize() != RESIZE_NONE) { 
    918         m_object->setNeedsLayout(true); 
    919         m_object->node()->shadowAncestorNode()->renderer()->setNeedsLayout(true); 
    920         m_object->document()->updateLayout(); 
    921     } 
     916        int baseHeight = renderer->height() - (isBoxSizingBorder ? 0 
     917            : renderer->borderTop() + renderer->paddingTop() + renderer->borderBottom() + renderer->paddingBottom()); 
     918        style->setProperty(CSS_PROP_HEIGHT, String::number(baseHeight + difference.height()) + "px", false, ec); 
     919    } 
     920 
     921    document->updateLayout(); 
     922 
     923    // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view. 
    922924} 
    923925 
     
    10441046    int y = height(); 
    10451047    convertToLayerCoords(root(), x, y); 
    1046     return IntSize(x - p.x(), y - p.y()); 
     1048    return p - IntPoint(x, y); 
    10471049} 
    10481050 
  • trunk/WebCore/xml/XPathFunctions.cpp

    r20620 r21184  
    3232 
    3333#include "Document.h" 
     34#include "Element.h" 
    3435#include "NamedAttrMap.h" 
    3536#include "XMLNames.h" 
  • trunk/WebCore/xml/XPathStep.cpp

    r20620 r21184  
    3232 
    3333#include "Document.h" 
     34#include "Element.h" 
    3435#include "NamedAttrMap.h" 
    3536#include "XPathNSResolver.h"