📄 document.h
字号:
Vector<String> formElementsState() const; void setStateForNewFormElements(const Vector<String>&); bool hasStateForNewFormElements() const; bool takeStateForFormElement(AtomicStringImpl* name, AtomicStringImpl* type, String& state); FrameView* view() const; // can be NULL Frame* frame() const { return m_frame; } // can be NULL Page* page() const; // can be NULL Settings* settings() const; // can be NULL PassRefPtr<Range> createRange(); PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&); PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&); // Special support for editing PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration(); PassRefPtr<EditingText> createEditingTextNode(const String&); virtual void recalcStyle( StyleChange = NoChange ); virtual void updateRendering(); void updateLayout(); void updateLayoutIgnorePendingStylesheets(); static void updateDocumentsRendering(); DocLoader* docLoader() { return m_docLoader; } virtual void attach(); virtual void detach(); void clearFramePointer(); RenderArena* renderArena() { return m_renderArena; } RenderView* renderView() const; void clearAXObjectCache(); AXObjectCache* axObjectCache() const; // to get visually ordered hebrew and arabic pages right void setVisuallyOrdered(); void open(Document* ownerDocument = 0); void implicitOpen(); void close(); void implicitClose(); void cancelParsing(); void write(const SegmentedString& text, Document* ownerDocument = 0); 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; } 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&); const String& baseTarget() const { return m_baseTarget; } // Setting the BaseElementTarget will change the baseTarget. void setBaseElementTarget(const String& baseTarget) { m_baseTarget = baseTarget; } KURL completeURL(const String&) const; virtual String userAgent(const KURL&) const; virtual String encoding() const; // from cachedObjectClient virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);#if FRAME_LOADS_USER_STYLESHEET void setUserStyleSheet(const String& sheet);#endif String userStyleSheet() const; CSSStyleSheet* elementSheet(); CSSStyleSheet* mappedElementSheet(); virtual Tokenizer* createTokenizer(); Tokenizer* tokenizer() { return m_tokenizer; } bool printing() const { return m_printing; } void setPrinting(bool p) { m_printing = p; } enum ParseMode { Compat, AlmostStrict, Strict };private: virtual void determineParseMode() {} 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(); bool shouldScheduleLayout(); int elapsedTime() const; void setTextColor(const Color& color) { m_textColor = color; } Color textColor() const { return m_textColor; } const Color& linkColor() const { return m_linkColor; } const Color& visitedLinkColor() const { return m_visitedLinkColor; } const Color& activeLinkColor() const { return m_activeLinkColor; } void setLinkColor(const Color& c) { m_linkColor = c; } void setVisitedLinkColor(const Color& c) { m_visitedLinkColor = c; } void setActiveLinkColor(const Color& c) { m_activeLinkColor = c; } void resetLinkColor(); void resetVisitedLinkColor(); void resetActiveLinkColor(); MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const IntPoint&, const PlatformMouseEvent&); virtual bool childTypeAllowed(NodeType); virtual PassRefPtr<Node> cloneNode(bool deep); virtual bool canReplaceChild(Node* newChild, Node* oldChild); StyleSheetList* styleSheets(); /* Newly proposed CSS3 mechanism for selecting alternate stylesheets using the DOM. May be subject to change as spec matures. - dwh */ String preferredStylesheetSet() const; String selectedStylesheetSet() const; void setSelectedStylesheetSet(const String&); 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(); } void setActiveNode(PassRefPtr<Node>); Node* activeNode() const { return m_activeNode.get(); } void focusedNodeRemoved(); void removeFocusedNodeOfSubtree(Node*, bool amongChildrenOnly = false); void hoveredNodeDetached(Node*); void activeChainNodeDetached(Node*); // Updates for :target (CSS3 selector). void setCSSTarget(Element*); Element* cssTarget() const { return m_cssTarget; } void setDocumentChanged(bool); void attachNodeIterator(NodeIterator*); void detachNodeIterator(NodeIterator*); 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 // dispatch events unnecessarily enum ListenerType { DOMSUBTREEMODIFIED_LISTENER = 0x01, DOMNODEINSERTED_LISTENER = 0x02, DOMNODEREMOVED_LISTENER = 0x04, DOMNODEREMOVEDFROMDOCUMENT_LISTENER = 0x08, DOMNODEINSERTEDINTODOCUMENT_LISTENER = 0x10, DOMATTRMODIFIED_LISTENER = 0x20, DOMCHARACTERDATAMODIFIED_LISTENER = 0x40, 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 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 * first (from lowest to highest), and then elements without tab indexes (in document order). * * @param fromNode The node from which to start searching. The node after this will be focused. May be null. * * @return The focus node that comes after fromNode * * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 */ Node* nextFocusableNode(Node* start, KeyboardEvent*); /** * Searches through the document, starting from fromNode, for the previous selectable element (that comes _before_) * fromNode. The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab * indexes first (from lowest to highest), and then elements without tab indexes (in document order). * * @param fromNode The node from which to start searching. The node before this will be focused. May be null. * * @return The focus node that comes before fromNode * * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 */ Node* previousFocusableNode(Node* start, KeyboardEvent*); int nodeAbsIndex(Node*); Node* nodeWithAbsIndex(int absIndex); /** * Handles a HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called * when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta * tag. This enables scripts to use meta tags to perform refreshes and set expiry dates in addition to them being * specified in a HTML file. * * @param equiv The http header name (value of the meta tag's "equiv" attribute) * @param content The header value (value of the meta tag's "content" attribute) */ void processHttpEquiv(const String& equiv, const String& content); void dispatchImageLoadEventSoon(ImageLoader*); void dispatchImageLoadEventsNow(); void removeImage(ImageLoader*); // Returns the owning element in the parent document. // Returns 0 if this is the top level document. Element* ownerElement() const; String title() const { return m_title; } void setTitle(const String&, Element* titleElement = 0); void removeTitle(Element* titleElement); String cookie() const; void setCookie(const String&); String referrer() const; String domain() const; void setDomain(const String& newDomain); String lastModified() const; 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 // and make it sensitive to the type of document. 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. 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); void addImageMap(HTMLMapElement*); void removeImageMap(HTMLMapElement*); HTMLMapElement* getImageMap(const String& url) const; HTMLElement* body() const; void setBody(PassRefPtr<HTMLElement>, ExceptionCode&); HTMLHeadElement* head(); bool execCommand(const String& command, bool userInterface = false, const String& value = String()); bool queryCommandEnabled(const String& command); bool queryCommandIndeterm(const String& command); bool queryCommandState(const String& command); bool queryCommandSupported(const String& command); String queryCommandValue(const String& command); void addMarker(Range*, DocumentMarker::MarkerType, String description = String()); void addMarker(Node*, DocumentMarker); void copyMarkers(Node *srcNode, unsigned startOffset, int length, Node *dstNode, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void removeMarkers(Range*, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void removeMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void removeMarkers(Node*); void repaintMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void setRenderedRectForMarker(Node*, DocumentMarker, const IntRect&); void invalidateRenderedRectsForMarkersInRect(const IntRect&); void shiftMarkers(Node*, unsigned startOffset, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); DocumentMarker* markerContainingPoint(const IntPoint&, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); Vector<DocumentMarker> markersForNode(Node*); Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); // designMode support enum InheritedBool { off = false, on = true, inherit }; void setDesignMode(InheritedBool value); InheritedBool getDesignMode() const; bool inDesignMode() const; Document* parentDocument() const; Document* topDocument() const; int docID() const { return m_docID; }#if ENABLE(XSLT) void applyXSLTransform(ProcessingInstruction* pi); void setTransformSource(void* doc); const void* transformSource() { return m_transformSource; } PassRefPtr<Document> transformSourceDocument() { return m_transformSourceDocument; } void setTransformSourceDocument(Document* doc) { m_transformSourceDocument = doc; }#endif#if ENABLE(XBL) // XBL methods XBLBindingManager* bindingManager() const { return m_bindingManager; }#endif void incDOMTreeVersion() { ++m_domtree_version; } unsigned domTreeVersion() const { return m_domtree_version; } void setDocType(PassRefPtr<DocumentType>); virtual void finishedParsing();#if ENABLE(XPATH) // XPathEvaluator methods PassRefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver* resolver, ExceptionCode& ec);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -