📄 document.h
字号:
PassRefPtr<XPathNSResolver> createNSResolver(Node *nodeResolver); PassRefPtr<XPathResult> evaluate(const String& expression, Node* contextNode, XPathNSResolver* resolver, unsigned short type, XPathResult* result, ExceptionCode& ec);#endif // ENABLE(XPATH) enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets }; bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; } void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; } const String& iconURL() const { return m_iconURL; } void setIconURL(const String& iconURL, const String& type); void setUseSecureKeyboardEntryWhenActive(bool); bool useSecureKeyboardEntryWhenActive() const; void addNodeListCache() { ++m_numNodeListCaches; } void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; } bool hasNodeListCaches() const { return m_numNodeListCaches; } void updateFocusAppearanceSoon(); void cancelFocusAppearanceUpdate(); // 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&); virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString); virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.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. virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above. CSSStyleSelector* m_styleSelector; bool m_didCalculateStyleSelector; Frame* m_frame; DocLoader* m_docLoader; Tokenizer* m_tokenizer; bool m_wellFormed; // 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; mutable RefPtr<DOMImplementation> m_implementation; RefPtr<StyleSheet> m_sheet;#if FRAME_LOADS_USER_STYLESHEET String m_usersheet;#endif // Track the number of currently loading top-level stylesheets. Sheets // loaded using the @import directive are not included in this count. // We use this count of pending sheets to detect when we can begin attaching // elements. int m_pendingStylesheets; // But sometimes you need to ignore pending stylesheet count to // force an immediate layout when requested by JS. bool m_ignorePendingStylesheets; // If we do ignore the pending stylesheet count, then we need to add a boolean // to track that this happened so that we can do a full repaint when the stylesheets // do eventually load. PendingSheetLayout m_pendingSheetLayout; bool m_hasNodesWithPlaceholderStyle; RefPtr<CSSStyleSheet> m_elemSheet; RefPtr<CSSStyleSheet> m_mappedElementSheet; bool m_printing; bool m_ignoreAutofocus; ParseMode m_parseMode; Color m_textColor; RefPtr<Node> m_focusedNode; RefPtr<Node> m_hoverNode; RefPtr<Node> m_activeNode; mutable RefPtr<Element> m_documentElement; unsigned m_domtree_version; HashSet<NodeIterator*> m_nodeIterators; HashSet<Range*> m_ranges; unsigned short m_listenerTypes; 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; FormElementStateMap m_stateForNewFormElements; Color m_linkColor; Color m_visitedLinkColor; Color m_activeLinkColor; String m_preferredStylesheetSet; String m_selectedStylesheetSet; bool m_loadingSheet; bool visuallyOrdered; bool m_bParsing; bool m_docChanged; bool m_inStyleRecalc; bool m_closeAfterStyleRecalc; bool m_usesDescendantRules; bool m_usesSiblingRules; bool m_usesFirstLineRules; bool m_usesFirstLetterRules; bool m_usesBeforeAfterRules; bool m_gotoAnchorNeededAfterStylesheetsLoad; bool m_isDNSPrefetchEnabled; bool m_haveExplicitlyDisabledDNSPrefetch; bool m_frameElementsShouldIgnoreScrolling; String m_title; bool m_titleSetExplicitly; RefPtr<Element> m_titleElement; RenderArena* m_renderArena; typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair; typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap; MarkerMap m_markers; mutable AXObjectCache* m_axObjectCache; Vector<ImageLoader*> m_imageLoadEventDispatchSoonList; Vector<ImageLoader*> m_imageLoadEventDispatchingList; Timer<Document> m_imageLoadEventTimer; Timer<Document> m_updateFocusAppearanceTimer; Element* m_cssTarget; bool m_processingLoadEvent; double m_startTime; bool m_overMinimumLayoutThreshold; #if ENABLE(XSLT) void* m_transformSource; RefPtr<Document> m_transformSourceDocument;#endif#if ENABLE(XBL) XBLBindingManager* m_bindingManager; // The access point through which documents and elements communicate with XBL.#endif typedef HashMap<AtomicStringImpl*, HTMLMapElement*> ImageMapsByName; ImageMapsByName m_imageMapsByName; HashSet<Node*> m_disconnectedNodesWithEventListeners; int m_docID; // A unique document identifier used for things like document-specific mapped attributes. String m_xmlEncoding; String m_xmlVersion; bool m_xmlStandalone; String m_contentLanguage;public: bool inPageCache() const { return m_inPageCache; } void setInPageCache(bool flag); // Elements can register themselves for the "documentWillBecomeInactive()" and // "documentDidBecomeActive()" callbacks void registerForDocumentActivationCallbacks(Element*); void unregisterForDocumentActivationCallbacks(Element*); void documentWillBecomeInactive(); void documentDidBecomeActive(); void registerForMediaVolumeCallbacks(Element*); void unregisterForMediaVolumeCallbacks(Element*); void mediaVolumeDidChange(); void setShouldCreateRenderers(bool); bool shouldCreateRenderers(); void setDecoder(PassRefPtr<TextResourceDecoder>); TextResourceDecoder* decoder() const { return m_decoder.get(); } String displayStringModifiedByEncoding(const String&) const; PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const; void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const; // Quirk for the benefit of Apple's Dictionary application. void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; } bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; }#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(); void registerDisconnectedNodeWithEventListeners(Node*); void unregisterDisconnectedNodeWithEventListeners(Node*); HTMLFormElement::CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } #if ENABLE(SVG) const SVGDocumentExtensions* svgExtensions(); SVGDocumentExtensions* accessSVGExtensions();#endif void initSecurityContext(); // Explicitly override the security origin for this document. // Note: It is dangerous to change the security origin of a document // that already contains content. void setSecurityOrigin(SecurityOrigin*); bool processingLoadEvent() const { return m_processingLoadEvent; }#if ENABLE(DATABASE) void addOpenDatabase(Database*); void removeOpenDatabase(Database*); DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. void setHasOpenDatabases() { m_hasOpenDatabases = true; } bool hasOpenDatabases() { return m_hasOpenDatabases; } void stopDatabases();#endif void setUsingGeolocation(bool f) { m_usingGeolocation = f; } bool usingGeolocation() const { return m_usingGeolocation; };#if ENABLE(WML) void resetWMLPageState();#endifprotected: void clearXMLVersion() { m_xmlVersion = String(); }private: void updateTitle(); void removeAllDisconnectedNodeEventListeners(); void imageLoadEventTimerFired(Timer<Document>*); void updateFocusAppearanceTimerFired(Timer<Document>*); void updateBaseURL(); void cacheDocumentElement() const; RenderObject* m_savedRenderer; int m_secureForms; RefPtr<TextResourceDecoder> m_decoder; // We maintain the invariant that m_duplicateIds is the count of all elements with a given ID // excluding the one referenced in m_elementsById, if any. This means it one less than the total count // when the first node with a given ID is cached, otherwise the same as the total count. mutable HashMap<AtomicStringImpl*, Element*> m_elementsById; mutable HashCountedSet<AtomicStringImpl*> m_duplicateIds; mutable HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey; InheritedBool m_designMode; int m_selfOnlyRefCount; HTMLFormElement::CheckedRadioButtons m_checkedRadioButtons; typedef HashMap<AtomicStringImpl*, HTMLCollection::CollectionInfo*> NamedCollectionMap; HTMLCollection::CollectionInfo m_collectionInfo[HTMLCollection::NumUnnamedDocumentCachedTypes]; NamedCollectionMap m_nameCollectionInfo[HTMLCollection::NumNamedDocumentCachedTypes];#if ENABLE(XPATH) RefPtr<XPathEvaluator> m_xpathEvaluator;#endif #if ENABLE(SVG) 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_documentActivationCallbackElements; HashSet<Element*> m_mediaVolumeCallbackElements; bool m_useSecureKeyboardEntryWhenActive; bool m_isXHTML; 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; bool m_hasOpenDatabases; // This never changes back to false, even as the database thread is closed. typedef HashSet<Database*> DatabaseSet; OwnPtr<DatabaseSet> m_openDatabaseSet;#endif bool m_usingGeolocation;};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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -