summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/Document.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/dom/Document.h
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/dom/Document.h')
-rw-r--r--WebCore/dom/Document.h347
1 files changed, 245 insertions, 102 deletions
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index a4c935b..f674731 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -3,7 +3,7 @@
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -28,10 +28,11 @@
#include "Attr.h"
#include "Color.h"
#include "DeprecatedPtrList.h"
-#include "DeprecatedValueList.h"
#include "DocumentMarker.h"
#include "HTMLCollection.h"
#include "HTMLFormElement.h"
+#include "KURL.h"
+#include "ScriptExecutionContext.h"
#include "StringHash.h"
#include "Timer.h"
#include <wtf/HashCountedSet.h>
@@ -40,7 +41,7 @@
// FIXME: We should move Mac off of the old Frame-based user stylesheet loading
// code and onto the new code in Page. We can't do that until the code in Page
// supports non-file: URLs, however.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(QT)
#define FRAME_LOADS_USER_STYLESHEET 1
#else
#define FRAME_LOADS_USER_STYLESHEET 0
@@ -52,12 +53,16 @@ namespace WebCore {
class Attr;
class Attribute;
class CDATASection;
+ class CachedCSSStyleSheet;
+ class CanvasRenderingContext2D;
+ class CharacterData;
class CSSStyleDeclaration;
class CSSStyleSelector;
class CSSStyleSheet;
class Comment;
class Database;
class DOMImplementation;
+ class DOMSelection;
class DOMWindow;
class DatabaseThread;
class DocLoader;
@@ -70,20 +75,20 @@ namespace WebCore {
class EventListener;
class Frame;
class FrameView;
+ class HTMLCanvasElement;
class HTMLDocument;
class HTMLElement;
class HTMLFormControlElementWithState;
class HTMLFormElement;
class HTMLHeadElement;
- class HTMLImageLoader;
class HTMLInputElement;
class HTMLMapElement;
+ class ImageLoader;
class IntPoint;
+ class JSNode;
class MouseEventWithHitTestResults;
- class NameNodeList;
class NodeFilter;
class NodeIterator;
- class NodeList;
class Page;
class PlatformMouseEvent;
class ProcessingInstruction;
@@ -98,22 +103,27 @@ namespace WebCore {
class TextResourceDecoder;
class Tokenizer;
class TreeWalker;
+ class XMLHttpRequest;
+
+#if ENABLE(SVG)
+ class SVGDocumentExtensions;
+#endif
+
#if ENABLE(XBL)
class XBLBindingManager;
#endif
+
#if ENABLE(XPATH)
class XPathEvaluator;
class XPathExpression;
class XPathNSResolver;
class XPathResult;
#endif
-
- struct DashboardRegionValue;
- struct HitTestRequest;
-#if ENABLE(SVG)
- class SVGDocumentExtensions;
+#if ENABLE(DASHBOARD_SUPPORT)
+ struct DashboardRegionValue;
#endif
+ struct HitTestRequest;
typedef int ExceptionCode;
@@ -123,17 +133,28 @@ public:
~FormElementKey();
FormElementKey(const FormElementKey&);
FormElementKey& operator=(const FormElementKey&);
+
AtomicStringImpl* name() const { return m_name; }
AtomicStringImpl* type() const { return m_type; }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ FormElementKey(WTF::HashTableDeletedValueType) : m_name(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_name == hashTableDeletedValue(); }
+
private:
void ref() const;
void deref() const;
+
+ static AtomicStringImpl* hashTableDeletedValue() { return reinterpret_cast<AtomicStringImpl*>(-1); }
+
AtomicStringImpl* m_name;
AtomicStringImpl* m_type;
};
inline bool operator==(const FormElementKey& a, const FormElementKey& b)
- { return a.name() == b.name() && a.type() == b.type(); }
+{
+ return a.name() == b.name() && a.type() == b.type();
+}
struct FormElementKeyHash {
static unsigned hash(const FormElementKey&);
@@ -142,14 +163,26 @@ struct FormElementKeyHash {
};
struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> {
- static FormElementKey deletedValue();
+ static void constructDeletedValue(FormElementKey& slot) { new (&slot) FormElementKey(WTF::HashTableDeletedValue); }
+ static bool isDeletedValue(const FormElementKey& value) { return value.isHashTableDeletedValue(); }
};
-class Document : public ContainerNode {
+class Document : public ContainerNode, public ScriptExecutionContext {
public:
- Document(DOMImplementation*, Frame*, bool isXHTML = false);
+ static PassRefPtr<Document> create(Frame* frame)
+ {
+ return new Document(frame, false);
+ }
+ static PassRefPtr<Document> createXHTML(Frame* frame)
+ {
+ return new Document(frame, true);
+ }
virtual ~Document();
+ virtual bool isDocument() const { return true; }
+
+ using ContainerNode::ref;
+ using ContainerNode::deref;
virtual void removedLastRef();
// Nodes belonging to this document hold "self-only" references -
@@ -177,25 +210,26 @@ public:
// DOM methods & attributes for Document
- virtual DocumentType* doctype() const; // May return 0 for HTML documents
- DocumentType* realDocType() const { return m_docType.get(); }
+ DocumentType* doctype() const { return m_docType.get(); }
DOMImplementation* implementation() const;
- virtual void childrenChanged(bool changedByParser = false);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
Element* documentElement() const;
- virtual PassRefPtr<Element> createElement(const String& tagName, ExceptionCode&);
+ virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
PassRefPtr<DocumentFragment> createDocumentFragment ();
PassRefPtr<Text> createTextNode(const String& data);
PassRefPtr<Comment> createComment(const String& data);
PassRefPtr<CDATASection> createCDATASection(const String& data, ExceptionCode&);
PassRefPtr<ProcessingInstruction> createProcessingInstruction(const String& target, const String& data, ExceptionCode&);
- PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode& ec) { return createAttributeNS(String(), name, ec); }
- PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
+ PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode& ec) { return createAttributeNS(String(), name, ec, true); }
+ PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
PassRefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&);
PassRefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionCode&);
virtual PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser, ExceptionCode& ec);
Element* getElementById(const AtomicString&) const;
+ bool hasElementWithId(AtomicStringImpl* id) const;
+ bool containsMultipleElementsWithId(const AtomicString& elementId) { return m_duplicateIds.contains(elementId.impl()); }
Element* elementFromPoint(int x, int y) const;
String readyState() const;
@@ -218,10 +252,10 @@ public:
void setXMLVersion(const String&, ExceptionCode&);
void setXMLStandalone(bool, ExceptionCode&);
- String documentURI() const;
+ String documentURI() const { return m_documentURI; }
void setDocumentURI(const String&);
- virtual String baseURI() const;
+ virtual KURL baseURI() const;
PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
@@ -254,13 +288,13 @@ public:
virtual NodeType nodeType() const;
// Other methods (not part of DOM)
- virtual bool isDocumentNode() const { return true; }
virtual bool isHTMLDocument() const { return false; }
virtual bool isImageDocument() const { return false; }
#if ENABLE(SVG)
virtual bool isSVGDocument() const { return false; }
#endif
virtual bool isPluginDocument() const { return false; }
+ virtual bool isMediaDocument() const { return false; }
CSSStyleSelector* styleSelector() const { return m_styleSelector; }
@@ -290,6 +324,9 @@ public:
*/
void addPendingSheet() { m_pendingStylesheets++; }
+ void addStyleSheetCandidateNode(Node*, bool createdByParser);
+ void removeStyleSheetCandidateNode(Node*);
+
bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
@@ -331,17 +368,16 @@ public:
PassRefPtr<Range> createRange();
PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow,
- NodeFilter*, bool expandEntityReferences, ExceptionCode&);
+ PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow,
- NodeFilter*, bool expandEntityReferences, ExceptionCode&);
+ PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
// Special support for editing
PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration();
PassRefPtr<EditingText> createEditingTextNode(const String&);
virtual void recalcStyle( StyleChange = NoChange );
- static DeprecatedPtrList<Document>* changedDocuments;
virtual void updateRendering();
void updateLayout();
void updateLayoutIgnorePendingStylesheets();
@@ -351,40 +387,46 @@ public:
virtual void attach();
virtual void detach();
+ void clearFramePointer();
+
RenderArena* renderArena() { return m_renderArena; }
+ void clearAXObjectCache();
AXObjectCache* axObjectCache() const;
// to get visually ordered hebrew and arabic pages right
void setVisuallyOrdered();
- void open();
+ void open(Document* ownerDocument = 0);
void implicitOpen();
void close();
void implicitClose();
void cancelParsing();
- void write(const String& text);
- void writeln(const String& text);
+ void write(const String& text, Document* ownerDocument = 0);
+ void writeln(const String& text, Document* ownerDocument = 0);
void finishParsing();
void clear();
bool wellFormed() const { return m_wellFormed; }
- DeprecatedString url() const { return m_url.isEmpty() ? "about:blank" : m_url; }
- void setURL(const DeprecatedString& url);
+ const KURL& url() const { return m_url; }
+ void setURL(const KURL&);
+
+ const KURL& baseURL() const { return m_baseURL; }
+ // Setting the BaseElementURL will change the baseURL.
+ void setBaseElementURL(const KURL&);
- DeprecatedString baseURL() const { return m_baseURL.isEmpty() ? url() : m_baseURL; }
- void setBaseURL(const DeprecatedString& baseURL);
+ const String& baseTarget() const { return m_baseTarget; }
+ // Setting the BaseElementTarget will change the baseTarget.
+ void setBaseElementTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
- String baseTarget() const { return m_baseTarget; }
- void setBaseTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
+ KURL completeURL(const String&) const;
- DeprecatedString completeURL(const DeprecatedString &);
- String completeURL(const String&);
+ unsigned visitedLinkHash(const AtomicString& attributeURL) const;
// from cachedObjectClient
- virtual void setCSSStyleSheet(const String& url, const String& charset, const String& sheetStr);
+ virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
#if FRAME_LOADS_USER_STYLESHEET
void setUserStyleSheet(const String& sheet);
@@ -401,20 +443,18 @@ public:
void setPrinting(bool p) { m_printing = p; }
enum ParseMode { Compat, AlmostStrict, Strict };
-
- virtual void determineParseMode(const String&);
- void setParseMode(ParseMode m) { pMode = m; }
- ParseMode parseMode() const { return pMode; }
- bool inCompatMode() const { return pMode == Compat; }
- bool inAlmostStrictMode() const { return pMode == AlmostStrict; }
- bool inStrictMode() const { return pMode == Strict; }
+private:
+ virtual void determineParseMode() {}
- enum HTMLMode { Html3, Html4, XHtml };
-
- void setHTMLMode(HTMLMode m) { hMode = m; }
- HTMLMode htmlMode() const { return hMode; }
+public:
+ void setParseMode(ParseMode m) { m_parseMode = m; }
+ ParseMode parseMode() const { return m_parseMode; }
+ bool inCompatMode() const { return m_parseMode == Compat; }
+ bool inAlmostStrictMode() const { return m_parseMode == AlmostStrict; }
+ bool inStrictMode() const { return m_parseMode == Strict; }
+
void setParsing(bool);
bool parsing() const { return m_bParsing; }
int minimumLayoutDelay();
@@ -454,6 +494,11 @@ public:
bool setFocusedNode(PassRefPtr<Node>);
Node* focusedNode() const { return m_focusedNode.get(); }
+ // The m_ignoreAutofocus flag specifies whether or not the document has been changed by the user enough
+ // for WebCore to ignore the autofocus attribute on any form controls
+ bool ignoreAutofocus() const { return m_ignoreAutofocus; };
+ void setIgnoreAutofocus(bool shouldIgnore = true) { m_ignoreAutofocus = shouldIgnore; };
+
void setHoverNode(PassRefPtr<Node>);
Node* hoverNode() const { return m_hoverNode.get(); }
@@ -473,8 +518,21 @@ public:
void attachNodeIterator(NodeIterator*);
void detachNodeIterator(NodeIterator*);
- void notifyBeforeNodeRemoval(Node*);
- DOMWindow* defaultView() const;
+
+ void attachRange(Range*);
+ void detachRange(Range*);
+
+ void nodeChildrenChanged(ContainerNode*);
+ void nodeWillBeRemoved(Node*);
+
+ void textInserted(Node*, unsigned offset, unsigned length);
+ void textRemoved(Node*, unsigned offset, unsigned length);
+ void textNodesMerged(Text* oldNode, unsigned offset);
+ void textNodeSplit(Text* oldNode);
+
+ DOMWindow* defaultView() const { return domWindow(); }
+ DOMWindow* domWindow() const;
+
PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&);
// keep track of what types of event listeners are registered, so we don't
@@ -487,27 +545,37 @@ public:
DOMNODEINSERTEDINTODOCUMENT_LISTENER = 0x10,
DOMATTRMODIFIED_LISTENER = 0x20,
DOMCHARACTERDATAMODIFIED_LISTENER = 0x40,
- OVERFLOWCHANGED_LISTENER = 0x80
+ OVERFLOWCHANGED_LISTENER = 0x80,
+ ANIMATIONEND_LISTENER = 0x100,
+ ANIMATIONSTART_LISTENER = 0x200,
+ ANIMATIONITERATION_LISTENER = 0x400,
+ TRANSITIONEND_LISTENER = 0x800
};
bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
void addListenerType(ListenerType listenerType) { m_listenerTypes = m_listenerTypes | listenerType; }
+ void addListenerTypeIfNeeded(const AtomicString& eventType);
CSSStyleDeclaration* getOverrideStyle(Element*, const String& pseudoElt);
void handleWindowEvent(Event*, bool useCapture);
- void setHTMLWindowEventListener(const AtomicString &eventType, PassRefPtr<EventListener>);
- EventListener* getHTMLWindowEventListener(const AtomicString &eventType);
- void removeHTMLWindowEventListener(const AtomicString &eventType);
+ void setWindowInlineEventListenerForType(const AtomicString& eventType, PassRefPtr<EventListener>);
+ EventListener* windowInlineEventListenerForType(const AtomicString& eventType);
+ void removeWindowInlineEventListenerForType(const AtomicString& eventType);
- void setHTMLWindowEventListener(const AtomicString& eventType, Attribute*);
+ void setWindowInlineEventListenerForTypeAndAttribute(const AtomicString& eventType, Attribute*);
void addWindowEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
void removeWindowEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
bool hasWindowEventListener(const AtomicString& eventType);
-
- PassRefPtr<EventListener> createHTMLEventListener(const String& functionName, const String& code, Node*);
+ void addPendingFrameUnloadEventCount();
+ void removePendingFrameUnloadEventCount();
+ void addPendingFrameBeforeUnloadEventCount();
+ void removePendingFrameBeforeUnloadEventCount();
+
+ PassRefPtr<EventListener> createEventListener(const String& functionName, const String& code, Node*);
+
/**
* Searches through the document, starting from fromNode, for the next selectable element that comes after fromNode.
* The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes
@@ -556,9 +624,9 @@ public:
void processMetadataSettings(const String& content);
#endif
- void dispatchImageLoadEventSoon(HTMLImageLoader*);
+ void dispatchImageLoadEventSoon(ImageLoader*);
void dispatchImageLoadEventsNow();
- void removeImage(HTMLImageLoader*);
+ void removeImage(ImageLoader*);
// Returns the owning element in the parent document.
// Returns 0 if this is the top level document.
@@ -578,8 +646,10 @@ public:
String lastModified() const;
- String policyBaseURL() const { return m_policyBaseURL; }
- void setPolicyBaseURL(const String& s) { m_policyBaseURL = s; }
+ const KURL& cookieURL() const { return m_cookieURL; }
+
+ const KURL& policyBaseURL() const { return m_policyBaseURL; }
+ void setPolicyBaseURL(const KURL& url) { m_policyBaseURL = url; }
// The following implements the rule from HTML 4 for what valid names are.
// To get this right for all the XML cases, we probably have to improve this or move it
@@ -587,9 +657,12 @@ public:
static bool isValidName(const String&);
// The following breaks a qualified name into a prefix and a local name.
- // It also does a validity check, and returns false if the qualified name is invalid
- // (empty string or invalid characters).
- static bool parseQualifiedName(const String& qualifiedName, String& prefix, String& localName);
+ // It also does a validity check, and returns false if the qualified name
+ // is invalid. It also sets ExceptionCode when name is invalid.
+ static bool parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode&);
+
+ // Checks to make sure prefix and namespace do not conflict (per DOM Core 3)
+ static bool hasPrefixNamespaceMismatch(const QualifiedName&);
void addElementById(const AtomicString& elementId, Element *element);
void removeElementById(const AtomicString& elementId, Element *element);
@@ -603,8 +676,6 @@ public:
HTMLHeadElement* head();
- String toString() const;
-
bool execCommand(const String& command, bool userInterface = false, const String& value = String());
bool queryCommandEnabled(const String& command);
bool queryCommandIndeterm(const String& command);
@@ -679,11 +750,9 @@ public:
void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
- String iconURL();
+ const String& iconURL() const { return m_iconURL; }
void setIconURL(const String& iconURL, const String& type);
- bool isAllowedToLoadLocalResources() const { return m_isAllowedToLoadLocalResources; }
-
void setUseSecureKeyboardEntryWhenActive(bool);
bool useSecureKeyboardEntryWhenActive() const;
@@ -693,9 +762,9 @@ public:
void setLowBandwidthDisplay(bool lowBandWidth) { m_inLowBandwidthDisplay = lowBandWidth; }
#endif
- void addNodeList() { m_numNodeLists++; }
- void removeNodeList() { m_numNodeLists--; }
- bool hasNodeLists() const { return m_numNodeLists != 0; }
+ void addNodeListCache() { ++m_numNodeListCaches; }
+ void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; }
+ bool hasNodeListCaches() const { return m_numNodeListCaches; }
void updateFocusAppearanceSoon();
void cancelFocusAppearanceUpdate();
@@ -705,7 +774,38 @@ public:
int extraLayoutDelay() { return mExtraLayoutDelay; }
#endif
+ // FF method for accessing the selection added for compatability.
+ DOMSelection* getSelection() const;
+
+ // Extension for manipulating canvas drawing contexts for use in CSS
+ CanvasRenderingContext2D* getCSSCanvasContext(const String& type, const String& name, int width, int height);
+ HTMLCanvasElement* getCSSCanvasElement(const String& name);
+
+ bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
+ void initDNSPrefetch();
+ void parseDNSPrefetchControlHeader(const String&);
+
+#if ENABLE(TOUCH_EVENTS) // Android
+public:
+ typedef HashMap< RefPtr<Node>, unsigned > TouchListenerMap;
+
+ void addTouchEventListener(Node*);
+ void removeTouchEventListener(Node*);
+ const TouchListenerMap& touchEventListeners() const { return m_touchEventListeners; }
+
+private:
+ TouchListenerMap m_touchEventListeners;
+#endif
+
+protected:
+ Document(Frame*, bool isXHTML);
+
private:
+ virtual void refScriptExecutionContext() { ref(); }
+ virtual void derefScriptExecutionContext() { deref(); }
+
+ virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls.
+
CSSStyleSelector* m_styleSelector;
bool m_didCalculateStyleSelector;
@@ -713,12 +813,25 @@ private:
DocLoader* m_docLoader;
Tokenizer* m_tokenizer;
bool m_wellFormed;
- DeprecatedString m_url;
- DeprecatedString m_baseURL;
+
+ // Document URLs.
+ KURL m_url; // Document.URL: The URL from which this document was retrieved.
+ KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs.
+ KURL m_baseElementURL; // The URL set by the <base> element.
+ KURL m_cookieURL; // The URL to use for cookie access.
+ KURL m_policyBaseURL; // The policy URL for third-party cookie blocking.
+
+ // Document.documentURI:
+ // Although URL-like, Document.documentURI can actually be set to any
+ // string by content. Document.documentURI affects m_baseURL unless the
+ // document contains a <base> element, in which case the <base> element
+ // takes precedence.
+ String m_documentURI;
+
String m_baseTarget;
RefPtr<DocumentType> m_docType;
- RefPtr<DOMImplementation> m_implementation;
+ mutable RefPtr<DOMImplementation> m_implementation;
RefPtr<StyleSheet> m_sheet;
#if FRAME_LOADS_USER_STYLESHEET
@@ -746,9 +859,10 @@ private:
RefPtr<CSSStyleSheet> m_mappedElementSheet;
bool m_printing;
+
+ bool m_ignoreAutofocus;
- ParseMode pMode;
- HTMLMode hMode;
+ ParseMode m_parseMode;
Color m_textColor;
@@ -760,11 +874,13 @@ private:
unsigned m_domtree_version;
HashSet<NodeIterator*> m_nodeIterators;
+ HashSet<Range*> m_ranges;
unsigned short m_listenerTypes;
- RefPtr<StyleSheetList> m_styleSheets;
-
- typedef DeprecatedValueList<RefPtr<RegisteredEventListener> > RegisteredEventListenerList;
+
+ RefPtr<StyleSheetList> m_styleSheets; // All of the stylesheets that are currently in effect for our media type and stylesheet set.
+ ListHashSet<Node*> m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
+
RegisteredEventListenerList m_windowEventListeners;
typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
@@ -790,6 +906,9 @@ private:
bool m_usesFirstLetterRules;
bool m_gotoAnchorNeededAfterStylesheetsLoad;
+ bool m_isDNSPrefetchEnabled;
+ bool m_haveExplicitlyDisabledDNSPrefetch;
+
String m_title;
bool m_titleSetExplicitly;
RefPtr<Element> m_titleElement;
@@ -802,8 +921,8 @@ private:
mutable AXObjectCache* m_axObjectCache;
- DeprecatedPtrList<HTMLImageLoader> m_imageLoadEventDispatchSoonList;
- DeprecatedPtrList<HTMLImageLoader> m_imageLoadEventDispatchingList;
+ DeprecatedPtrList<ImageLoader> m_imageLoadEventDispatchSoonList;
+ DeprecatedPtrList<ImageLoader> m_imageLoadEventDispatchingList;
Timer<Document> m_imageLoadEventTimer;
Timer<Document> m_updateFocusAppearanceTimer;
@@ -826,8 +945,6 @@ private:
typedef HashMap<AtomicStringImpl*, HTMLMapElement*> ImageMapsByName;
ImageMapsByName m_imageMapsByName;
- String m_policyBaseURL;
-
HashSet<Node*> m_disconnectedNodesWithEventListeners;
int m_docID; // A unique document identifier used for things like document-specific mapped attributes.
@@ -842,27 +959,29 @@ public:
bool inPageCache();
void setInPageCache(bool flag);
- // Elements can register themselves for the "willSaveToCache()" and
- // "didRestoreFromCache()" callbacks
- void registerForCacheCallbacks(Element*);
- void unregisterForCacheCallbacks(Element*);
- void willSaveToCache();
- void didRestoreFromCache();
+ // Elements can register themselves for the "documentWillBecomeInactive()" and
+ // "documentDidBecomeActive()" callbacks
+ void registerForDocumentActivationCallbacks(Element*);
+ void unregisterForDocumentActivationCallbacks(Element*);
+ void documentWillBecomeInactive();
+ void documentDidBecomeActive();
void setShouldCreateRenderers(bool);
bool shouldCreateRenderers();
- void setDecoder(TextResourceDecoder*);
+ void setDecoder(PassRefPtr<TextResourceDecoder>);
TextResourceDecoder* decoder() const { return m_decoder.get(); }
UChar backslashAsCurrencySymbol() const;
+#if ENABLE(DASHBOARD_SUPPORT)
void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
bool hasDashboardRegions () const { return m_hasDashboardRegions; }
void setHasDashboardRegions (bool f) { m_hasDashboardRegions = f; }
const Vector<DashboardRegionValue>& dashboardRegions() const;
void setDashboardRegions(const Vector<DashboardRegionValue>&);
+#endif
void removeAllEventListenersFromAllNodes();
@@ -876,7 +995,7 @@ public:
SVGDocumentExtensions* accessSVGExtensions();
#endif
- void initSecurityOrigin();
+ void initSecurityContext();
SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
// Explicitly override the security origin for this document.
@@ -894,16 +1013,19 @@ public:
bool hasOpenDatabases() { return m_hasOpenDatabases; }
void stopDatabases();
#endif
+
+ void setUsingGeolocation(bool f) { m_usingGeolocation = f; }
+ bool usingGeolocation() const { return m_usingGeolocation; };
+
protected:
void clearXMLVersion() { m_xmlVersion = String(); }
private:
- bool shouldBeAllowedToLoadLocalResources() const;
-
void updateTitle();
void removeAllDisconnectedNodeEventListeners();
void imageLoadEventTimerFired(Timer<Document>*);
void updateFocusAppearanceTimerFired(Timer<Document>*);
+ void updateBaseURL();
RefPtr<SecurityOrigin> m_securityOrigin;
@@ -935,27 +1057,35 @@ private:
#endif
#if ENABLE(SVG)
- SVGDocumentExtensions* m_svgExtensions;
+ OwnPtr<SVGDocumentExtensions> m_svgExtensions;
#endif
+#if ENABLE(DASHBOARD_SUPPORT)
Vector<DashboardRegionValue> m_dashboardRegions;
bool m_hasDashboardRegions;
bool m_dashboardRegionsDirty;
+#endif
+
+ HashMap<String, RefPtr<HTMLCanvasElement> > m_cssCanvasElements;
mutable bool m_accessKeyMapValid;
bool m_createRenderers;
bool m_inPageCache;
String m_iconURL;
- HashSet<Element*> m_pageCacheCallbackElements;
-
- bool m_isAllowedToLoadLocalResources;
+ HashSet<Element*> m_documentActivationCallbackElements;
bool m_useSecureKeyboardEntryWhenActive;
bool m_isXHTML;
- unsigned m_numNodeLists;
+ unsigned m_numNodeListCaches;
+
+public:
+ typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache;
+ JSWrapperCache& wrapperCache() { return m_wrapperCache; }
+private:
+ JSWrapperCache m_wrapperCache;
#if ENABLE(DATABASE)
RefPtr<DatabaseThread> m_databaseThread;
@@ -963,15 +1093,28 @@ private:
typedef HashSet<Database*> DatabaseSet;
OwnPtr<DatabaseSet> m_openDatabaseSet;
#endif
+
+ bool m_usingGeolocation;
+
#if USE(LOW_BANDWIDTH_DISPLAY)
bool m_inLowBandwidthDisplay;
#endif
#ifdef ANDROID_MOBILE
int mExtraLayoutDelay;
#endif
-
};
+inline bool Document::hasElementWithId(AtomicStringImpl* id) const
+{
+ ASSERT(id);
+ return m_elementsById.contains(id) || m_duplicateIds.contains(id);
+}
+
+inline bool Node::isDocumentNode() const
+{
+ return this == m_document.get();
+}
+
} // namespace WebCore
#endif // Document_h