summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/Document.h
diff options
context:
space:
mode:
authorFeng Qian <fqian@google.com>2009-06-17 12:12:20 -0700
committerFeng Qian <fqian@google.com>2009-06-17 12:12:20 -0700
commit5f1ab04193ad0130ca8204aadaceae083aca9881 (patch)
tree5a92cd389e2cfe7fb67197ce14b38469462379f8 /WebCore/dom/Document.h
parent194315e5a908cc8ed67d597010544803eef1ac59 (diff)
downloadexternal_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.zip
external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.gz
external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.bz2
Get WebKit r44544.
Diffstat (limited to 'WebCore/dom/Document.h')
-rw-r--r--WebCore/dom/Document.h120
1 files changed, 65 insertions, 55 deletions
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 3d232ec..70bc225 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -4,7 +4,7 @@
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -26,16 +26,16 @@
#ifndef Document_h
#define Document_h
-#include "Attr.h"
+#include "CachedResourceHandle.h"
+#include "CheckedRadioButtons.h"
+#include "ContainerNode.h"
+#include "CollectionCache.h"
+#include "CollectionType.h"
#include "Color.h"
#include "DocumentMarker.h"
-#include "HTMLCollection.h"
-#include "HTMLFormElement.h"
#include "ScriptExecutionContext.h"
-#include "StringHash.h"
#include "Timer.h"
#include <wtf/HashCountedSet.h>
-#include <wtf/ListHashSet.h>
// 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
@@ -48,11 +48,11 @@
namespace WebCore {
- class AXObjectCache;
class Attr;
- class Attribute;
+ class AXObjectCache;
class CDATASection;
class CachedCSSStyleSheet;
+ class CachedScript;
class CanvasRenderingContext2D;
class CharacterData;
class CSSStyleDeclaration;
@@ -72,11 +72,11 @@ namespace WebCore {
class EntityReference;
class Event;
class EventListener;
- class FormControlElementWithState;
class Frame;
class FrameView;
class HitTestRequest;
class HTMLCanvasElement;
+ class HTMLCollection;
class HTMLDocument;
class HTMLElement;
class HTMLFormElement;
@@ -95,6 +95,7 @@ namespace WebCore {
class RegisteredEventListener;
class RenderArena;
class RenderView;
+ class ScriptElementData;
class SecurityOrigin;
class SegmentedString;
class Settings;
@@ -228,7 +229,7 @@ public:
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, true); }
+ PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode&);
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&);
@@ -288,15 +289,15 @@ public:
// quirks mode for historical compatibility reasons.
Element* findAnchor(const String& name);
- HTMLCollection::CollectionInfo* collectionInfo(HTMLCollection::Type type)
+ CollectionCache* collectionInfo(CollectionType type)
{
- ASSERT(type >= HTMLCollection::FirstUnnamedDocumentCachedType);
- unsigned index = type - HTMLCollection::FirstUnnamedDocumentCachedType;
- ASSERT(index < HTMLCollection::NumUnnamedDocumentCachedTypes);
+ ASSERT(type >= FirstUnnamedDocumentCachedType);
+ unsigned index = type - FirstUnnamedDocumentCachedType;
+ ASSERT(index < NumUnnamedDocumentCachedTypes);
return &m_collectionInfo[index];
}
- HTMLCollection::CollectionInfo* nameCollectionInfo(HTMLCollection::Type, const AtomicString& name);
+ CollectionCache* nameCollectionInfo(CollectionType, const AtomicString& name);
// DOM methods overridden from parent classes
@@ -308,12 +309,19 @@ public:
virtual bool isImageDocument() const { return false; }
#if ENABLE(SVG)
virtual bool isSVGDocument() const { return false; }
+#else
+ static bool isSVGDocument() { return false; }
#endif
virtual bool isPluginDocument() const { return false; }
virtual bool isMediaDocument() const { return false; }
#if ENABLE(WML)
virtual bool isWMLDocument() const { return false; }
#endif
+#if ENABLE(XHTMLMP)
+ bool isXHTMLMPDocument() const;
+ bool shouldProcessNoscriptElement() const { return m_shouldProcessNoScriptElement; }
+ void setShouldProcessNoscriptElement(bool shouldDo) { m_shouldProcessNoScriptElement = shouldDo; }
+#endif
virtual bool isFrameSet() const { return false; }
CSSStyleSelector* styleSelector() const { return m_styleSelector; }
@@ -371,8 +379,8 @@ public:
void setUsesBeforeAfterRules(bool b) { m_usesBeforeAfterRules = b; }
// Machinery for saving and restoring state when you leave and then go back to a page.
- void registerFormElementWithState(FormControlElementWithState* e) { m_formElementsWithState.add(e); }
- void unregisterFormElementWithState(FormControlElementWithState* e) { m_formElementsWithState.remove(e); }
+ void registerFormElementWithState(Element* e) { m_formElementsWithState.add(e); }
+ void unregisterFormElementWithState(Element* e) { m_formElementsWithState.remove(e); }
Vector<String> formElementsState() const;
void setStateForNewFormElements(const Vector<String>&);
bool hasStateForNewFormElements() const;
@@ -396,17 +404,15 @@ public:
PassRefPtr<EditingText> createEditingTextNode(const String&);
virtual void recalcStyle( StyleChange = NoChange );
- virtual void updateRendering();
+ virtual void updateStyleIfNeeded();
void updateLayout();
void updateLayoutIgnorePendingStylesheets();
- static void updateDocumentsRendering();
+ static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function.
DocLoader* docLoader() { return m_docLoader; }
virtual void attach();
virtual void detach();
- void clearFramePointer();
-
RenderArena* renderArena() { return m_renderArena; }
RenderView* renderView() const;
@@ -515,6 +521,8 @@ public:
bool setFocusedNode(PassRefPtr<Node>);
Node* focusedNode() const { return m_focusedNode.get(); }
+ void getFocusableNodes(Vector<RefPtr<Node> >&);
+
// 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; };
@@ -535,7 +543,9 @@ public:
void setCSSTarget(Element*);
Element* cssTarget() const { return m_cssTarget; }
- void setDocumentChanged(bool);
+ void scheduleStyleRecalc();
+ void unscheduleStyleRecalc();
+ void styleRecalcTimerFired(Timer<Document>*);
void attachNodeIterator(NodeIterator*);
void detachNodeIterator(NodeIterator*);
@@ -554,6 +564,12 @@ public:
DOMWindow* defaultView() const { return domWindow(); }
DOMWindow* domWindow() const;
+ // Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists.
+ void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>);
+ void dispatchWindowEvent(PassRefPtr<Event>);
+ void dispatchWindowEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg);
+ void dispatchLoadEvent();
+
PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&);
// keep track of what types of event listeners are registered, so we don't
@@ -579,24 +595,6 @@ public:
CSSStyleDeclaration* getOverrideStyle(Element*, const String& pseudoElt);
- void handleWindowEvent(Event*, bool useCapture);
- void setWindowInlineEventListenerForType(const AtomicString& eventType, PassRefPtr<EventListener>);
- EventListener* windowInlineEventListenerForType(const AtomicString& eventType);
- void removeWindowInlineEventListenerForType(const AtomicString& eventType);
-
- 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);
-
- 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
@@ -665,8 +663,8 @@ public:
const KURL& cookieURL() const { return m_cookieURL; }
- const KURL& policyBaseURL() const { return m_policyBaseURL; }
- void setPolicyBaseURL(const KURL& url) { m_policyBaseURL = url; }
+ const KURL& firstPartyForCookies() const { return m_firstPartyForCookies; }
+ void setFirstPartyForCookies(const KURL& url) { m_firstPartyForCookies = 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
@@ -711,6 +709,8 @@ public:
void setRenderedRectForMarker(Node*, DocumentMarker, const IntRect&);
void invalidateRenderedRectsForMarkersInRect(const IntRect&);
void shiftMarkers(Node*, unsigned startOffset, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ void setMarkersActive(Range*, bool);
+ void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool);
DocumentMarker* markerContainingPoint(const IntPoint&, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
Vector<DocumentMarker> markersForNode(Node*);
@@ -727,6 +727,8 @@ public:
int docID() const { return m_docID; }
+ void executeScriptSoon(ScriptElementData*, CachedResourceHandle<CachedScript>);
+
#if ENABLE(XSLT)
void applyXSLTransform(ProcessingInstruction* pi);
void setTransformSource(void* doc);
@@ -826,6 +828,8 @@ private:
String encoding() const;
+ void executeScriptSoonTimerFired(Timer<Document>*);
+
CSSStyleSelector* m_styleSelector;
bool m_didCalculateStyleSelector;
@@ -839,7 +843,7 @@ private:
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.
+ KURL m_firstPartyForCookies; // The policy URL for third-party cookie blocking.
// Document.documentURI:
// Although URL-like, Document.documentURI can actually be set to any
@@ -901,10 +905,8 @@ private:
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>)
- RegisteredEventListenerVector m_windowEventListeners;
-
typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
- ListHashSet<FormControlElementWithState*> m_formElementsWithState;
+ ListHashSet<Element*> m_formElementsWithState;
FormElementStateMap m_stateForNewFormElements;
Color m_linkColor;
@@ -917,7 +919,7 @@ private:
bool m_loadingSheet;
bool visuallyOrdered;
bool m_bParsing;
- bool m_docChanged;
+ Timer<Document> m_styleRecalcTimer;
bool m_inStyleRecalc;
bool m_closeAfterStyleRecalc;
bool m_usesDescendantRules;
@@ -939,9 +941,9 @@ private:
typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair;
typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap;
MarkerMap m_markers;
-
+#if !PLATFORM(ANDROID)
mutable AXObjectCache* m_axObjectCache;
-
+#endif
Timer<Document> m_updateFocusAppearanceTimer;
Element* m_cssTarget;
@@ -949,6 +951,9 @@ private:
bool m_processingLoadEvent;
double m_startTime;
bool m_overMinimumLayoutThreshold;
+
+ Vector<std::pair<ScriptElementData*, CachedResourceHandle<CachedScript> > > m_scriptsToExecuteSoon;
+ Timer<Document> m_executeScriptSoonTimer;
#if ENABLE(XSLT)
void* m_transformSource;
@@ -972,6 +977,10 @@ private:
String m_contentLanguage;
+#if ENABLE(XHTMLMP)
+ bool m_shouldProcessNoScriptElement;
+#endif
+
public:
bool inPageCache() const { return m_inPageCache; }
void setInPageCache(bool flag);
@@ -1010,12 +1019,12 @@ public:
void setDashboardRegions(const Vector<DashboardRegionValue>&);
#endif
- void removeAllEventListenersFromAllNodes();
+ void removeAllEventListeners();
void registerDisconnectedNodeWithEventListeners(Node*);
void unregisterDisconnectedNodeWithEventListeners(Node*);
- HTMLFormElement::CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }
+ CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }
#if ENABLE(SVG)
const SVGDocumentExtensions* svgExtensions();
@@ -1045,6 +1054,7 @@ public:
#if ENABLE(WML)
void resetWMLPageState();
+ void initializeWMLPageState();
#endif
protected:
@@ -1075,11 +1085,11 @@ private:
int m_selfOnlyRefCount;
- HTMLFormElement::CheckedRadioButtons m_checkedRadioButtons;
+ CheckedRadioButtons m_checkedRadioButtons;
- typedef HashMap<AtomicStringImpl*, HTMLCollection::CollectionInfo*> NamedCollectionMap;
- HTMLCollection::CollectionInfo m_collectionInfo[HTMLCollection::NumUnnamedDocumentCachedTypes];
- NamedCollectionMap m_nameCollectionInfo[HTMLCollection::NumNamedDocumentCachedTypes];
+ typedef HashMap<AtomicStringImpl*, CollectionCache*> NamedCollectionMap;
+ CollectionCache m_collectionInfo[NumUnnamedDocumentCachedTypes];
+ NamedCollectionMap m_nameCollectionInfo[NumNamedDocumentCachedTypes];
#if ENABLE(XPATH)
RefPtr<XPathEvaluator> m_xpathEvaluator;