| 1 | /* |
|---|
| 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, 2009 Apple Inc. All rights reserved. |
|---|
| 7 | * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) |
|---|
| 8 | * |
|---|
| 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. |
|---|
| 13 | * |
|---|
| 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. |
|---|
| 18 | * |
|---|
| 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. |
|---|
| 23 | * |
|---|
| 24 | */ |
|---|
| 25 | |
|---|
| 26 | #ifndef Document_h |
|---|
| 27 | #define Document_h |
|---|
| 28 | |
|---|
| 29 | #include "CachedResourceHandle.h" |
|---|
| 30 | #include "CheckedRadioButtons.h" |
|---|
| 31 | #include "ContainerNode.h" |
|---|
| 32 | #include "CollectionCache.h" |
|---|
| 33 | #include "CollectionType.h" |
|---|
| 34 | #include "Color.h" |
|---|
| 35 | #include "DocumentMarker.h" |
|---|
| 36 | #include "ScriptExecutionContext.h" |
|---|
| 37 | #include "Timer.h" |
|---|
| 38 | #include <wtf/HashCountedSet.h> |
|---|
| 39 | #include <wtf/OwnPtr.h> |
|---|
| 40 | #include <wtf/PassOwnPtr.h> |
|---|
| 41 | |
|---|
| 42 | namespace WebCore { |
|---|
| 43 | |
|---|
| 44 | class Attr; |
|---|
| 45 | class AXObjectCache; |
|---|
| 46 | class CDATASection; |
|---|
| 47 | class CachedCSSStyleSheet; |
|---|
| 48 | class CachedScript; |
|---|
| 49 | class CanvasRenderingContext; |
|---|
| 50 | class CharacterData; |
|---|
| 51 | class CSSStyleDeclaration; |
|---|
| 52 | class CSSStyleSelector; |
|---|
| 53 | class CSSStyleSheet; |
|---|
| 54 | class Comment; |
|---|
| 55 | class Database; |
|---|
| 56 | class DOMImplementation; |
|---|
| 57 | class DOMSelection; |
|---|
| 58 | class DOMWindow; |
|---|
| 59 | class DatabaseThread; |
|---|
| 60 | class DocLoader; |
|---|
| 61 | class DocumentFragment; |
|---|
| 62 | class DocumentType; |
|---|
| 63 | class EditingText; |
|---|
| 64 | class Element; |
|---|
| 65 | class EntityReference; |
|---|
| 66 | class Event; |
|---|
| 67 | class EventListener; |
|---|
| 68 | class Frame; |
|---|
| 69 | class FrameView; |
|---|
| 70 | class HitTestRequest; |
|---|
| 71 | class HTMLCanvasElement; |
|---|
| 72 | class HTMLCollection; |
|---|
| 73 | class HTMLAllCollection; |
|---|
| 74 | class HTMLDocument; |
|---|
| 75 | class HTMLElement; |
|---|
| 76 | class HTMLFormElement; |
|---|
| 77 | class HTMLHeadElement; |
|---|
| 78 | class HTMLInputElement; |
|---|
| 79 | class HTMLMapElement; |
|---|
| 80 | class InspectorTimelineAgent; |
|---|
| 81 | class IntPoint; |
|---|
| 82 | class DOMWrapperWorld; |
|---|
| 83 | class JSNode; |
|---|
| 84 | class MouseEventWithHitTestResults; |
|---|
| 85 | class NodeFilter; |
|---|
| 86 | class NodeIterator; |
|---|
| 87 | class Page; |
|---|
| 88 | class PlatformMouseEvent; |
|---|
| 89 | class ProcessingInstruction; |
|---|
| 90 | class Range; |
|---|
| 91 | class RegisteredEventListener; |
|---|
| 92 | class RenderArena; |
|---|
| 93 | class RenderView; |
|---|
| 94 | class ScriptElementData; |
|---|
| 95 | class SecurityOrigin; |
|---|
| 96 | class SegmentedString; |
|---|
| 97 | class Settings; |
|---|
| 98 | class StyleSheet; |
|---|
| 99 | class StyleSheetList; |
|---|
| 100 | class Text; |
|---|
| 101 | class TextResourceDecoder; |
|---|
| 102 | class Tokenizer; |
|---|
| 103 | class TreeWalker; |
|---|
| 104 | class XMLHttpRequest; |
|---|
| 105 | |
|---|
| 106 | #if ENABLE(SVG) |
|---|
| 107 | class SVGDocumentExtensions; |
|---|
| 108 | #endif |
|---|
| 109 | |
|---|
| 110 | #if ENABLE(XSLT) |
|---|
| 111 | class TransformSource; |
|---|
| 112 | #endif |
|---|
| 113 | |
|---|
| 114 | #if ENABLE(XBL) |
|---|
| 115 | class XBLBindingManager; |
|---|
| 116 | #endif |
|---|
| 117 | |
|---|
| 118 | #if ENABLE(XPATH) |
|---|
| 119 | class XPathEvaluator; |
|---|
| 120 | class XPathExpression; |
|---|
| 121 | class XPathNSResolver; |
|---|
| 122 | class XPathResult; |
|---|
| 123 | #endif |
|---|
| 124 | |
|---|
| 125 | #if ENABLE(DASHBOARD_SUPPORT) |
|---|
| 126 | struct DashboardRegionValue; |
|---|
| 127 | #endif |
|---|
| 128 | |
|---|
| 129 | typedef int ExceptionCode; |
|---|
| 130 | |
|---|
| 131 | class FormElementKey { |
|---|
| 132 | public: |
|---|
| 133 | FormElementKey(AtomicStringImpl* = 0, AtomicStringImpl* = 0); |
|---|
| 134 | ~FormElementKey(); |
|---|
| 135 | FormElementKey(const FormElementKey&); |
|---|
| 136 | FormElementKey& operator=(const FormElementKey&); |
|---|
| 137 | |
|---|
| 138 | AtomicStringImpl* name() const { return m_name; } |
|---|
| 139 | AtomicStringImpl* type() const { return m_type; } |
|---|
| 140 | |
|---|
| 141 | // Hash table deleted values, which are only constructed and never copied or destroyed. |
|---|
| 142 | FormElementKey(WTF::HashTableDeletedValueType) : m_name(hashTableDeletedValue()) { } |
|---|
| 143 | bool isHashTableDeletedValue() const { return m_name == hashTableDeletedValue(); } |
|---|
| 144 | |
|---|
| 145 | private: |
|---|
| 146 | void ref() const; |
|---|
| 147 | void deref() const; |
|---|
| 148 | |
|---|
| 149 | static AtomicStringImpl* hashTableDeletedValue() { return reinterpret_cast<AtomicStringImpl*>(-1); } |
|---|
| 150 | |
|---|
| 151 | AtomicStringImpl* m_name; |
|---|
| 152 | AtomicStringImpl* m_type; |
|---|
| 153 | }; |
|---|
| 154 | |
|---|
| 155 | inline bool operator==(const FormElementKey& a, const FormElementKey& b) |
|---|
| 156 | { |
|---|
| 157 | return a.name() == b.name() && a.type() == b.type(); |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | struct FormElementKeyHash { |
|---|
| 161 | static unsigned hash(const FormElementKey&); |
|---|
| 162 | static bool equal(const FormElementKey& a, const FormElementKey& b) { return a == b; } |
|---|
| 163 | static const bool safeToCompareToEmptyOrDeleted = true; |
|---|
| 164 | }; |
|---|
| 165 | |
|---|
| 166 | struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> { |
|---|
| 167 | static void constructDeletedValue(FormElementKey& slot) { new (&slot) FormElementKey(WTF::HashTableDeletedValue); } |
|---|
| 168 | static bool isDeletedValue(const FormElementKey& value) { return value.isHashTableDeletedValue(); } |
|---|
| 169 | }; |
|---|
| 170 | |
|---|
| 171 | class Document : public ContainerNode, public ScriptExecutionContext { |
|---|
| 172 | public: |
|---|
| 173 | static PassRefPtr<Document> create(Frame* frame) |
|---|
| 174 | { |
|---|
| 175 | return adoptRef(new Document(frame, false)); |
|---|
| 176 | } |
|---|
| 177 | static PassRefPtr<Document> createXHTML(Frame* frame) |
|---|
| 178 | { |
|---|
| 179 | return adoptRef(new Document(frame, true)); |
|---|
| 180 | } |
|---|
| 181 | virtual ~Document(); |
|---|
| 182 | |
|---|
| 183 | using ContainerNode::ref; |
|---|
| 184 | using ContainerNode::deref; |
|---|
| 185 | |
|---|
| 186 | // Nodes belonging to this document hold "self-only" references - |
|---|
| 187 | // these are enough to keep the document from being destroyed, but |
|---|
| 188 | // not enough to keep it from removing its children. This allows a |
|---|
| 189 | // node that outlives its document to still have a valid document |
|---|
| 190 | // pointer without introducing reference cycles |
|---|
| 191 | |
|---|
| 192 | void selfOnlyRef() |
|---|
| 193 | { |
|---|
| 194 | ASSERT(!m_deletionHasBegun); |
|---|
| 195 | ++m_selfOnlyRefCount; |
|---|
| 196 | } |
|---|
| 197 | void selfOnlyDeref() |
|---|
| 198 | { |
|---|
| 199 | ASSERT(!m_deletionHasBegun); |
|---|
| 200 | --m_selfOnlyRefCount; |
|---|
| 201 | if (!m_selfOnlyRefCount && !refCount()) { |
|---|
| 202 | #ifndef NDEBUG |
|---|
| 203 | m_deletionHasBegun = true; |
|---|
| 204 | #endif |
|---|
| 205 | delete this; |
|---|
| 206 | } |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | // DOM methods & attributes for Document |
|---|
| 210 | |
|---|
| 211 | DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
|---|
| 212 | DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
|---|
| 213 | DEFINE_ATTRIBUTE_EVENT_LISTENER(click); |
|---|
| 214 | DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); |
|---|
| 215 | DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick); |
|---|
| 216 | DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter); |
|---|
| 217 | DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover); |
|---|
| 218 | DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave); |
|---|
| 219 | DEFINE_ATTRIBUTE_EVENT_LISTENER(drop); |
|---|
| 220 | DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); |
|---|
| 221 | DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); |
|---|
| 222 | DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); |
|---|
| 223 | DEFINE_ATTRIBUTE_EVENT_LISTENER(input); |
|---|
| 224 | DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); |
|---|
| 225 | DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); |
|---|
| 226 | DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress); |
|---|
| 227 | DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup); |
|---|
| 228 | DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown); |
|---|
| 229 | DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove); |
|---|
| 230 | DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout); |
|---|
| 231 | DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseover); |
|---|
| 232 | DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseup); |
|---|
| 233 | DEFINE_ATTRIBUTE_EVENT_LISTENER(mousewheel); |
|---|
| 234 | DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll); |
|---|
| 235 | DEFINE_ATTRIBUTE_EVENT_LISTENER(select); |
|---|
| 236 | DEFINE_ATTRIBUTE_EVENT_LISTENER(submit); |
|---|
| 237 | |
|---|
| 238 | DEFINE_ATTRIBUTE_EVENT_LISTENER(blur); |
|---|
| 239 | DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
|---|
| 240 | DEFINE_ATTRIBUTE_EVENT_LISTENER(focus); |
|---|
| 241 | DEFINE_ATTRIBUTE_EVENT_LISTENER(load); |
|---|
| 242 | |
|---|
| 243 | // WebKit extensions |
|---|
| 244 | DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut); |
|---|
| 245 | DEFINE_ATTRIBUTE_EVENT_LISTENER(cut); |
|---|
| 246 | DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy); |
|---|
| 247 | DEFINE_ATTRIBUTE_EVENT_LISTENER(copy); |
|---|
| 248 | DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste); |
|---|
| 249 | DEFINE_ATTRIBUTE_EVENT_LISTENER(paste); |
|---|
| 250 | DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); |
|---|
| 251 | DEFINE_ATTRIBUTE_EVENT_LISTENER(search); |
|---|
| 252 | DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); |
|---|
| 253 | |
|---|
| 254 | DocumentType* doctype() const { return m_docType.get(); } |
|---|
| 255 | |
|---|
| 256 | DOMImplementation* implementation() const; |
|---|
| 257 | |
|---|
| 258 | Element* documentElement() const |
|---|
| 259 | { |
|---|
| 260 | if (!m_documentElement) |
|---|
| 261 | cacheDocumentElement(); |
|---|
| 262 | return m_documentElement.get(); |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); |
|---|
| 266 | PassRefPtr<DocumentFragment> createDocumentFragment(); |
|---|
| 267 | PassRefPtr<Text> createTextNode(const String& data); |
|---|
| 268 | PassRefPtr<Comment> createComment(const String& data); |
|---|
| 269 | PassRefPtr<CDATASection> createCDATASection(const String& data, ExceptionCode&); |
|---|
| 270 | PassRefPtr<ProcessingInstruction> createProcessingInstruction(const String& target, const String& data, ExceptionCode&); |
|---|
| 271 | PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode&); |
|---|
| 272 | PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false); |
|---|
| 273 | PassRefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&); |
|---|
| 274 | PassRefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionCode&); |
|---|
| 275 | virtual PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&); |
|---|
| 276 | PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser); |
|---|
| 277 | Element* getElementById(const AtomicString&) const; |
|---|
| 278 | bool hasElementWithId(AtomicStringImpl* id) const; |
|---|
| 279 | bool containsMultipleElementsWithId(const AtomicString& elementId) { return m_duplicateIds.contains(elementId.impl()); } |
|---|
| 280 | |
|---|
| 281 | Element* elementFromPoint(int x, int y) const; |
|---|
| 282 | PassRefPtr<Range> caretRangeFromPoint(int x, int y); |
|---|
| 283 | |
|---|
| 284 | String readyState() const; |
|---|
| 285 | |
|---|
| 286 | String defaultCharset() const; |
|---|
| 287 | |
|---|
| 288 | // Synonyms backing similar DOM attributes. Use Document::encoding() to avoid virtual dispatch. |
|---|
| 289 | String inputEncoding() const { return Document::encoding(); } |
|---|
| 290 | String charset() const { return Document::encoding(); } |
|---|
| 291 | String characterSet() const { return Document::encoding(); } |
|---|
| 292 | |
|---|
| 293 | void setCharset(const String&); |
|---|
| 294 | |
|---|
| 295 | String contentLanguage() const { return m_contentLanguage; } |
|---|
| 296 | void setContentLanguage(const String& lang) { m_contentLanguage = lang; } |
|---|
| 297 | |
|---|
| 298 | String xmlEncoding() const { return m_xmlEncoding; } |
|---|
| 299 | String xmlVersion() const { return m_xmlVersion; } |
|---|
| 300 | bool xmlStandalone() const { return m_xmlStandalone; } |
|---|
| 301 | |
|---|
| 302 | void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLTokenizer |
|---|
| 303 | void setXMLVersion(const String&, ExceptionCode&); |
|---|
| 304 | void setXMLStandalone(bool, ExceptionCode&); |
|---|
| 305 | |
|---|
| 306 | String documentURI() const { return m_documentURI; } |
|---|
| 307 | void setDocumentURI(const String&); |
|---|
| 308 | |
|---|
| 309 | virtual KURL baseURI() const; |
|---|
| 310 | |
|---|
| 311 | PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&); |
|---|
| 312 | |
|---|
| 313 | PassRefPtr<HTMLCollection> images(); |
|---|
| 314 | PassRefPtr<HTMLCollection> embeds(); |
|---|
| 315 | PassRefPtr<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings. |
|---|
| 316 | PassRefPtr<HTMLCollection> applets(); |
|---|
| 317 | PassRefPtr<HTMLCollection> links(); |
|---|
| 318 | PassRefPtr<HTMLCollection> forms(); |
|---|
| 319 | PassRefPtr<HTMLCollection> anchors(); |
|---|
| 320 | PassRefPtr<HTMLCollection> objects(); |
|---|
| 321 | PassRefPtr<HTMLCollection> scripts(); |
|---|
| 322 | PassRefPtr<HTMLCollection> windowNamedItems(const String& name); |
|---|
| 323 | PassRefPtr<HTMLCollection> documentNamedItems(const String& name); |
|---|
| 324 | |
|---|
| 325 | PassRefPtr<HTMLAllCollection> all(); |
|---|
| 326 | |
|---|
| 327 | // Find first anchor with the given name. |
|---|
| 328 | // First searches for an element with the given ID, but if that fails, then looks |
|---|
| 329 | // for an anchor with the given name. ID matching is always case sensitive, but |
|---|
| 330 | // Anchor name matching is case sensitive in strict mode and not case sensitive in |
|---|
| 331 | // quirks mode for historical compatibility reasons. |
|---|
| 332 | Element* findAnchor(const String& name); |
|---|
| 333 | |
|---|
| 334 | CollectionCache* collectionInfo(CollectionType type) |
|---|
| 335 | { |
|---|
| 336 | ASSERT(type >= FirstUnnamedDocumentCachedType); |
|---|
| 337 | unsigned index = type - FirstUnnamedDocumentCachedType; |
|---|
| 338 | ASSERT(index < NumUnnamedDocumentCachedTypes); |
|---|
| 339 | return &m_collectionInfo[index]; |
|---|
| 340 | } |
|---|
| 341 | |
|---|
| 342 | CollectionCache* nameCollectionInfo(CollectionType, const AtomicString& name); |
|---|
| 343 | |
|---|
| 344 | // Other methods (not part of DOM) |
|---|
| 345 | virtual bool isHTMLDocument() const { return false; } |
|---|
| 346 | virtual bool isImageDocument() const { return false; } |
|---|
| 347 | #if ENABLE(SVG) |
|---|
| 348 | virtual bool isSVGDocument() const { return false; } |
|---|
| 349 | #else |
|---|
| 350 | static bool isSVGDocument() { return false; } |
|---|
| 351 | #endif |
|---|
| 352 | virtual bool isPluginDocument() const { return false; } |
|---|
| 353 | virtual bool isMediaDocument() const { return false; } |
|---|
| 354 | #if ENABLE(WML) |
|---|
| 355 | virtual bool isWMLDocument() const { return false; } |
|---|
| 356 | #endif |
|---|
| 357 | #if ENABLE(XHTMLMP) |
|---|
| 358 | bool isXHTMLMPDocument() const; |
|---|
| 359 | bool shouldProcessNoscriptElement() const { return m_shouldProcessNoScriptElement; } |
|---|
| 360 | void setShouldProcessNoscriptElement(bool shouldDo) { m_shouldProcessNoScriptElement = shouldDo; } |
|---|
| 361 | #endif |
|---|
| 362 | virtual bool isFrameSet() const { return false; } |
|---|
| 363 | |
|---|
| 364 | CSSStyleSelector* styleSelector() const { return m_styleSelector; } |
|---|
| 365 | |
|---|
| 366 | Element* getElementByAccessKey(const String& key) const; |
|---|
| 367 | |
|---|
| 368 | /** |
|---|
| 369 | * Updates the pending sheet count and then calls updateStyleSelector. |
|---|
| 370 | */ |
|---|
| 371 | void removePendingSheet(); |
|---|
| 372 | |
|---|
| 373 | /** |
|---|
| 374 | * This method returns true if all top-level stylesheets have loaded (including |
|---|
| 375 | * any @imports that they may be loading). |
|---|
| 376 | */ |
|---|
| 377 | bool haveStylesheetsLoaded() const |
|---|
| 378 | { |
|---|
| 379 | return m_pendingStylesheets <= 0 || m_ignorePendingStylesheets; |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | /** |
|---|
| 383 | * Increments the number of pending sheets. The <link> elements |
|---|
| 384 | * invoke this to add themselves to the loading list. |
|---|
| 385 | */ |
|---|
| 386 | void addPendingSheet() { m_pendingStylesheets++; } |
|---|
| 387 | |
|---|
| 388 | void addStyleSheetCandidateNode(Node*, bool createdByParser); |
|---|
| 389 | void removeStyleSheetCandidateNode(Node*); |
|---|
| 390 | |
|---|
| 391 | bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; } |
|---|
| 392 | void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; } |
|---|
| 393 | |
|---|
| 394 | /** |
|---|
| 395 | * Called when one or more stylesheets in the document may have been added, removed or changed. |
|---|
| 396 | * |
|---|
| 397 | * Creates a new style selector and assign it to this document. This is done by iterating through all nodes in |
|---|
| 398 | * document (or those before <BODY> in a HTML document), searching for stylesheets. Stylesheets can be contained in |
|---|
| 399 | * <LINK>, <STYLE> or <BODY> elements, as well as processing instructions (XML documents only). A list is |
|---|
| 400 | * constructed from these which is used to create the a new style selector which collates all of the stylesheets |
|---|
| 401 | * found and is used to calculate the derived styles for all rendering objects. |
|---|
| 402 | */ |
|---|
| 403 | void updateStyleSelector(); |
|---|
| 404 | |
|---|
| 405 | void recalcStyleSelector(); |
|---|
| 406 | |
|---|
| 407 | bool usesDescendantRules() const { return m_usesDescendantRules; } |
|---|
| 408 | void setUsesDescendantRules(bool b) { m_usesDescendantRules = b; } |
|---|
| 409 | bool usesSiblingRules() const { return m_usesSiblingRules; } |
|---|
| 410 | void setUsesSiblingRules(bool b) { m_usesSiblingRules = b; } |
|---|
| 411 | bool usesFirstLineRules() const { return m_usesFirstLineRules; } |
|---|
| 412 | void setUsesFirstLineRules(bool b) { m_usesFirstLineRules = b; } |
|---|
| 413 | bool usesFirstLetterRules() const { return m_usesFirstLetterRules; } |
|---|
| 414 | void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; } |
|---|
| 415 | bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules; } |
|---|
| 416 | void setUsesBeforeAfterRules(bool b) { m_usesBeforeAfterRules = b; } |
|---|
| 417 | bool usesRemUnits() const { return m_usesRemUnits; } |
|---|
| 418 | void setUsesRemUnits(bool b) { m_usesRemUnits = b; } |
|---|
| 419 | |
|---|
| 420 | // Machinery for saving and restoring state when you leave and then go back to a page. |
|---|
| 421 | void registerFormElementWithState(Element* e) { m_formElementsWithState.add(e); } |
|---|
| 422 | void unregisterFormElementWithState(Element* e) { m_formElementsWithState.remove(e); } |
|---|
| 423 | Vector<String> formElementsState() const; |
|---|
| 424 | void setStateForNewFormElements(const Vector<String>&); |
|---|
| 425 | bool hasStateForNewFormElements() const; |
|---|
| 426 | bool takeStateForFormElement(AtomicStringImpl* name, AtomicStringImpl* type, String& state); |
|---|
| 427 | |
|---|
| 428 | FrameView* view() const; // can be NULL |
|---|
| 429 | Frame* frame() const { return m_frame; } // can be NULL |
|---|
| 430 | Page* page() const; // can be NULL |
|---|
| 431 | Settings* settings() const; // can be NULL |
|---|
| 432 | #if ENABLE(INSPECTOR) |
|---|
| 433 | InspectorTimelineAgent* inspectorTimelineAgent() const; // can be NULL |
|---|
| 434 | #endif |
|---|
| 435 | |
|---|
| 436 | PassRefPtr<Range> createRange(); |
|---|
| 437 | |
|---|
| 438 | PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, |
|---|
| 439 | PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&); |
|---|
| 440 | |
|---|
| 441 | PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, |
|---|
| 442 | PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&); |
|---|
| 443 | |
|---|
| 444 | // Special support for editing |
|---|
| 445 | PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration(); |
|---|
| 446 | PassRefPtr<EditingText> createEditingTextNode(const String&); |
|---|
| 447 | |
|---|
| 448 | virtual void recalcStyle(StyleChange = NoChange); |
|---|
| 449 | bool childNeedsAndNotInStyleRecalc(); |
|---|
| 450 | virtual void updateStyleIfNeeded(); |
|---|
| 451 | void updateLayout(); |
|---|
| 452 | void updateLayoutIgnorePendingStylesheets(); |
|---|
| 453 | static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function. |
|---|
| 454 | DocLoader* docLoader() { return m_docLoader; } |
|---|
| 455 | |
|---|
| 456 | virtual void attach(); |
|---|
| 457 | virtual void detach(); |
|---|
| 458 | |
|---|
| 459 | RenderArena* renderArena() { return m_renderArena; } |
|---|
| 460 | |
|---|
| 461 | RenderView* renderView() const; |
|---|
| 462 | |
|---|
| 463 | void clearAXObjectCache(); |
|---|
| 464 | AXObjectCache* axObjectCache() const; |
|---|
| 465 | |
|---|
| 466 | // to get visually ordered hebrew and arabic pages right |
|---|
| 467 | void setVisuallyOrdered(); |
|---|
| 468 | |
|---|
| 469 | void open(Document* ownerDocument = 0); |
|---|
| 470 | void implicitOpen(); |
|---|
| 471 | void close(); |
|---|
| 472 | void implicitClose(); |
|---|
| 473 | void cancelParsing(); |
|---|
| 474 | |
|---|
| 475 | void write(const SegmentedString& text, Document* ownerDocument = 0); |
|---|
| 476 | void write(const String& text, Document* ownerDocument = 0); |
|---|
| 477 | void writeln(const String& text, Document* ownerDocument = 0); |
|---|
| 478 | void finishParsing(); |
|---|
| 479 | |
|---|
| 480 | bool wellFormed() const { return m_wellFormed; } |
|---|
| 481 | |
|---|
| 482 | const KURL& url() const { return m_url; } |
|---|
| 483 | void setURL(const KURL&); |
|---|
| 484 | |
|---|
| 485 | const KURL& baseURL() const { return m_baseURL; } |
|---|
| 486 | // Setting the BaseElementURL will change the baseURL. |
|---|
| 487 | void setBaseElementURL(const KURL&); |
|---|
| 488 | |
|---|
| 489 | const String& baseTarget() const { return m_baseTarget; } |
|---|
| 490 | // Setting the BaseElementTarget will change the baseTarget. |
|---|
| 491 | void setBaseElementTarget(const String& baseTarget) { m_baseTarget = baseTarget; } |
|---|
| 492 | |
|---|
| 493 | KURL completeURL(const String&) const; |
|---|
| 494 | |
|---|
| 495 | virtual String userAgent(const KURL&) const; |
|---|
| 496 | |
|---|
| 497 | CSSStyleSheet* pageUserSheet(); |
|---|
| 498 | void clearPageUserSheet(); |
|---|
| 499 | |
|---|
| 500 | const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets() const; |
|---|
| 501 | void clearPageGroupUserSheets(); |
|---|
| 502 | |
|---|
| 503 | CSSStyleSheet* elementSheet(); |
|---|
| 504 | CSSStyleSheet* mappedElementSheet(); |
|---|
| 505 | |
|---|
| 506 | virtual Tokenizer* createTokenizer(); |
|---|
| 507 | Tokenizer* tokenizer() { return m_tokenizer; } |
|---|
| 508 | |
|---|
| 509 | bool printing() const { return m_printing; } |
|---|
| 510 | void setPrinting(bool p) { m_printing = p; } |
|---|
| 511 | |
|---|
| 512 | enum ParseMode { Compat, AlmostStrict, Strict }; |
|---|
| 513 | |
|---|
| 514 | void setParseMode(ParseMode m) { m_parseMode = m; } |
|---|
| 515 | ParseMode parseMode() const { return m_parseMode; } |
|---|
| 516 | |
|---|
| 517 | bool inCompatMode() const { return m_parseMode == Compat; } |
|---|
| 518 | bool inAlmostStrictMode() const { return m_parseMode == AlmostStrict; } |
|---|
| 519 | bool inStrictMode() const { return m_parseMode == Strict; } |
|---|
| 520 | |
|---|
| 521 | void setParsing(bool); |
|---|
| 522 | bool parsing() const { return m_bParsing; } |
|---|
| 523 | int minimumLayoutDelay(); |
|---|
| 524 | bool shouldScheduleLayout(); |
|---|
| 525 | int elapsedTime() const; |
|---|
| 526 | |
|---|
| 527 | void setTextColor(const Color& color) { m_textColor = color; } |
|---|
| 528 | Color textColor() const { return m_textColor; } |
|---|
| 529 | |
|---|
| 530 | const Color& linkColor() const { return m_linkColor; } |
|---|
| 531 | const Color& visitedLinkColor() const { return m_visitedLinkColor; } |
|---|
| 532 | const Color& activeLinkColor() const { return m_activeLinkColor; } |
|---|
| 533 | void setLinkColor(const Color& c) { m_linkColor = c; } |
|---|
| 534 | void setVisitedLinkColor(const Color& c) { m_visitedLinkColor = c; } |
|---|
| 535 | void setActiveLinkColor(const Color& c) { m_activeLinkColor = c; } |
|---|
| 536 | void resetLinkColor(); |
|---|
| 537 | void resetVisitedLinkColor(); |
|---|
| 538 | void resetActiveLinkColor(); |
|---|
| 539 | |
|---|
| 540 | MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const IntPoint&, const PlatformMouseEvent&); |
|---|
| 541 | |
|---|
| 542 | StyleSheetList* styleSheets(); |
|---|
| 543 | |
|---|
| 544 | /* Newly proposed CSS3 mechanism for selecting alternate |
|---|
| 545 | stylesheets using the DOM. May be subject to change as |
|---|
| 546 | spec matures. - dwh |
|---|
| 547 | */ |
|---|
| 548 | String preferredStylesheetSet() const; |
|---|
| 549 | String selectedStylesheetSet() const; |
|---|
| 550 | void setSelectedStylesheetSet(const String&); |
|---|
| 551 | |
|---|
| 552 | bool setFocusedNode(PassRefPtr<Node>); |
|---|
| 553 | Node* focusedNode() const { return m_focusedNode.get(); } |
|---|
| 554 | |
|---|
| 555 | void getFocusableNodes(Vector<RefPtr<Node> >&); |
|---|
| 556 | |
|---|
| 557 | // The m_ignoreAutofocus flag specifies whether or not the document has been changed by the user enough |
|---|
| 558 | // for WebCore to ignore the autofocus attribute on any form controls |
|---|
| 559 | bool ignoreAutofocus() const { return m_ignoreAutofocus; }; |
|---|
| 560 | void setIgnoreAutofocus(bool shouldIgnore = true) { m_ignoreAutofocus = shouldIgnore; }; |
|---|
| 561 | |
|---|
| 562 | void setHoverNode(PassRefPtr<Node>); |
|---|
| 563 | Node* hoverNode() const { return m_hoverNode.get(); } |
|---|
| 564 | |
|---|
| 565 | void setActiveNode(PassRefPtr<Node>); |
|---|
| 566 | Node* activeNode() const { return m_activeNode.get(); } |
|---|
| 567 | |
|---|
| 568 | void focusedNodeRemoved(); |
|---|
| 569 | void removeFocusedNodeOfSubtree(Node*, bool amongChildrenOnly = false); |
|---|
| 570 | void hoveredNodeDetached(Node*); |
|---|
| 571 | void activeChainNodeDetached(Node*); |
|---|
| 572 | |
|---|
| 573 | // Updates for :target (CSS3 selector). |
|---|
| 574 | void setCSSTarget(Element*); |
|---|
| 575 | Element* cssTarget() const { return m_cssTarget; } |
|---|
| 576 | |
|---|
| 577 | void scheduleStyleRecalc(); |
|---|
| 578 | void unscheduleStyleRecalc(); |
|---|
| 579 | void styleRecalcTimerFired(Timer<Document>*); |
|---|
| 580 | |
|---|
| 581 | void attachNodeIterator(NodeIterator*); |
|---|
| 582 | void detachNodeIterator(NodeIterator*); |
|---|
| 583 | |
|---|
| 584 | void attachRange(Range*); |
|---|
| 585 | void detachRange(Range*); |
|---|
| 586 | |
|---|
| 587 | void nodeChildrenChanged(ContainerNode*); |
|---|
| 588 | void nodeWillBeRemoved(Node*); |
|---|
| 589 | |
|---|
| 590 | void textInserted(Node*, unsigned offset, unsigned length); |
|---|
| 591 | void textRemoved(Node*, unsigned offset, unsigned length); |
|---|
| 592 | void textNodesMerged(Text* oldNode, unsigned offset); |
|---|
| 593 | void textNodeSplit(Text* oldNode); |
|---|
| 594 | |
|---|
| 595 | DOMWindow* defaultView() const { return domWindow(); } |
|---|
| 596 | DOMWindow* domWindow() const; |
|---|
| 597 | |
|---|
| 598 | // Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists. |
|---|
| 599 | void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>); |
|---|
| 600 | EventListener* getWindowAttributeEventListener(const AtomicString& eventType); |
|---|
| 601 | void dispatchWindowEvent(PassRefPtr<Event>, PassRefPtr<EventTarget> = 0); |
|---|
| 602 | void dispatchWindowLoadEvent(); |
|---|
| 603 | |
|---|
| 604 | PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&); |
|---|
| 605 | |
|---|
| 606 | // keep track of what types of event listeners are registered, so we don't |
|---|
| 607 | // dispatch events unnecessarily |
|---|
| 608 | enum ListenerType { |
|---|
| 609 | DOMSUBTREEMODIFIED_LISTENER = 0x01, |
|---|
| 610 | DOMNODEINSERTED_LISTENER = 0x02, |
|---|
| 611 | DOMNODEREMOVED_LISTENER = 0x04, |
|---|
| 612 | DOMNODEREMOVEDFROMDOCUMENT_LISTENER = 0x08, |
|---|
| 613 | DOMNODEINSERTEDINTODOCUMENT_LISTENER = 0x10, |
|---|
| 614 | DOMATTRMODIFIED_LISTENER = 0x20, |
|---|
| 615 | DOMCHARACTERDATAMODIFIED_LISTENER = 0x40, |
|---|
| 616 | OVERFLOWCHANGED_LISTENER = 0x80, |
|---|
| 617 | ANIMATIONEND_LISTENER = 0x100, |
|---|
| 618 | ANIMATIONSTART_LISTENER = 0x200, |
|---|
| 619 | ANIMATIONITERATION_LISTENER = 0x400, |
|---|
| 620 | TRANSITIONEND_LISTENER = 0x800, |
|---|
| 621 | BEFORELOAD_LISTENER = 0x1000 |
|---|
| 622 | }; |
|---|
| 623 | |
|---|
| 624 | bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); } |
|---|
| 625 | void addListenerType(ListenerType listenerType) { m_listenerTypes = m_listenerTypes | listenerType; } |
|---|
| 626 | void addListenerTypeIfNeeded(const AtomicString& eventType); |
|---|
| 627 | |
|---|
| 628 | CSSStyleDeclaration* getOverrideStyle(Element*, const String& pseudoElt); |
|---|
| 629 | |
|---|
| 630 | /** |
|---|
| 631 | * Searches through the document, starting from fromNode, for the next selectable element that comes after fromNode. |
|---|
| 632 | * The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes |
|---|
| 633 | * first (from lowest to highest), and then elements without tab indexes (in document order). |
|---|
| 634 | * |
|---|
| 635 | * @param fromNode The node from which to start searching. The node after this will be focused. May be null. |
|---|
| 636 | * |
|---|
| 637 | * @return The focus node that comes after fromNode |
|---|
| 638 | * |
|---|
| 639 | * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 |
|---|
| 640 | */ |
|---|
| 641 | Node* nextFocusableNode(Node* start, KeyboardEvent*); |
|---|
| 642 | |
|---|
| 643 | /** |
|---|
| 644 | * Searches through the document, starting from fromNode, for the previous selectable element (that comes _before_) |
|---|
| 645 | * fromNode. The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab |
|---|
| 646 | * indexes first (from lowest to highest), and then elements without tab indexes (in document order). |
|---|
| 647 | * |
|---|
| 648 | * @param fromNode The node from which to start searching. The node before this will be focused. May be null. |
|---|
| 649 | * |
|---|
| 650 | * @return The focus node that comes before fromNode |
|---|
| 651 | * |
|---|
| 652 | * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 |
|---|
| 653 | */ |
|---|
| 654 | Node* previousFocusableNode(Node* start, KeyboardEvent*); |
|---|
| 655 | |
|---|
| 656 | int nodeAbsIndex(Node*); |
|---|
| 657 | Node* nodeWithAbsIndex(int absIndex); |
|---|
| 658 | |
|---|
| 659 | /** |
|---|
| 660 | * Handles a HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called |
|---|
| 661 | * when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta |
|---|
| 662 | * tag. This enables scripts to use meta tags to perform refreshes and set expiry dates in addition to them being |
|---|
| 663 | * specified in a HTML file. |
|---|
| 664 | * |
|---|
| 665 | * @param equiv The http header name (value of the meta tag's "equiv" attribute) |
|---|
| 666 | * @param content The header value (value of the meta tag's "content" attribute) |
|---|
| 667 | */ |
|---|
| 668 | void processHttpEquiv(const String& equiv, const String& content); |
|---|
| 669 | |
|---|
| 670 | // Returns the owning element in the parent document. |
|---|
| 671 | // Returns 0 if this is the top level document. |
|---|
| 672 | Element* ownerElement() const; |
|---|
| 673 | |
|---|
| 674 | String title() const { return m_title; } |
|---|
| 675 | void setTitle(const String&, Element* titleElement = 0); |
|---|
| 676 | void removeTitle(Element* titleElement); |
|---|
| 677 | |
|---|
| 678 | String cookie() const; |
|---|
| 679 | void setCookie(const String&); |
|---|
| 680 | |
|---|
| 681 | String referrer() const; |
|---|
| 682 | |
|---|
| 683 | String domain() const; |
|---|
| 684 | void setDomain(const String& newDomain, ExceptionCode&); |
|---|
| 685 | |
|---|
| 686 | String lastModified() const; |
|---|
| 687 | |
|---|
| 688 | const KURL& cookieURL() const { return m_cookieURL; } |
|---|
| 689 | |
|---|
| 690 | const KURL& firstPartyForCookies() const { return m_firstPartyForCookies; } |
|---|
| 691 | void setFirstPartyForCookies(const KURL& url) { m_firstPartyForCookies = url; } |
|---|
| 692 | |
|---|
| 693 | // The following implements the rule from HTML 4 for what valid names are. |
|---|
| 694 | // To get this right for all the XML cases, we probably have to improve this or move it |
|---|
| 695 | // and make it sensitive to the type of document. |
|---|
| 696 | static bool isValidName(const String&); |
|---|
| 697 | |
|---|
| 698 | // The following breaks a qualified name into a prefix and a local name. |
|---|
| 699 | // It also does a validity check, and returns false if the qualified name |
|---|
| 700 | // is invalid. It also sets ExceptionCode when name is invalid. |
|---|
| 701 | static bool parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode&); |
|---|
| 702 | |
|---|
| 703 | // Checks to make sure prefix and namespace do not conflict (per DOM Core 3) |
|---|
| 704 | static bool hasPrefixNamespaceMismatch(const QualifiedName&); |
|---|
| 705 | |
|---|
| 706 | void addElementById(const AtomicString& elementId, Element *element); |
|---|
| 707 | void removeElementById(const AtomicString& elementId, Element *element); |
|---|
| 708 | |
|---|
| 709 | void addImageMap(HTMLMapElement*); |
|---|
| 710 | void removeImageMap(HTMLMapElement*); |
|---|
| 711 | HTMLMapElement* getImageMap(const String& url) const; |
|---|
| 712 | |
|---|
| 713 | HTMLElement* body() const; |
|---|
| 714 | void setBody(PassRefPtr<HTMLElement>, ExceptionCode&); |
|---|
| 715 | |
|---|
| 716 | HTMLHeadElement* head(); |
|---|
| 717 | |
|---|
| 718 | bool execCommand(const String& command, bool userInterface = false, const String& value = String()); |
|---|
| 719 | bool queryCommandEnabled(const String& command); |
|---|
| 720 | bool queryCommandIndeterm(const String& command); |
|---|
| 721 | bool queryCommandState(const String& command); |
|---|
| 722 | bool queryCommandSupported(const String& command); |
|---|
| 723 | String queryCommandValue(const String& command); |
|---|
| 724 | |
|---|
| 725 | void addMarker(Range*, DocumentMarker::MarkerType, String description = String()); |
|---|
| 726 | void addMarker(Node*, DocumentMarker); |
|---|
| 727 | void copyMarkers(Node *srcNode, unsigned startOffset, int length, Node *dstNode, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 728 | void removeMarkers(Range*, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 729 | void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 730 | void removeMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 731 | void removeMarkers(Node*); |
|---|
| 732 | void repaintMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 733 | void setRenderedRectForMarker(Node*, DocumentMarker, const IntRect&); |
|---|
| 734 | void invalidateRenderedRectsForMarkersInRect(const IntRect&); |
|---|
| 735 | void shiftMarkers(Node*, unsigned startOffset, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 736 | void setMarkersActive(Range*, bool); |
|---|
| 737 | void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool); |
|---|
| 738 | |
|---|
| 739 | DocumentMarker* markerContainingPoint(const IntPoint&, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 740 | Vector<DocumentMarker> markersForNode(Node*); |
|---|
| 741 | Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); |
|---|
| 742 | |
|---|
| 743 | // designMode support |
|---|
| 744 | enum InheritedBool { off = false, on = true, inherit }; |
|---|
| 745 | void setDesignMode(InheritedBool value); |
|---|
| 746 | InheritedBool getDesignMode() const; |
|---|
| 747 | bool inDesignMode() const; |
|---|
| 748 | |
|---|
| 749 | Document* parentDocument() const; |
|---|
| 750 | Document* topDocument() const; |
|---|
| 751 | |
|---|
| 752 | int docID() const { return m_docID; } |
|---|
| 753 | |
|---|
| 754 | void executeScriptSoon(ScriptElementData*, CachedResourceHandle<CachedScript>); |
|---|
| 755 | |
|---|
| 756 | #if ENABLE(XSLT) |
|---|
| 757 | void applyXSLTransform(ProcessingInstruction* pi); |
|---|
| 758 | PassRefPtr<Document> transformSourceDocument() { return m_transformSourceDocument; } |
|---|
| 759 | void setTransformSourceDocument(Document* doc) { m_transformSourceDocument = doc; } |
|---|
| 760 | |
|---|
| 761 | void setTransformSource(PassOwnPtr<TransformSource>); |
|---|
| 762 | TransformSource* transformSource() const { return m_transformSource.get(); } |
|---|
| 763 | #endif |
|---|
| 764 | |
|---|
| 765 | #if ENABLE(XBL) |
|---|
| 766 | // XBL methods |
|---|
| 767 | XBLBindingManager* bindingManager() const { return m_bindingManager; } |
|---|
| 768 | #endif |
|---|
| 769 | |
|---|
| 770 | void incDOMTreeVersion() { ++m_domtree_version; } |
|---|
| 771 | unsigned domTreeVersion() const { return m_domtree_version; } |
|---|
| 772 | |
|---|
| 773 | void setDocType(PassRefPtr<DocumentType>); |
|---|
| 774 | |
|---|
| 775 | #if ENABLE(XPATH) |
|---|
| 776 | // XPathEvaluator methods |
|---|
| 777 | PassRefPtr<XPathExpression> createExpression(const String& expression, |
|---|
| 778 | XPathNSResolver* resolver, |
|---|
| 779 | ExceptionCode& ec); |
|---|
| 780 | PassRefPtr<XPathNSResolver> createNSResolver(Node *nodeResolver); |
|---|
| 781 | PassRefPtr<XPathResult> evaluate(const String& expression, |
|---|
| 782 | Node* contextNode, |
|---|
| 783 | XPathNSResolver* resolver, |
|---|
| 784 | unsigned short type, |
|---|
| 785 | XPathResult* result, |
|---|
| 786 | ExceptionCode& ec); |
|---|
| 787 | #endif // ENABLE(XPATH) |
|---|
| 788 | |
|---|
| 789 | enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets }; |
|---|
| 790 | |
|---|
| 791 | bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; } |
|---|
| 792 | |
|---|
| 793 | void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; } |
|---|
| 794 | |
|---|
| 795 | const String& iconURL() const { return m_iconURL; } |
|---|
| 796 | void setIconURL(const String& iconURL, const String& type); |
|---|
| 797 | |
|---|
| 798 | void setUseSecureKeyboardEntryWhenActive(bool); |
|---|
| 799 | bool useSecureKeyboardEntryWhenActive() const; |
|---|
| 800 | |
|---|
| 801 | void addNodeListCache() { ++m_numNodeListCaches; } |
|---|
| 802 | void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; } |
|---|
| 803 | bool hasNodeListCaches() const { return m_numNodeListCaches; } |
|---|
| 804 | |
|---|
| 805 | void updateFocusAppearanceSoon(); |
|---|
| 806 | void cancelFocusAppearanceUpdate(); |
|---|
| 807 | |
|---|
| 808 | // FF method for accessing the selection added for compatability. |
|---|
| 809 | DOMSelection* getSelection() const; |
|---|
| 810 | |
|---|
| 811 | // Extension for manipulating canvas drawing contexts for use in CSS |
|---|
| 812 | CanvasRenderingContext* getCSSCanvasContext(const String& type, const String& name, int width, int height); |
|---|
| 813 | HTMLCanvasElement* getCSSCanvasElement(const String& name); |
|---|
| 814 | |
|---|
| 815 | bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; } |
|---|
| 816 | void parseDNSPrefetchControlHeader(const String&); |
|---|
| 817 | |
|---|
| 818 | virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); |
|---|
| 819 | virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); |
|---|
| 820 | virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString); |
|---|
| 821 | virtual void scriptImported(unsigned long, const String&); |
|---|
| 822 | virtual void postTask(PassOwnPtr<Task>); // Executes the task on context's thread asynchronously. |
|---|
| 823 | |
|---|
| 824 | typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache; |
|---|
| 825 | typedef HashMap<DOMWrapperWorld*, JSWrapperCache*> JSWrapperCacheMap; |
|---|
| 826 | JSWrapperCacheMap& wrapperCacheMap() { return m_wrapperCacheMap; } |
|---|
| 827 | JSWrapperCache* getWrapperCache(DOMWrapperWorld* world) |
|---|
| 828 | { |
|---|
| 829 | if (JSWrapperCache* wrapperCache = m_wrapperCacheMap.get(world)) |
|---|
| 830 | return wrapperCache; |
|---|
| 831 | return createWrapperCache(world); |
|---|
| 832 | } |
|---|
| 833 | JSWrapperCache* createWrapperCache(DOMWrapperWorld*); |
|---|
| 834 | |
|---|
| 835 | virtual void finishedParsing(); |
|---|
| 836 | |
|---|
| 837 | bool inPageCache() const { return m_inPageCache; } |
|---|
| 838 | void setInPageCache(bool flag); |
|---|
| 839 | |
|---|
| 840 | // Elements can register themselves for the "documentWillBecomeInactive()" and |
|---|
| 841 | // "documentDidBecomeActive()" callbacks |
|---|
| 842 | void registerForDocumentActivationCallbacks(Element*); |
|---|
| 843 | void unregisterForDocumentActivationCallbacks(Element*); |
|---|
| 844 | void documentWillBecomeInactive(); |
|---|
| 845 | void documentDidBecomeActive(); |
|---|
| 846 | |
|---|
| 847 | void registerForMediaVolumeCallbacks(Element*); |
|---|
| 848 | void unregisterForMediaVolumeCallbacks(Element*); |
|---|
| 849 | void mediaVolumeDidChange(); |
|---|
| 850 | |
|---|
| 851 | void setShouldCreateRenderers(bool); |
|---|
| 852 | bool shouldCreateRenderers(); |
|---|
| 853 | |
|---|
| 854 | void setDecoder(PassRefPtr<TextResourceDecoder>); |
|---|
| 855 | TextResourceDecoder* decoder() const { return m_decoder.get(); } |
|---|
| 856 | |
|---|
| 857 | String displayStringModifiedByEncoding(const String&) const; |
|---|
| 858 | PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const; |
|---|
| 859 | void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const; |
|---|
| 860 | |
|---|
| 861 | // Quirk for the benefit of Apple's Dictionary application. |
|---|
| 862 | void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; } |
|---|
| 863 | bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; } |
|---|
| 864 | |
|---|
| 865 | #if ENABLE(DASHBOARD_SUPPORT) |
|---|
| 866 | void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; } |
|---|
| 867 | bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; } |
|---|
| 868 | bool hasDashboardRegions () const { return m_hasDashboardRegions; } |
|---|
| 869 | void setHasDashboardRegions(bool f) { m_hasDashboardRegions = f; } |
|---|
| 870 | const Vector<DashboardRegionValue>& dashboardRegions() const; |
|---|
| 871 | void setDashboardRegions(const Vector<DashboardRegionValue>&); |
|---|
| 872 | #endif |
|---|
| 873 | |
|---|
| 874 | virtual void removeAllEventListeners(); |
|---|
| 875 | |
|---|
| 876 | CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } |
|---|
| 877 | |
|---|
| 878 | #if ENABLE(SVG) |
|---|
| 879 | const SVGDocumentExtensions* svgExtensions(); |
|---|
| 880 | SVGDocumentExtensions* accessSVGExtensions(); |
|---|
| 881 | #endif |
|---|
| 882 | |
|---|
| 883 | void initSecurityContext(); |
|---|
| 884 | |
|---|
| 885 | // Explicitly override the security origin for this document. |
|---|
| 886 | // Note: It is dangerous to change the security origin of a document |
|---|
| 887 | // that already contains content. |
|---|
| 888 | void setSecurityOrigin(SecurityOrigin*); |
|---|
| 889 | |
|---|
| 890 | bool processingLoadEvent() const { return m_processingLoadEvent; } |
|---|
| 891 | |
|---|
| 892 | #if ENABLE(DATABASE) |
|---|
| 893 | void addOpenDatabase(Database*); |
|---|
| 894 | void removeOpenDatabase(Database*); |
|---|
| 895 | DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. |
|---|
| 896 | void setHasOpenDatabases() { m_hasOpenDatabases = true; } |
|---|
| 897 | bool hasOpenDatabases() { return m_hasOpenDatabases; } |
|---|
| 898 | void stopDatabases(); |
|---|
| 899 | #endif |
|---|
| 900 | |
|---|
| 901 | void setUsingGeolocation(bool f) { m_usingGeolocation = f; } |
|---|
| 902 | bool usingGeolocation() const { return m_usingGeolocation; }; |
|---|
| 903 | |
|---|
| 904 | #if ENABLE(WML) |
|---|
| 905 | void setContainsWMLContent(bool value) { m_containsWMLContent = value; } |
|---|
| 906 | bool containsWMLContent() const { return m_containsWMLContent; } |
|---|
| 907 | |
|---|
| 908 | void resetWMLPageState(); |
|---|
| 909 | void initializeWMLPageState(); |
|---|
| 910 | #endif |
|---|
| 911 | |
|---|
| 912 | protected: |
|---|
| 913 | Document(Frame*, bool isXHTML); |
|---|
| 914 | |
|---|
| 915 | void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; } |
|---|
| 916 | |
|---|
| 917 | void clearXMLVersion() { m_xmlVersion = String(); } |
|---|
| 918 | |
|---|
| 919 | private: |
|---|
| 920 | virtual bool isDocument() const { return true; } |
|---|
| 921 | virtual void removedLastRef(); |
|---|
| 922 | virtual void determineParseMode() { } |
|---|
| 923 | |
|---|
| 924 | virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); |
|---|
| 925 | |
|---|
| 926 | virtual String nodeName() const; |
|---|
| 927 | virtual NodeType nodeType() const; |
|---|
| 928 | virtual bool childTypeAllowed(NodeType); |
|---|
| 929 | virtual PassRefPtr<Node> cloneNode(bool deep); |
|---|
| 930 | virtual bool canReplaceChild(Node* newChild, Node* oldChild); |
|---|
| 931 | |
|---|
| 932 | virtual void refScriptExecutionContext() { ref(); } |
|---|
| 933 | virtual void derefScriptExecutionContext() { deref(); } |
|---|
| 934 | |
|---|
| 935 | virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls. |
|---|
| 936 | virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above. |
|---|
| 937 | |
|---|
| 938 | void initDNSPrefetch(); |
|---|
| 939 | |
|---|
| 940 | String encoding() const; |
|---|
| 941 | |
|---|
| 942 | void executeScriptSoonTimerFired(Timer<Document>*); |
|---|
| 943 | |
|---|
| 944 | void updateTitle(); |
|---|
| 945 | void updateFocusAppearanceTimerFired(Timer<Document>*); |
|---|
| 946 | void updateBaseURL(); |
|---|
| 947 | |
|---|
| 948 | void cacheDocumentElement() const; |
|---|
| 949 | |
|---|
| 950 | CSSStyleSelector* m_styleSelector; |
|---|
| 951 | bool m_didCalculateStyleSelector; |
|---|
| 952 | |
|---|
| 953 | Frame* m_frame; |
|---|
| 954 | DocLoader* m_docLoader; |
|---|
| 955 | Tokenizer* m_tokenizer; |
|---|
| 956 | bool m_wellFormed; |
|---|
| 957 | |
|---|
| 958 | // Document URLs. |
|---|
| 959 | KURL m_url; // Document.URL: The URL from which this document was retrieved. |
|---|
| 960 | KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs. |
|---|
| 961 | KURL m_baseElementURL; // The URL set by the <base> element. |
|---|
| 962 | KURL m_cookieURL; // The URL to use for cookie access. |
|---|
| 963 | KURL m_firstPartyForCookies; // The policy URL for third-party cookie blocking. |
|---|
| 964 | |
|---|
| 965 | // Document.documentURI: |
|---|
| 966 | // Although URL-like, Document.documentURI can actually be set to any |
|---|
| 967 | // string by content. Document.documentURI affects m_baseURL unless the |
|---|
| 968 | // document contains a <base> element, in which case the <base> element |
|---|
| 969 | // takes precedence. |
|---|
| 970 | String m_documentURI; |
|---|
| 971 | |
|---|
| 972 | String m_baseTarget; |
|---|
| 973 | |
|---|
| 974 | RefPtr<DocumentType> m_docType; |
|---|
| 975 | mutable RefPtr<DOMImplementation> m_implementation; |
|---|
| 976 | |
|---|
| 977 | // Track the number of currently loading top-level stylesheets. Sheets |
|---|
| 978 | // loaded using the @import directive are not included in this count. |
|---|
| 979 | // We use this count of pending sheets to detect when we can begin attaching |
|---|
| 980 | // elements. |
|---|
| 981 | int m_pendingStylesheets; |
|---|
| 982 | |
|---|
| 983 | // But sometimes you need to ignore pending stylesheet count to |
|---|
| 984 | // force an immediate layout when requested by JS. |
|---|
| 985 | bool m_ignorePendingStylesheets; |
|---|
| 986 | |
|---|
| 987 | // If we do ignore the pending stylesheet count, then we need to add a boolean |
|---|
| 988 | // to track that this happened so that we can do a full repaint when the stylesheets |
|---|
| 989 | // do eventually load. |
|---|
| 990 | PendingSheetLayout m_pendingSheetLayout; |
|---|
| 991 | |
|---|
| 992 | bool m_hasNodesWithPlaceholderStyle; |
|---|
| 993 | |
|---|
| 994 | RefPtr<CSSStyleSheet> m_elemSheet; |
|---|
| 995 | RefPtr<CSSStyleSheet> m_mappedElementSheet; |
|---|
| 996 | RefPtr<CSSStyleSheet> m_pageUserSheet; |
|---|
| 997 | mutable OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_pageGroupUserSheets; |
|---|
| 998 | mutable bool m_pageGroupUserSheetCacheValid; |
|---|
| 999 | |
|---|
| 1000 | bool m_printing; |
|---|
| 1001 | |
|---|
| 1002 | bool m_ignoreAutofocus; |
|---|
| 1003 | |
|---|
| 1004 | ParseMode m_parseMode; |
|---|
| 1005 | |
|---|
| 1006 | Color m_textColor; |
|---|
| 1007 | |
|---|
| 1008 | RefPtr<Node> m_focusedNode; |
|---|
| 1009 | RefPtr<Node> m_hoverNode; |
|---|
| 1010 | RefPtr<Node> m_activeNode; |
|---|
| 1011 | mutable RefPtr<Element> m_documentElement; |
|---|
| 1012 | |
|---|
| 1013 | unsigned m_domtree_version; |
|---|
| 1014 | |
|---|
| 1015 | HashSet<NodeIterator*> m_nodeIterators; |
|---|
| 1016 | HashSet<Range*> m_ranges; |
|---|
| 1017 | |
|---|
| 1018 | unsigned short m_listenerTypes; |
|---|
| 1019 | |
|---|
| 1020 | RefPtr<StyleSheetList> m_styleSheets; // All of the stylesheets that are currently in effect for our media type and stylesheet set. |
|---|
| 1021 | ListHashSet<Node*> m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>) |
|---|
| 1022 | |
|---|
| 1023 | typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap; |
|---|
| 1024 | ListHashSet<Element*> m_formElementsWithState; |
|---|
| 1025 | FormElementStateMap m_stateForNewFormElements; |
|---|
| 1026 | |
|---|
| 1027 | Color m_linkColor; |
|---|
| 1028 | Color m_visitedLinkColor; |
|---|
| 1029 | Color m_activeLinkColor; |
|---|
| 1030 | |
|---|
| 1031 | String m_preferredStylesheetSet; |
|---|
| 1032 | String m_selectedStylesheetSet; |
|---|
| 1033 | |
|---|
| 1034 | bool m_loadingSheet; |
|---|
| 1035 | bool visuallyOrdered; |
|---|
| 1036 | bool m_bParsing; |
|---|
| 1037 | Timer<Document> m_styleRecalcTimer; |
|---|
| 1038 | bool m_inStyleRecalc; |
|---|
| 1039 | bool m_closeAfterStyleRecalc; |
|---|
| 1040 | bool m_usesDescendantRules; |
|---|
| 1041 | bool m_usesSiblingRules; |
|---|
| 1042 | bool m_usesFirstLineRules; |
|---|
| 1043 | bool m_usesFirstLetterRules; |
|---|
| 1044 | bool m_usesBeforeAfterRules; |
|---|
| 1045 | bool m_usesRemUnits; |
|---|
| 1046 | bool m_gotoAnchorNeededAfterStylesheetsLoad; |
|---|
| 1047 | bool m_isDNSPrefetchEnabled; |
|---|
| 1048 | bool m_haveExplicitlyDisabledDNSPrefetch; |
|---|
| 1049 | bool m_frameElementsShouldIgnoreScrolling; |
|---|
| 1050 | |
|---|
| 1051 | String m_title; |
|---|
| 1052 | bool m_titleSetExplicitly; |
|---|
| 1053 | RefPtr<Element> m_titleElement; |
|---|
| 1054 | |
|---|
| 1055 | RenderArena* m_renderArena; |
|---|
| 1056 | |
|---|
| 1057 | typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair; |
|---|
| 1058 | typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap; |
|---|
| 1059 | MarkerMap m_markers; |
|---|
| 1060 | |
|---|
| 1061 | mutable AXObjectCache* m_axObjectCache; |
|---|
| 1062 | |
|---|
| 1063 | Timer<Document> m_updateFocusAppearanceTimer; |
|---|
| 1064 | |
|---|
| 1065 | Element* m_cssTarget; |
|---|
| 1066 | |
|---|
| 1067 | bool m_processingLoadEvent; |
|---|
| 1068 | double m_startTime; |
|---|
| 1069 | bool m_overMinimumLayoutThreshold; |
|---|
| 1070 | |
|---|
| 1071 | Vector<std::pair<ScriptElementData*, CachedResourceHandle<CachedScript> > > m_scriptsToExecuteSoon; |
|---|
| 1072 | Timer<Document> m_executeScriptSoonTimer; |
|---|
| 1073 | |
|---|
| 1074 | #if ENABLE(XSLT) |
|---|
| 1075 | OwnPtr<TransformSource> m_transformSource; |
|---|
| 1076 | RefPtr<Document> m_transformSourceDocument; |
|---|
| 1077 | #endif |
|---|
| 1078 | |
|---|
| 1079 | #if ENABLE(XBL) |
|---|
| 1080 | XBLBindingManager* m_bindingManager; // The access point through which documents and elements communicate with XBL. |
|---|
| 1081 | #endif |
|---|
| 1082 | |
|---|
| 1083 | typedef HashMap<AtomicStringImpl*, HTMLMapElement*> ImageMapsByName; |
|---|
| 1084 | ImageMapsByName m_imageMapsByName; |
|---|
| 1085 | |
|---|
| 1086 | int m_docID; // A unique document identifier used for things like document-specific mapped attributes. |
|---|
| 1087 | |
|---|
| 1088 | String m_xmlEncoding; |
|---|
| 1089 | String m_xmlVersion; |
|---|
| 1090 | bool m_xmlStandalone; |
|---|
| 1091 | |
|---|
| 1092 | String m_contentLanguage; |
|---|
| 1093 | |
|---|
| 1094 | #if ENABLE(XHTMLMP) |
|---|
| 1095 | bool m_shouldProcessNoScriptElement; |
|---|
| 1096 | #endif |
|---|
| 1097 | |
|---|
| 1098 | RenderObject* m_savedRenderer; |
|---|
| 1099 | int m_secureForms; |
|---|
| 1100 | |
|---|
| 1101 | RefPtr<TextResourceDecoder> m_decoder; |
|---|
| 1102 | |
|---|
| 1103 | // We maintain the invariant that m_duplicateIds is the count of all elements with a given ID |
|---|
| 1104 | // excluding the one referenced in m_elementsById, if any. This means it one less than the total count |
|---|
| 1105 | // when the first node with a given ID is cached, otherwise the same as the total count. |
|---|
| 1106 | mutable HashMap<AtomicStringImpl*, Element*> m_elementsById; |
|---|
| 1107 | mutable HashCountedSet<AtomicStringImpl*> m_duplicateIds; |
|---|
| 1108 | |
|---|
| 1109 | mutable HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey; |
|---|
| 1110 | |
|---|
| 1111 | InheritedBool m_designMode; |
|---|
| 1112 | |
|---|
| 1113 | int m_selfOnlyRefCount; |
|---|
| 1114 | |
|---|
| 1115 | CheckedRadioButtons m_checkedRadioButtons; |
|---|
| 1116 | |
|---|
| 1117 | typedef HashMap<AtomicStringImpl*, CollectionCache*> NamedCollectionMap; |
|---|
| 1118 | CollectionCache m_collectionInfo[NumUnnamedDocumentCachedTypes]; |
|---|
| 1119 | NamedCollectionMap m_nameCollectionInfo[NumNamedDocumentCachedTypes]; |
|---|
| 1120 | |
|---|
| 1121 | #if ENABLE(XPATH) |
|---|
| 1122 | RefPtr<XPathEvaluator> m_xpathEvaluator; |
|---|
| 1123 | #endif |
|---|
| 1124 | |
|---|
| 1125 | #if ENABLE(SVG) |
|---|
| 1126 | OwnPtr<SVGDocumentExtensions> m_svgExtensions; |
|---|
| 1127 | #endif |
|---|
| 1128 | |
|---|
| 1129 | #if ENABLE(DASHBOARD_SUPPORT) |
|---|
| 1130 | Vector<DashboardRegionValue> m_dashboardRegions; |
|---|
| 1131 | bool m_hasDashboardRegions; |
|---|
| 1132 | bool m_dashboardRegionsDirty; |
|---|
| 1133 | #endif |
|---|
| 1134 | |
|---|
| 1135 | HashMap<String, RefPtr<HTMLCanvasElement> > m_cssCanvasElements; |
|---|
| 1136 | |
|---|
| 1137 | mutable bool m_accessKeyMapValid; |
|---|
| 1138 | bool m_createRenderers; |
|---|
| 1139 | bool m_inPageCache; |
|---|
| 1140 | String m_iconURL; |
|---|
| 1141 | |
|---|
| 1142 | HashSet<Element*> m_documentActivationCallbackElements; |
|---|
| 1143 | HashSet<Element*> m_mediaVolumeCallbackElements; |
|---|
| 1144 | |
|---|
| 1145 | bool m_useSecureKeyboardEntryWhenActive; |
|---|
| 1146 | |
|---|
| 1147 | bool m_isXHTML; |
|---|
| 1148 | |
|---|
| 1149 | unsigned m_numNodeListCaches; |
|---|
| 1150 | |
|---|
| 1151 | JSWrapperCacheMap m_wrapperCacheMap; |
|---|
| 1152 | |
|---|
| 1153 | #if ENABLE(DATABASE) |
|---|
| 1154 | RefPtr<DatabaseThread> m_databaseThread; |
|---|
| 1155 | bool m_hasOpenDatabases; // This never changes back to false, even as the database thread is closed. |
|---|
| 1156 | typedef HashSet<Database*> DatabaseSet; |
|---|
| 1157 | OwnPtr<DatabaseSet> m_openDatabaseSet; |
|---|
| 1158 | #endif |
|---|
| 1159 | |
|---|
| 1160 | bool m_usingGeolocation; |
|---|
| 1161 | |
|---|
| 1162 | #if ENABLE(WML) |
|---|
| 1163 | bool m_containsWMLContent; |
|---|
| 1164 | #endif |
|---|
| 1165 | }; |
|---|
| 1166 | |
|---|
| 1167 | inline bool Document::hasElementWithId(AtomicStringImpl* id) const |
|---|
| 1168 | { |
|---|
| 1169 | ASSERT(id); |
|---|
| 1170 | return m_elementsById.contains(id) || m_duplicateIds.contains(id); |
|---|
| 1171 | } |
|---|
| 1172 | |
|---|
| 1173 | inline bool Node::isDocumentNode() const |
|---|
| 1174 | { |
|---|
| 1175 | return this == m_document; |
|---|
| 1176 | } |
|---|
| 1177 | |
|---|
| 1178 | } // namespace WebCore |
|---|
| 1179 | |
|---|
| 1180 | #endif // Document_h |
|---|