2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 
   3  *           (C) 1999 Antti Koivisto (koivisto@kde.org) 
   4  *           (C) 2001 Dirk Mueller (mueller@kde.org) 
   5  *           (C) 2006 Alexey Proskuryakov (ap@webkit.org) 
   6  * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 
   7  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 
   9  * This library is free software; you can redistribute it and/or 
  10  * modify it under the terms of the GNU Library General Public 
  11  * License as published by the Free Software Foundation; either 
  12  * version 2 of the License, or (at your option) any later version. 
  14  * This library is distributed in the hope that it will be useful, 
  15  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
  16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
  17  * Library General Public License for more details. 
  19  * You should have received a copy of the GNU Library General Public License 
  20  * along with this library; see the file COPYING.LIB.  If not, write to 
  21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
  22  * Boston, MA 02110-1301, USA. 
  31 #include "DocumentMarker.h" 
  32 #include "HTMLCollection.h" 
  33 #include "HTMLFormElement.h" 
  34 #include "ScriptExecutionContext.h" 
  35 #include "StringHash.h" 
  36 #include "TextResourceDecoder.h" 
  38 #include <wtf/HashCountedSet.h> 
  39 #include <wtf/ListHashSet.h> 
  41 #include "RenderStyle.h" 
  43 // FIXME: We should move Mac off of the old Frame-based user stylesheet loading 
  44 // code and onto the new code in Page. We can't do that until the code in Page 
  45 // supports non-file: URLs, however. 
  46 #if PLATFORM(MAC) || PLATFORM(QT) 
  47 #define FRAME_LOADS_USER_STYLESHEET 1 
  49 #define FRAME_LOADS_USER_STYLESHEET 0 
  58     class CachedCSSStyleSheet
; 
  59     class CanvasRenderingContext2D
; 
  61     class CSSStyleDeclaration
; 
  62     class CSSStyleSelector
; 
  66     class DOMImplementation
; 
  72     class DocumentFragment
; 
  76     class EntityReference
; 
  79     class FormControlElementWithState
; 
  82     class HTMLCanvasElement
; 
  85     class HTMLFormElement
; 
  86     class HTMLHeadElement
; 
  87     class HTMLInputElement
; 
  92     class MouseEventWithHitTestResults
; 
  96     class PlatformMouseEvent
; 
  97     class ProcessingInstruction
; 
  99     class RegisteredEventListener
; 
 102     class SecurityOrigin
; 
 105     class StyleSheetList
; 
 107     class TextResourceDecoder
; 
 110     class XMLHttpRequest
; 
 113     class SVGDocumentExtensions
; 
 117     class XBLBindingManager
; 
 121     class XPathEvaluator
; 
 122     class XPathExpression
; 
 123     class XPathNSResolver
; 
 127 #if ENABLE(DASHBOARD_SUPPORT) 
 128     struct DashboardRegionValue
; 
 130     struct HitTestRequest
; 
 132 #if ENABLE(TOUCH_EVENTS) 
 133 #include "DocumentIPhoneForward.h" 
 136     typedef int ExceptionCode
; 
 139     extern const int cLayoutScheduleThreshold
; 
 141 class FormElementKey 
{ 
 143     FormElementKey(AtomicStringImpl
* = 0, AtomicStringImpl
* = 0); 
 145     FormElementKey(const FormElementKey
&); 
 146     FormElementKey
& operator=(const FormElementKey
&); 
 148     AtomicStringImpl
* name() const { return m_name
; } 
 149     AtomicStringImpl
* type() const { return m_type
; } 
 151     // Hash table deleted values, which are only constructed and never copied or destroyed. 
 152     FormElementKey(WTF::HashTableDeletedValueType
) : m_name(hashTableDeletedValue()) { } 
 153     bool isHashTableDeletedValue() const { return m_name 
== hashTableDeletedValue(); } 
 159     static AtomicStringImpl
* hashTableDeletedValue() { return reinterpret_cast<AtomicStringImpl
*>(-1); } 
 161     AtomicStringImpl
* m_name
; 
 162     AtomicStringImpl
* m_type
; 
 165 inline bool operator==(const FormElementKey
& a
, const FormElementKey
& b
) 
 167     return a
.name() == b
.name() && a
.type() == b
.type(); 
 170 struct FormElementKeyHash 
{ 
 171     static unsigned hash(const FormElementKey
&); 
 172     static bool equal(const FormElementKey
& a
, const FormElementKey
& b
) { return a 
== b
; } 
 173     static const bool safeToCompareToEmptyOrDeleted 
= true; 
 176 struct FormElementKeyHashTraits 
: WTF::GenericHashTraits
<FormElementKey
> { 
 177     static void constructDeletedValue(FormElementKey
& slot
) { new (&slot
) FormElementKey(WTF::HashTableDeletedValue
); } 
 178     static bool isDeletedValue(const FormElementKey
& value
) { return value
.isHashTableDeletedValue(); } 
 181 class TextAutoSizingKey 
{ 
 184     TextAutoSizingKey(RenderStyle
*, Document
*); 
 185     ~TextAutoSizingKey(); 
 186     TextAutoSizingKey(const TextAutoSizingKey
&); 
 187     TextAutoSizingKey
& operator=(const TextAutoSizingKey
&); 
 188     Document
* doc() const { return m_doc
; } 
 189     RenderStyle
* style() const { return m_style
; } 
 190     inline bool isValidDoc() const { return m_doc 
&& m_doc 
!= deletedKeyDoc(); } 
 191     inline bool isValidStyle() const { return m_style 
&& m_style 
!= deletedKeyStyle(); } 
 192     static Document
* deletedKeyDoc() { return (Document
*) -1; } 
 193     static RenderStyle
* deletedKeyStyle() { return (RenderStyle
*) -1; } 
 197     RenderStyle 
*m_style
; 
 201 inline bool operator==(const TextAutoSizingKey
& a
, const TextAutoSizingKey
& b
) 
 203     if (a
.isValidStyle() && b
.isValidStyle()) 
 204         return a
.style()->equalForTextAutosizing(b
.style()); 
 205     return a
.style() == b
.style(); 
 208 struct TextAutoSizingHash 
{ 
 209     static unsigned hash(const TextAutoSizingKey
&k
) { return k
.style()->hashForTextAutosizing(); } 
 210     static bool equal(const TextAutoSizingKey
& a
, const TextAutoSizingKey
& b
) { return a 
== b
; } 
 211     static const bool safeToCompareToEmptyOrDeleted 
= true; 
 214 struct TextAutoSizingTraits 
: WTF::GenericHashTraits
<TextAutoSizingKey
> { 
 215     static const bool emptyValueIsZero 
= true; 
 216     static void constructDeletedValue(TextAutoSizingKey
& slot
); 
 217     static bool isDeletedValue(const TextAutoSizingKey
& value
); 
 220 class TextAutoSizingValue 
: public RefCounted
<TextAutoSizingValue
>{ 
 222     static PassRefPtr
<TextAutoSizingValue
> create() 
 224         return adoptRef(new TextAutoSizingValue()); 
 227     void addNode(Node 
*node
, float size
); 
 228     bool adjustNodeSizes (); 
 229     int numNodes () const; 
 233     TextAutoSizingValue() { } 
 235     HashSet
<RefPtr
<Node
> > m_autoSizedNodes
; 
 238 struct ViewportArguments
 
 240     ViewportArguments() :initialScale(-1), minimumScale(-1), maximumScale(-1), width(-1), height(-1), userScalable(-1) { } 
 250     bool hasCustomArgument() const { return initialScale 
!= -1 || minimumScale 
!= -1 || maximumScale 
!= -1 || width 
!= -1 || height 
!= -1 || userScalable 
!= -1; } 
 253 class Document 
: public ContainerNode
, public ScriptExecutionContext 
{ 
 255     static PassRefPtr
<Document
> create(Frame
* frame
) 
 257         return new Document(frame
, false); 
 259     static PassRefPtr
<Document
> createXHTML(Frame
* frame
) 
 261         return new Document(frame
, true); 
 265     virtual bool isDocument() const { return true; } 
 267     using ContainerNode::ref
; 
 268     using ContainerNode::deref
; 
 269     virtual void removedLastRef(); 
 271     // Nodes belonging to this document hold "self-only" references - 
 272     // these are enough to keep the document from being destroyed, but 
 273     // not enough to keep it from removing its children. This allows a 
 274     // node that outlives its document to still have a valid document 
 275     // pointer without introducing reference cycles 
 279         ASSERT(!m_deletionHasBegun
); 
 280         ++m_selfOnlyRefCount
; 
 284         ASSERT(!m_deletionHasBegun
); 
 285         --m_selfOnlyRefCount
; 
 286         if (!m_selfOnlyRefCount 
&& !refCount()) { 
 288             m_deletionHasBegun 
= true; 
 294     // DOM methods & attributes for Document 
 296     DocumentType
* doctype() const { return m_docType
.get(); } 
 298     DOMImplementation
* implementation() const; 
 299     virtual void childrenChanged(bool changedByParser 
= false, Node
* beforeChange 
= 0, Node
* afterChange 
= 0, int childCountDelta 
= 0); 
 301     Element
* documentElement() const 
 303         if (!m_documentElement
) 
 304             cacheDocumentElement(); 
 305         return m_documentElement
.get(); 
 308     virtual PassRefPtr
<Element
> createElement(const AtomicString
& tagName
, ExceptionCode
&); 
 309     PassRefPtr
<DocumentFragment
> createDocumentFragment (); 
 310     PassRefPtr
<Text
> createTextNode(const String
& data
); 
 311     PassRefPtr
<Comment
> createComment(const String
& data
); 
 312     PassRefPtr
<CDATASection
> createCDATASection(const String
& data
, ExceptionCode
&); 
 313     PassRefPtr
<ProcessingInstruction
> createProcessingInstruction(const String
& target
, const String
& data
, ExceptionCode
&); 
 314     PassRefPtr
<Attr
> createAttribute(const String
& name
, ExceptionCode
& ec
) { return createAttributeNS(String(), name
, ec
, true); } 
 315     PassRefPtr
<Attr
> createAttributeNS(const String
& namespaceURI
, const String
& qualifiedName
, ExceptionCode
&, bool shouldIgnoreNamespaceChecks 
= false); 
 316     PassRefPtr
<EntityReference
> createEntityReference(const String
& name
, ExceptionCode
&); 
 317     PassRefPtr
<Node
> importNode(Node
* importedNode
, bool deep
, ExceptionCode
&); 
 318     virtual PassRefPtr
<Element
> createElementNS(const String
& namespaceURI
, const String
& qualifiedName
, ExceptionCode
&); 
 319     PassRefPtr
<Element
> createElement(const QualifiedName
&, bool createdByParser
, ExceptionCode
& ec
); 
 320     Element
* getElementById(const AtomicString
&) const; 
 321     bool hasElementWithId(AtomicStringImpl
* id
) const; 
 322     bool containsMultipleElementsWithId(const AtomicString
& elementId
) { return m_duplicateIds
.contains(elementId
.impl()); } 
 324     Element
* elementFromPoint(int x
, int y
) const; 
 325     String 
readyState() const; 
 326     String 
inputEncoding() const; 
 327     String 
defaultCharset() const; 
 329     String 
charset() const { return inputEncoding(); } 
 330     String 
characterSet() const { return inputEncoding(); } 
 332     void setCharset(const String
&); 
 334     String 
contentLanguage() const { return m_contentLanguage
; } 
 335     void setContentLanguage(const String
& lang
) { m_contentLanguage 
= lang
; } 
 337     String 
xmlEncoding() const { return m_xmlEncoding
; } 
 338     String 
xmlVersion() const { return m_xmlVersion
; } 
 339     bool xmlStandalone() const { return m_xmlStandalone
; } 
 341     void setXMLEncoding(const String
& encoding
) { m_xmlEncoding 
= encoding
; } // read-only property, only to be set from XMLTokenizer 
 342     void setXMLVersion(const String
&, ExceptionCode
&); 
 343     void setXMLStandalone(bool, ExceptionCode
&); 
 345     String 
documentURI() const { return m_documentURI
; } 
 346     void setDocumentURI(const String
&); 
 348     virtual KURL 
baseURI() const; 
 350     PassRefPtr
<Node
> adoptNode(PassRefPtr
<Node
> source
, ExceptionCode
&); 
 352     PassRefPtr
<HTMLCollection
> images(); 
 353     PassRefPtr
<HTMLCollection
> embeds(); 
 354     PassRefPtr
<HTMLCollection
> plugins(); // an alias for embeds() required for the JS DOM bindings. 
 355     PassRefPtr
<HTMLCollection
> applets(); 
 356     PassRefPtr
<HTMLCollection
> links(); 
 357     PassRefPtr
<HTMLCollection
> forms(); 
 358     PassRefPtr
<HTMLCollection
> anchors(); 
 359     PassRefPtr
<HTMLCollection
> all(); 
 360     PassRefPtr
<HTMLCollection
> objects(); 
 361     PassRefPtr
<HTMLCollection
> scripts(); 
 362     PassRefPtr
<HTMLCollection
> windowNamedItems(const String
& name
); 
 363     PassRefPtr
<HTMLCollection
> documentNamedItems(const String
& name
); 
 365     // Find first anchor with the given name. 
 366     // First searches for an element with the given ID, but if that fails, then looks 
 367     // for an anchor with the given name. ID matching is always case sensitive, but 
 368     // Anchor name matching is case sensitive in strict mode and not case sensitive in 
 369     // quirks mode for historical compatibility reasons. 
 370     Element
* findAnchor(const String
& name
); 
 372     HTMLCollection::CollectionInfo
* collectionInfo(HTMLCollection::Type type
) 
 374         ASSERT(type 
>= HTMLCollection::FirstUnnamedDocumentCachedType
); 
 375         unsigned index 
= type 
- HTMLCollection::FirstUnnamedDocumentCachedType
; 
 376         ASSERT(index 
< HTMLCollection::NumUnnamedDocumentCachedTypes
); 
 377         return &m_collectionInfo
[index
];  
 380     HTMLCollection::CollectionInfo
* nameCollectionInfo(HTMLCollection::Type
, const AtomicString
& name
); 
 382     // DOM methods overridden from  parent classes 
 384     virtual String 
nodeName() const; 
 385     virtual NodeType 
nodeType() const; 
 387     // Other methods (not part of DOM) 
 388     virtual bool isHTMLDocument() const { return false; } 
 389     virtual bool isImageDocument() const { return false; } 
 391     virtual bool isSVGDocument() const { return false; } 
 393     virtual bool isPluginDocument() const { return false; } 
 394     virtual bool isMediaDocument() const { return false; } 
 396     virtual bool isWMLDocument() const { return false; } 
 399     CSSStyleSelector
* styleSelector() const { return m_styleSelector
; } 
 401     Element
* getElementByAccessKey(const String
& key
) const; 
 404      * Updates the pending sheet count and then calls updateStyleSelector. 
 406     void removePendingSheet(); 
 409      * This method returns true if all top-level stylesheets have loaded (including 
 410      * any @imports that they may be loading). 
 412     bool haveStylesheetsLoaded() const 
 414         return m_pendingStylesheets 
<= 0 || m_ignorePendingStylesheets
 
 415 #if USE(LOW_BANDWIDTH_DISPLAY) 
 416             || m_inLowBandwidthDisplay
 
 422      * Increments the number of pending sheets.  The <link> elements 
 423      * invoke this to add themselves to the loading list. 
 425     void addPendingSheet() { m_pendingStylesheets
++; } 
 427     void addStyleSheetCandidateNode(Node
*, bool createdByParser
); 
 428     void removeStyleSheetCandidateNode(Node
*); 
 430     bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad
; } 
 431     void setGotoAnchorNeededAfterStylesheetsLoad(bool b
) { m_gotoAnchorNeededAfterStylesheetsLoad 
= b
; } 
 434      * Called when one or more stylesheets in the document may have been added, removed or changed. 
 436      * Creates a new style selector and assign it to this document. This is done by iterating through all nodes in 
 437      * document (or those before <BODY> in a HTML document), searching for stylesheets. Stylesheets can be contained in 
 438      * <LINK>, <STYLE> or <BODY> elements, as well as processing instructions (XML documents only). A list is 
 439      * constructed from these which is used to create the a new style selector which collates all of the stylesheets 
 440      * found and is used to calculate the derived styles for all rendering objects. 
 442     void updateStyleSelector(); 
 444     void recalcStyleSelector(); 
 446     bool usesDescendantRules() const { return m_usesDescendantRules
; } 
 447     void setUsesDescendantRules(bool b
) { m_usesDescendantRules 
= b
; } 
 448     bool usesSiblingRules() const { return m_usesSiblingRules
; } 
 449     void setUsesSiblingRules(bool b
) { m_usesSiblingRules 
= b
; } 
 450     bool usesFirstLineRules() const { return m_usesFirstLineRules
; } 
 451     void setUsesFirstLineRules(bool b
) { m_usesFirstLineRules 
= b
; } 
 452     bool usesFirstLetterRules() const { return m_usesFirstLetterRules
; } 
 453     void setUsesFirstLetterRules(bool b
) { m_usesFirstLetterRules 
= b
; } 
 454     bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules
; } 
 455     void setUsesBeforeAfterRules(bool b
) { m_usesBeforeAfterRules 
= b
; } 
 457     // Machinery for saving and restoring state when you leave and then go back to a page. 
 458     void registerFormElementWithState(FormControlElementWithState
* e
) { m_formElementsWithState
.add(e
); } 
 459     void unregisterFormElementWithState(FormControlElementWithState
* e
) { m_formElementsWithState
.remove(e
); } 
 460     Vector
<String
> formElementsState() const; 
 461     unsigned formElementsCharacterCount() const; 
 462     void addAutoCorrectMarker(const Range 
*range
, const String
& word
, const String
& correction
); 
 463     void setStateForNewFormElements(const Vector
<String
>&); 
 464     bool hasStateForNewFormElements() const; 
 465     bool takeStateForFormElement(AtomicStringImpl
* name
, AtomicStringImpl
* type
, String
& state
); 
 467     FrameView
* view() const; // can be NULL 
 468     Frame
* frame() const { return m_frame
; } // can be NULL 
 469     Page
* page() const; // can be NULL 
 470     Settings
* settings() const; // can be NULL 
 472     PassRefPtr
<Range
> createRange(); 
 474     PassRefPtr
<NodeIterator
> createNodeIterator(Node
* root
, unsigned whatToShow
, 
 475         PassRefPtr
<NodeFilter
>, bool expandEntityReferences
, ExceptionCode
&); 
 477     PassRefPtr
<TreeWalker
> createTreeWalker(Node
* root
, unsigned whatToShow
,  
 478         PassRefPtr
<NodeFilter
>, bool expandEntityReferences
, ExceptionCode
&); 
 480     // Special support for editing 
 481     PassRefPtr
<CSSStyleDeclaration
> createCSSStyleDeclaration(); 
 482     PassRefPtr
<EditingText
> createEditingTextNode(const String
&); 
 484     virtual void recalcStyle( StyleChange 
= NoChange 
); 
 485     virtual void updateRendering(); 
 487     void updateLayoutIgnorePendingStylesheets(); 
 488     static void updateDocumentsRendering(); 
 489     DocLoader
* docLoader() { return m_docLoader
; } 
 491     virtual void attach(); 
 492     virtual void detach(); 
 493     // Override ScriptExecutionContext methods to do additional work 
 494     void suspendActiveDOMObjects(); 
 495     void resumeActiveDOMObjects(); 
 496     void stopActiveDOMObjects(); 
 498     RenderArena
* renderArena() { return m_renderArena
; } 
 500     RenderView
* renderView() const; 
 502     void clearAXObjectCache(); 
 503     AXObjectCache
* axObjectCache() const; 
 505     // to get visually ordered hebrew and arabic pages right 
 506     void setVisuallyOrdered(); 
 508     void open(Document
* ownerDocument 
= 0); 
 511     void implicitClose(); 
 512     void cancelParsing(); 
 514     void write(const String
& text
, Document
* ownerDocument 
= 0); 
 515     void writeln(const String
& text
, Document
* ownerDocument 
= 0); 
 516     void finishParsing(); 
 519     bool wellFormed() const { return m_wellFormed
; } 
 521     const KURL
& url() const { return m_url
; } 
 522     void setURL(const KURL
&); 
 524     const KURL
& baseURL() const { return m_baseURL
; } 
 525     // Setting the BaseElementURL will change the baseURL. 
 526     void setBaseElementURL(const KURL
&); 
 528     const String
& baseTarget() const { return m_baseTarget
; } 
 529     // Setting the BaseElementTarget will change the baseTarget. 
 530     void setBaseElementTarget(const String
& baseTarget
) { m_baseTarget 
= baseTarget
; } 
 532     KURL 
completeURL(const String
&) const; 
 534     // from cachedObjectClient 
 535     virtual void setCSSStyleSheet(const String
& url
, const String
& charset
, const CachedCSSStyleSheet
*); 
 537 #if FRAME_LOADS_USER_STYLESHEET 
 538     void setUserStyleSheet(const String
& sheet
); 
 541     String 
userStyleSheet() const; 
 543     CSSStyleSheet
* elementSheet(); 
 544     CSSStyleSheet
* mappedElementSheet(); 
 545     virtual Tokenizer
* createTokenizer(); 
 546     Tokenizer
* tokenizer() { return m_tokenizer
; } 
 548     bool printing() const { return m_printing
; } 
 549     void setPrinting(bool p
) { m_printing 
= p
; } 
 551     enum ParseMode 
{ Compat
, AlmostStrict
, Strict 
}; 
 554     virtual void determineParseMode() {} 
 557     void setParseMode(ParseMode m
) { m_parseMode 
= m
; } 
 558     ParseMode 
parseMode() const { return m_parseMode
; } 
 560     bool inCompatMode() const { return m_parseMode 
== Compat
; } 
 561     bool inAlmostStrictMode() const { return m_parseMode 
== AlmostStrict
; } 
 562     bool inStrictMode() const { return m_parseMode 
== Strict
; } 
 564     void setParsing(bool); 
 565     bool parsing() const { return m_bParsing
; } 
 566     int minimumLayoutDelay(); 
 567     bool shouldScheduleLayout(); 
 568     int elapsedTime() const; 
 570     void setTextColor(const Color
& color
) { m_textColor 
= color
; } 
 571     Color 
textColor() const { return m_textColor
; } 
 573     const Color
& linkColor() const { return m_linkColor
; } 
 574     const Color
& visitedLinkColor() const { return m_visitedLinkColor
; } 
 575     const Color
& activeLinkColor() const { return m_activeLinkColor
; } 
 576     void setLinkColor(const Color
& c
) { m_linkColor 
= c
; } 
 577     void setVisitedLinkColor(const Color
& c
) { m_visitedLinkColor 
= c
; } 
 578     void setActiveLinkColor(const Color
& c
) { m_activeLinkColor 
= c
; } 
 579     void resetLinkColor(); 
 580     void resetVisitedLinkColor(); 
 581     void resetActiveLinkColor(); 
 583     MouseEventWithHitTestResults 
prepareMouseEvent(const HitTestRequest
&, const IntPoint
&, const PlatformMouseEvent
&); 
 585     virtual bool childTypeAllowed(NodeType
); 
 586     virtual PassRefPtr
<Node
> cloneNode(bool deep
); 
 588     virtual bool canReplaceChild(Node
* newChild
, Node
* oldChild
); 
 590     StyleSheetList
* styleSheets(); 
 592     /* Newly proposed CSS3 mechanism for selecting alternate 
 593        stylesheets using the DOM. May be subject to change as 
 596     String 
preferredStylesheetSet() const; 
 597     String 
selectedStylesheetSet() const; 
 598     void setSelectedStylesheetSet(const String
&); 
 600     bool setFocusedNode(PassRefPtr
<Node
>); 
 601     Node
* focusedNode() const { return m_focusedNode
.get(); } 
 603     // The m_ignoreAutofocus flag specifies whether or not the document has been changed by the user enough  
 604     // for WebCore to ignore the autofocus attribute on any form controls 
 605     bool ignoreAutofocus() const { return m_ignoreAutofocus
; }; 
 606     void setIgnoreAutofocus(bool shouldIgnore 
= true) { m_ignoreAutofocus 
= shouldIgnore
; }; 
 608     void setHoverNode(PassRefPtr
<Node
>); 
 609     Node
* hoverNode() const { return m_hoverNode
.get(); } 
 611     void setActiveNode(PassRefPtr
<Node
>); 
 612     Node
* activeNode() const { return m_activeNode
.get(); } 
 614     void focusedNodeRemoved(); 
 615     void removeFocusedNodeOfSubtree(Node
*, bool amongChildrenOnly 
= false); 
 616     void hoveredNodeDetached(Node
*); 
 617     void activeChainNodeDetached(Node
*); 
 619     // Updates for :target (CSS3 selector). 
 620     void setCSSTarget(Node
*); 
 621     Node
* getCSSTarget() const; 
 623     void setDocumentChanged(bool); 
 625     void attachNodeIterator(NodeIterator
*); 
 626     void detachNodeIterator(NodeIterator
*); 
 628     void attachRange(Range
*); 
 629     void detachRange(Range
*); 
 631     void nodeChildrenChanged(ContainerNode
*); 
 632     void nodeWillBeRemoved(Node
*); 
 634     void textInserted(Node
*, unsigned offset
, unsigned length
); 
 635     void textRemoved(Node
*, unsigned offset
, unsigned length
); 
 636     void textNodesMerged(Text
* oldNode
, unsigned offset
); 
 637     void textNodeSplit(Text
* oldNode
); 
 639     DOMWindow
* defaultView() const { return domWindow(); }  
 640     DOMWindow
* domWindow() const; 
 642     PassRefPtr
<Event
> createEvent(const String
& eventType
, ExceptionCode
&); 
 644     // keep track of what types of event listeners are registered, so we don't 
 645     // dispatch events unnecessarily 
 647         DOMSUBTREEMODIFIED_LISTENER          
= 0x01, 
 648         DOMNODEINSERTED_LISTENER             
= 0x02, 
 649         DOMNODEREMOVED_LISTENER              
= 0x04, 
 650         DOMNODEREMOVEDFROMDOCUMENT_LISTENER  
= 0x08, 
 651         DOMNODEINSERTEDINTODOCUMENT_LISTENER 
= 0x10, 
 652         DOMATTRMODIFIED_LISTENER             
= 0x20, 
 653         DOMCHARACTERDATAMODIFIED_LISTENER    
= 0x40, 
 654         OVERFLOWCHANGED_LISTENER             
= 0x80, 
 655         ANIMATIONEND_LISTENER                
= 0x100, 
 656         ANIMATIONSTART_LISTENER              
= 0x200, 
 657         ANIMATIONITERATION_LISTENER          
= 0x400, 
 658         TRANSITIONEND_LISTENER               
= 0x800 
 661     bool hasListenerType(ListenerType listenerType
) const { return (m_listenerTypes 
& listenerType
); } 
 662     void addListenerType(ListenerType listenerType
) { m_listenerTypes 
= m_listenerTypes 
| listenerType
; } 
 663     void addListenerTypeIfNeeded(const AtomicString
& eventType
); 
 665     CSSStyleDeclaration
* getOverrideStyle(Element
*, const String
& pseudoElt
); 
 667     void handleWindowEvent(Event
*, bool useCapture
); 
 668     void setWindowInlineEventListenerForType(const AtomicString
& eventType
, PassRefPtr
<EventListener
>); 
 669     EventListener
* windowInlineEventListenerForType(const AtomicString
& eventType
); 
 670     void removeWindowInlineEventListenerForType(const AtomicString
& eventType
); 
 672     void setWindowInlineEventListenerForTypeAndAttribute(const AtomicString
& eventType
, Attribute
*); 
 674     void addWindowEventListener(const AtomicString
& eventType
, PassRefPtr
<EventListener
>, bool useCapture
); 
 675     void removeWindowEventListener(const AtomicString
& eventType
, EventListener
*, bool useCapture
); 
 676     bool hasWindowEventListener(const AtomicString
& eventType
); 
 678     void addPendingFrameUnloadEventCount(); 
 679     void removePendingFrameUnloadEventCount(); 
 680     void addPendingFrameBeforeUnloadEventCount(); 
 681     void removePendingFrameBeforeUnloadEventCount(); 
 683     PassRefPtr
<EventListener
> createEventListener(const String
& functionName
, const String
& code
, Node
*); 
 686      * Searches through the document, starting from fromNode, for the next selectable element that comes after fromNode. 
 687      * The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes 
 688      * first (from lowest to highest), and then elements without tab indexes (in document order). 
 690      * @param fromNode The node from which to start searching. The node after this will be focused. May be null. 
 692      * @return The focus node that comes after fromNode 
 694      * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 
 696     Node
* nextFocusableNode(Node
* start
, KeyboardEvent
*); 
 699      * Searches through the document, starting from fromNode, for the previous selectable element (that comes _before_) 
 700      * fromNode. The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab 
 701      * indexes first (from lowest to highest), and then elements without tab indexes (in document order). 
 703      * @param fromNode The node from which to start searching. The node before this will be focused. May be null. 
 705      * @return The focus node that comes before fromNode 
 707      * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 
 709     Node
* previousFocusableNode(Node
* start
, KeyboardEvent
*); 
 711     int nodeAbsIndex(Node
*); 
 712     Node
* nodeWithAbsIndex(int absIndex
); 
 715      * Handles a HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called 
 716      * when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta 
 717      * tag. This enables scripts to use meta tags to perform refreshes and set expiry dates in addition to them being 
 718      * specified in a HTML file. 
 720      * @param equiv The http header name (value of the meta tag's "equiv" attribute) 
 721      * @param content The header value (value of the meta tag's "content" attribute) 
 723     void processHttpEquiv(const String
& equiv
, const String
& content
); 
 724     void processArguments(const String 
& features
, void *userData
, void (*argumentsCallback
)(const String
& keyString
, const String
& valueString
, Document 
* aDocument
, void* userData
)); 
 725     void processViewport(const String 
& features
); 
 726     void processFormatDetection(const String 
& features
); 
 728     void dispatchImageLoadEventSoon(ImageLoader
*); 
 729     void dispatchImageLoadEventsNow(); 
 730     void removeImage(ImageLoader
*); 
 732     // Returns the owning element in the parent document. 
 733     // Returns 0 if this is the top level document. 
 734     Element
* ownerElement() const; 
 736     String 
title() const { return m_title
; } 
 737     void setTitle(const String
&, Element
* titleElement 
= 0); 
 738     void removeTitle(Element
* titleElement
); 
 740     String 
cookie() const; 
 741     void setCookie(const String
&); 
 743     String 
referrer() const; 
 745     String 
domain() const; 
 746     void setDomain(const String
& newDomain
); 
 748     String 
lastModified() const; 
 750     const KURL
& cookieURL() const { return m_cookieURL
; } 
 752     const KURL
& policyBaseURL() const { return m_policyBaseURL
; } 
 753     void setPolicyBaseURL(const KURL
& url
) { m_policyBaseURL 
= url
; } 
 755     // The following implements the rule from HTML 4 for what valid names are. 
 756     // To get this right for all the XML cases, we probably have to improve this or move it 
 757     // and make it sensitive to the type of document. 
 758     static bool isValidName(const String
&); 
 760     // The following breaks a qualified name into a prefix and a local name. 
 761     // It also does a validity check, and returns false if the qualified name 
 762     // is invalid.  It also sets ExceptionCode when name is invalid. 
 763     static bool parseQualifiedName(const String
& qualifiedName
, String
& prefix
, String
& localName
, ExceptionCode
&); 
 765     // Checks to make sure prefix and namespace do not conflict (per DOM Core 3) 
 766     static bool hasPrefixNamespaceMismatch(const QualifiedName
&); 
 768     void addElementById(const AtomicString
& elementId
, Element 
*element
); 
 769     void removeElementById(const AtomicString
& elementId
, Element 
*element
); 
 771     void addImageMap(HTMLMapElement
*); 
 772     void removeImageMap(HTMLMapElement
*); 
 773     HTMLMapElement
* getImageMap(const String
& url
) const; 
 776     void setBody(PassRefPtr
<HTMLElement
>, ExceptionCode
&); 
 778     HTMLHeadElement
* head(); 
 780     bool execCommand(const String
& command
, bool userInterface 
= false, const String
& value 
= String()); 
 781     bool queryCommandEnabled(const String
& command
); 
 782     bool queryCommandIndeterm(const String
& command
); 
 783     bool queryCommandState(const String
& command
); 
 784     bool queryCommandSupported(const String
& command
); 
 785     String 
queryCommandValue(const String
& command
); 
 787     void addMarker(Range
*, DocumentMarker::MarkerType
, String description 
= String()); 
 788     void addMarker(Node
*, DocumentMarker
); 
 789     void copyMarkers(Node 
*srcNode
, unsigned startOffset
, int length
, Node 
*dstNode
, int delta
, DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 790     void removeMarkers(Range
*, DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 791     void removeMarkers(Node
*, unsigned startOffset
, int length
, DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 792     void removeMarkers(DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 793     void removeMarkers(Node
*); 
 794     void repaintMarkers(DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 795     void setRenderedRectForMarker(Node
*, DocumentMarker
, const IntRect
&); 
 796     void invalidateRenderedRectsForMarkersInRect(const IntRect
&); 
 797     void shiftMarkers(Node
*, unsigned startOffset
, int delta
, DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 799     DocumentMarker
* markerContainingPoint(const IntPoint
&, DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 800     Vector
<DocumentMarker
> markersForNode(Node
*); 
 801     Vector
<IntRect
> renderedRectsForMarkers(DocumentMarker::MarkerType 
= DocumentMarker::AllMarkers
); 
 803     // designMode support 
 804     enum InheritedBool 
{ off 
= false, on 
= true, inherit 
};     
 805     void setDesignMode(InheritedBool value
); 
 806     InheritedBool 
getDesignMode() const; 
 807     bool inDesignMode() const; 
 809     Document
* parentDocument() const; 
 810     Document
* topDocument() const; 
 812     int docID() const { return m_docID
; } 
 815     void applyXSLTransform(ProcessingInstruction
* pi
); 
 816     void setTransformSource(void* doc
); 
 817     const void* transformSource() { return m_transformSource
; } 
 818     PassRefPtr
<Document
> transformSourceDocument() { return m_transformSourceDocument
; } 
 819     void setTransformSourceDocument(Document
* doc
) { m_transformSourceDocument 
= doc
; } 
 824     XBLBindingManager
* bindingManager() const { return m_bindingManager
; } 
 827     void incDOMTreeVersion() { ++m_domtree_version
; } 
 828     unsigned domTreeVersion() const { return m_domtree_version
; } 
 830     void setDocType(PassRefPtr
<DocumentType
>); 
 832     virtual void finishedParsing(); 
 835     // XPathEvaluator methods 
 836     PassRefPtr
<XPathExpression
> createExpression(const String
& expression
, 
 837                                                  XPathNSResolver
* resolver
, 
 839     PassRefPtr
<XPathNSResolver
> createNSResolver(Node 
*nodeResolver
); 
 840     PassRefPtr
<XPathResult
> evaluate(const String
& expression
, 
 842                                      XPathNSResolver
* resolver
, 
 846 #endif // ENABLE(XPATH) 
 848     enum PendingSheetLayout 
{ NoLayoutWithPendingSheets
, DidLayoutWithPendingSheets
, IgnoreLayoutWithPendingSheets 
}; 
 850     bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout 
== DidLayoutWithPendingSheets
; } 
 852     void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle 
= true; } 
 854     const String
& iconURL() const { return m_iconURL
; } 
 855     void setIconURL(const String
& iconURL
, const String
& type
); 
 857     void setUseSecureKeyboardEntryWhenActive(bool); 
 858     bool useSecureKeyboardEntryWhenActive() const; 
 860 #if USE(LOW_BANDWIDTH_DISPLAY) 
 861     void setDocLoader(DocLoader
* loader
) { m_docLoader 
= loader
; } 
 862     bool inLowBandwidthDisplay() const { return m_inLowBandwidthDisplay
; } 
 863     void setLowBandwidthDisplay(bool lowBandWidth
) { m_inLowBandwidthDisplay 
= lowBandWidth
; } 
 866     void addNodeListCache() { ++m_numNodeListCaches
; } 
 867     void removeNodeListCache() { ASSERT(m_numNodeListCaches 
> 0); --m_numNodeListCaches
; } 
 868     bool hasNodeListCaches() const { return m_numNodeListCaches
; } 
 870     void updateFocusAppearanceSoon(); 
 871     void cancelFocusAppearanceUpdate(); 
 873     // FF method for accessing the selection added for compatability. 
 874     DOMSelection
* getSelection() const; 
 876     // Extension for manipulating canvas drawing contexts for use in CSS 
 877     CanvasRenderingContext2D
* getCSSCanvasContext(const String
& type
, const String
& name
, int width
, int height
); 
 878     HTMLCanvasElement
* getCSSCanvasElement(const String
& name
); 
 880     bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled
; } 
 881     void initDNSPrefetch(); 
 882     void parseDNSPrefetchControlHeader(const String
&); 
 884     virtual void reportException(const String
& errorMessage
, int lineNumber
, const String
& sourceURL
); 
 885     virtual void addMessage(MessageDestination
, MessageSource
, MessageLevel
, const String
& message
, unsigned lineNumber
, const String
& sourceURL
); 
 886     virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier
, const ScriptString
& sourceString
); 
 887     virtual void postTask(PassRefPtr
<Task
>); // Executes the task on context's thread asynchronously. 
 889     void addTimeout(int timeoutId
, DOMTimer
*); 
 890     void removeTimeout(int timeoutId
); 
 891     DOMTimer
* findTimeout(int timeoutId
); 
 893 #if ENABLE(TOUCH_EVENTS) 
 894 #include "DocumentIPhone.h" 
 898     Document(Frame
*, bool isXHTML
); 
 901     virtual void refScriptExecutionContext() { ref(); } 
 902     virtual void derefScriptExecutionContext() { deref(); } 
 904     virtual const KURL
& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls. 
 905     virtual KURL 
virtualCompleteURL(const String
&) const; // Same as completeURL() for the same reason as above. 
 907     CSSStyleSelector
* m_styleSelector
; 
 908     bool m_didCalculateStyleSelector
; 
 911     DocLoader
* m_docLoader
; 
 912     Tokenizer
* m_tokenizer
; 
 916     KURL m_url
;  // Document.URL: The URL from which this document was retrieved. 
 917     KURL m_baseURL
;  // Node.baseURI: The URL to use when resolving relative URLs. 
 918     KURL m_baseElementURL
;  // The URL set by the <base> element. 
 919     KURL m_cookieURL
;  // The URL to use for cookie access. 
 920     KURL m_policyBaseURL
;  // The policy URL for third-party cookie blocking. 
 922     // Document.documentURI: 
 923     // Although URL-like, Document.documentURI can actually be set to any 
 924     // string by content.  Document.documentURI affects m_baseURL unless the 
 925     // document contains a <base> element, in which case the <base> element 
 927     String m_documentURI
; 
 931     RefPtr
<DocumentType
> m_docType
; 
 932     mutable RefPtr
<DOMImplementation
> m_implementation
; 
 934     RefPtr
<StyleSheet
> m_sheet
; 
 935 #if FRAME_LOADS_USER_STYLESHEET 
 939     // Track the number of currently loading top-level stylesheets.  Sheets 
 940     // loaded using the @import directive are not included in this count. 
 941     // We use this count of pending sheets to detect when we can begin attaching 
 943     int m_pendingStylesheets
; 
 945     // But sometimes you need to ignore pending stylesheet count to 
 946     // force an immediate layout when requested by JS. 
 947     bool m_ignorePendingStylesheets
; 
 949     // If we do ignore the pending stylesheet count, then we need to add a boolean 
 950     // to track that this happened so that we can do a full repaint when the stylesheets 
 951     // do eventually load. 
 952     PendingSheetLayout m_pendingSheetLayout
; 
 954     bool m_hasNodesWithPlaceholderStyle
; 
 956     RefPtr
<CSSStyleSheet
> m_elemSheet
; 
 957     RefPtr
<CSSStyleSheet
> m_mappedElementSheet
; 
 961     bool m_ignoreAutofocus
; 
 963     ParseMode m_parseMode
; 
 967     RefPtr
<Node
> m_focusedNode
; 
 968     RefPtr
<Node
> m_hoverNode
; 
 969     RefPtr
<Node
> m_activeNode
; 
 970     mutable RefPtr
<Element
> m_documentElement
; 
 972     unsigned m_domtree_version
; 
 974     HashSet
<NodeIterator
*> m_nodeIterators
; 
 975     HashSet
<Range
*> m_ranges
; 
 977     unsigned short m_listenerTypes
; 
 979     RefPtr
<StyleSheetList
> m_styleSheets
; // All of the stylesheets that are currently in effect for our media type and stylesheet set. 
 980     ListHashSet
<Node
*> m_styleSheetCandidateNodes
; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>) 
 982     RegisteredEventListenerVector m_windowEventListeners
; 
 984     typedef HashMap
<FormElementKey
, Vector
<String
>, FormElementKeyHash
, FormElementKeyHashTraits
> FormElementStateMap
; 
 985     ListHashSet
<FormControlElementWithState
*> m_formElementsWithState
; 
 986     FormElementStateMap m_stateForNewFormElements
; 
 989     Color m_visitedLinkColor
; 
 990     Color m_activeLinkColor
; 
 992     String m_preferredStylesheetSet
; 
 993     String m_selectedStylesheetSet
; 
 996     bool visuallyOrdered
; 
 999     bool m_inStyleRecalc
; 
1000     bool m_closeAfterStyleRecalc
; 
1001     bool m_usesDescendantRules
; 
1002     bool m_usesSiblingRules
; 
1003     bool m_usesFirstLineRules
; 
1004     bool m_usesFirstLetterRules
; 
1005     bool m_usesBeforeAfterRules
; 
1006     bool m_gotoAnchorNeededAfterStylesheetsLoad
; 
1007     bool m_isDNSPrefetchEnabled
; 
1008     bool m_haveExplicitlyDisabledDNSPrefetch
; 
1009     bool m_frameElementsShouldIgnoreScrolling
; 
1012     bool m_titleSetExplicitly
; 
1013     RefPtr
<Element
> m_titleElement
; 
1015     RenderArena
* m_renderArena
; 
1017     typedef std::pair
<Vector
<DocumentMarker
>, Vector
<IntRect
> > MarkerMapVectorPair
; 
1018     typedef HashMap
<RefPtr
<Node
>, MarkerMapVectorPair
*> MarkerMap
; 
1019     MarkerMap m_markers
; 
1021     mutable AXObjectCache
* m_axObjectCache
; 
1023     Vector
<ImageLoader
*> m_imageLoadEventDispatchSoonList
; 
1024     Vector
<ImageLoader
*> m_imageLoadEventDispatchingList
; 
1025     Timer
<Document
> m_imageLoadEventTimer
; 
1027     Timer
<Document
> m_updateFocusAppearanceTimer
; 
1031     bool m_processingLoadEvent
; 
1033     bool m_overMinimumLayoutThreshold
; 
1036     void* m_transformSource
; 
1037     RefPtr
<Document
> m_transformSourceDocument
; 
1041     XBLBindingManager
* m_bindingManager
; // The access point through which documents and elements communicate with XBL. 
1044     typedef HashMap
<AtomicStringImpl
*, HTMLMapElement
*> ImageMapsByName
; 
1045     ImageMapsByName m_imageMapsByName
; 
1047     HashSet
<Node
*> m_disconnectedNodesWithEventListeners
; 
1049     int m_docID
; // A unique document identifier used for things like document-specific mapped attributes. 
1051     String m_xmlEncoding
; 
1052     String m_xmlVersion
; 
1053     bool m_xmlStandalone
; 
1055     String m_contentLanguage
; 
1058     bool inPageCache() const { return m_inPageCache
; } 
1059     void setInPageCache(bool flag
); 
1061     // Elements can register themselves for the "documentWillBecomeInactive()" and   
1062     // "documentDidBecomeActive()" callbacks 
1063     void registerForDocumentActivationCallbacks(Element
*); 
1064     void unregisterForDocumentActivationCallbacks(Element
*); 
1065     void documentWillBecomeInactive(); 
1066     void documentDidBecomeActive(); 
1068     void registerForMediaVolumeCallbacks(Element
*); 
1069     void unregisterForMediaVolumeCallbacks(Element
*); 
1070     void mediaVolumeDidChange(); 
1072     void setShouldCreateRenderers(bool); 
1073     bool shouldCreateRenderers(); 
1075     void setDecoder(PassRefPtr
<TextResourceDecoder
>); 
1076     TextResourceDecoder
* decoder() const { return m_decoder
.get(); } 
1078     String 
displayStringModifiedByEncoding(const String
& str
) const { 
1080             return m_decoder
->encoding().displayString(str
.impl()); 
1083     PassRefPtr
<StringImpl
> displayStringModifiedByEncoding(PassRefPtr
<StringImpl
> str
) const { 
1085             return m_decoder
->encoding().displayString(str
); 
1088     void displayBufferModifiedByEncoding(UChar
* buffer
, unsigned len
) const { 
1090             m_decoder
->encoding().displayBuffer(buffer
, len
); 
1093     // Quirk for the benefit of Apple's Dictionary application. 
1094     void setFrameElementsShouldIgnoreScrolling(bool ignore
) { m_frameElementsShouldIgnoreScrolling 
= ignore
; } 
1095     bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling
; } 
1097 #if ENABLE(DASHBOARD_SUPPORT) 
1098     void setDashboardRegionsDirty(bool f
) { m_dashboardRegionsDirty 
= f
; } 
1099     bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty
; } 
1100     bool hasDashboardRegions () const { return m_hasDashboardRegions
; } 
1101     void setHasDashboardRegions (bool f
) { m_hasDashboardRegions 
= f
; } 
1102     const Vector
<DashboardRegionValue
>& dashboardRegions() const; 
1103     void setDashboardRegions(const Vector
<DashboardRegionValue
>&); 
1106     void removeAllEventListenersFromAllNodes(); 
1108     void registerDisconnectedNodeWithEventListeners(Node
*); 
1109     void unregisterDisconnectedNodeWithEventListeners(Node
*); 
1111     HTMLFormElement::CheckedRadioButtons
& checkedRadioButtons() { return m_checkedRadioButtons
; } 
1114     const SVGDocumentExtensions
* svgExtensions(); 
1115     SVGDocumentExtensions
* accessSVGExtensions(); 
1118     void initSecurityContext(); 
1120     // Explicitly override the security origin for this document. 
1121     // Note: It is dangerous to change the security origin of a document 
1122     //       that already contains content. 
1123     void setSecurityOrigin(SecurityOrigin
*); 
1125     bool processingLoadEvent() const { return m_processingLoadEvent
; } 
1127 #if ENABLE(DATABASE) 
1128     void addOpenDatabase(Database
*); 
1129     void removeOpenDatabase(Database
*); 
1130     DatabaseThread
* databaseThread();   // Creates the thread as needed, but not if it has been already terminated. 
1131     void setHasOpenDatabases() { m_hasOpenDatabases 
= true; } 
1132     bool hasOpenDatabases() { return m_hasOpenDatabases
; } 
1133     void stopDatabases(); 
1136     void setUsingGeolocation(bool f
) { m_usingGeolocation 
= f
; } 
1137     bool usingGeolocation() const { return m_usingGeolocation
; }; 
1140     void resetWMLPageState(); 
1144     void clearXMLVersion() { m_xmlVersion 
= String(); } 
1148     void removeAllDisconnectedNodeEventListeners(); 
1149     void imageLoadEventTimerFired(Timer
<Document
>*); 
1150     void updateFocusAppearanceTimerFired(Timer
<Document
>*); 
1151     void updateBaseURL(); 
1153     void cacheDocumentElement() const; 
1155     RenderObject
* m_savedRenderer
; 
1158     RefPtr
<TextResourceDecoder
> m_decoder
; 
1160     // We maintain the invariant that m_duplicateIds is the count of all elements with a given ID 
1161     // excluding the one referenced in m_elementsById, if any. This means it one less than the total count 
1162     // when the first node with a given ID is cached, otherwise the same as the total count. 
1163     mutable HashMap
<AtomicStringImpl
*, Element
*> m_elementsById
; 
1164     mutable HashCountedSet
<AtomicStringImpl
*> m_duplicateIds
; 
1166     mutable HashMap
<StringImpl
*, Element
*, CaseFoldingHash
> m_elementsByAccessKey
; 
1168     InheritedBool m_designMode
; 
1170     int m_selfOnlyRefCount
; 
1172     HTMLFormElement::CheckedRadioButtons m_checkedRadioButtons
; 
1174     typedef HashMap
<AtomicStringImpl
*, HTMLCollection::CollectionInfo
*> NamedCollectionMap
; 
1175     HTMLCollection::CollectionInfo m_collectionInfo
[HTMLCollection::NumUnnamedDocumentCachedTypes
]; 
1176     NamedCollectionMap m_nameCollectionInfo
[HTMLCollection::NumNamedDocumentCachedTypes
]; 
1179     RefPtr
<XPathEvaluator
> m_xpathEvaluator
; 
1183     OwnPtr
<SVGDocumentExtensions
> m_svgExtensions
; 
1186 #if ENABLE(DASHBOARD_SUPPORT) 
1187     Vector
<DashboardRegionValue
> m_dashboardRegions
; 
1188     bool m_hasDashboardRegions
; 
1189     bool m_dashboardRegionsDirty
; 
1192     HashMap
<String
, RefPtr
<HTMLCanvasElement
> > m_cssCanvasElements
; 
1194     mutable bool m_accessKeyMapValid
; 
1195     bool m_createRenderers
; 
1199     HashSet
<Element
*> m_documentActivationCallbackElements
; 
1200     HashSet
<Element
*> m_mediaVolumeCallbackElements
; 
1202     bool m_useSecureKeyboardEntryWhenActive
; 
1206     unsigned m_numNodeListCaches
; 
1209     typedef HashMap
<WebCore::Node
*, JSNode
*> JSWrapperCache
; 
1210     JSWrapperCache
& wrapperCache() { return m_wrapperCache
; } 
1212     JSWrapperCache m_wrapperCache
; 
1214 #if ENABLE(DATABASE) 
1215     RefPtr
<DatabaseThread
> m_databaseThread
; 
1216     bool m_hasOpenDatabases
;    // This never changes back to false, even as the database thread is closed. 
1217     typedef HashSet
<Database
*> DatabaseSet
; 
1218     OwnPtr
<DatabaseSet
> m_openDatabaseSet
; 
1221     bool m_usingGeolocation
; 
1223 #if USE(LOW_BANDWIDTH_DISPLAY) 
1224     bool m_inLowBandwidthDisplay
; 
1227     typedef HashMap
<int, DOMTimer
*> TimeoutsMap
; 
1228     TimeoutsMap m_timeouts
; 
1231     void addAutoSizingNode (Node 
*node
, float size
); 
1232     void validateAutoSizingNodes (); 
1233     void resetAutoSizingNodes(); 
1235     void incrementScrollEventListenersCount(); 
1236     void decrementScrollEventListenersCount(); 
1238     void incrementTotalImageDataSize(CachedImage
* image
); 
1239     void decrementTotalImageDataSize(CachedImage
* image
); 
1240     unsigned long totalImageDataSize(); 
1242     void incrementAnimatedImageDataCount(unsigned count
); 
1243     unsigned long animatedImageDataCount(); 
1245     typedef HashMap
<TextAutoSizingKey
, RefPtr
<TextAutoSizingValue
>, TextAutoSizingHash
, TextAutoSizingTraits
> TextAutoSizingMap
; 
1246     TextAutoSizingMap m_textAutoSizedNodes
; 
1248     unsigned m_scrollEventListenerCount
; 
1250     HashCountedSet
<CachedImage
*> m_documentImages
; 
1252     unsigned long m_totalImageDataSize
; 
1253     unsigned long m_animatedImageDataCount
; 
1256 inline bool Document::hasElementWithId(AtomicStringImpl
* id
) const 
1259     return m_elementsById
.contains(id
) || m_duplicateIds
.contains(id
); 
1262 inline bool Node::isDocumentNode() const 
1264     return this == m_document
.get(); 
1267 } // namespace WebCore 
1269 #endif // Document_h