📄 dom_docimpl.h
字号:
// ### think about implementing ref'counting for the id's // in order to be able to reassign those that are no longer in use // (could make problems when it is still kept somewhere around, i.e. styleselector) NodeImpl::Id tagId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly); DOMString tagName(NodeImpl::Id _id) const; NodeImpl::Id attrId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly); DOMString attrName(NodeImpl::Id _id) const; // the namespace uri is mapped to the same id for both // tagnames as well as attributes. DOMStringImpl* namespaceURI(NodeImpl::Id _id) const; StyleSheetListImpl* styleSheets(); /* Newly proposed CSS3 mechanism for selecting alternate stylesheets using the DOM. May be subject to change as spec matures. - dwh */ DOMString preferredStylesheetSet(); DOMString selectedStylesheetSet(); void setSelectedStylesheetSet(const DOMString& aString); QStringList availableStyleSheets() const; NodeImpl *focusNode() const { return m_focusNode; } bool setFocusNode(NodeImpl *newFocusNode); NodeImpl *hoverNode() const { return m_hoverNode; } void setHoverNode(NodeImpl *newHoverNode); // Updates for :target (CSS3 selector). void setCSSTarget(NodeImpl* n); NodeImpl* getCSSTarget(); void setDocumentChanged(bool); void attachNodeIterator(NodeIteratorImpl *ni); void detachNodeIterator(NodeIteratorImpl *ni); void notifyBeforeNodeRemoval(NodeImpl *n); AbstractViewImpl *defaultView() const; EventImpl *createEvent(const DOMString &eventType, int &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 }; bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); } void addListenerType(ListenerType listenerType) { m_listenerTypes = m_listenerTypes | listenerType; } CSSStyleDeclarationImpl *getOverrideStyle(ElementImpl *elt, DOMStringImpl *pseudoElt); typedef QMap<QString, ProcessingInstructionImpl*> LocalStyleRefs; LocalStyleRefs* localStyleRefs() { return &m_localStyleRefs; } virtual void defaultEventHandler(EventImpl *evt); void setHTMLWindowEventListener(int id, EventListener *listener); EventListener *getHTMLWindowEventListener(int id); void removeHTMLWindowEventListener(int id); void addWindowEventListener(int id, EventListener *listener, const bool useCapture); void removeWindowEventListener(int id, EventListener *listener, bool useCapture); bool hasWindowEventListener(int id); EventListener *createHTMLEventListener(QString code); /** * 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 */ NodeImpl *nextFocusNode(NodeImpl *fromNode); /** * 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 */ NodeImpl *previousFocusNode(NodeImpl *fromNode); int nodeAbsIndex(NodeImpl *node); NodeImpl *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 DOMString &equiv, const DOMString &content); void dispatchImageLoadEventSoon(HTMLImageLoader*); void dispatchImageLoadEventsNow(); void removeImage(HTMLImageLoader*); virtual void timerEvent(QTimerEvent *); // Returns the owning element in the parent document. // Returns 0 if this is the top level document. ElementImpl *ownerElement(); DOMString domain() const; void setDomain( const DOMString &newDomain, bool force = false ); // not part of the DOM // 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 DOMString &); void addElementById(const DOMString &elementId, ElementImpl *element); void removeElementById(const DOMString &elementId, ElementImpl *element); void addImageMap(HTMLMapElementImpl *); void removeImageMap(HTMLMapElementImpl *); HTMLMapElementImpl *getImageMap(const DOMString &URL) const; HTMLElementImpl* body(); DOMString toString() const; bool execCommand(const DOMString &command, bool userInterface, const DOMString &value); bool queryCommandEnabled(const DOMString &command); bool queryCommandIndeterm(const DOMString &command); bool queryCommandState(const DOMString &command); bool queryCommandSupported(const DOMString &command); DOMString queryCommandValue(const DOMString &command);#ifndef KHTML_NO_XBL // XBL methods XBL::XBLBindingManager* bindingManager() const { return m_bindingManager; }#endifsignals: void finishedParsing();protected: khtml::CSSStyleSelector *m_styleSelector; KHTMLView *m_view; QStringList m_state; khtml::DocLoader *m_docLoader; khtml::Tokenizer *m_tokenizer; QString m_url; QString m_baseURL; QString m_baseTarget; DocumentTypeImpl *m_doctype; DOMImplementationImpl *m_implementation; StyleSheetImpl *m_sheet; QString m_usersheet; QString m_printSheet; QStringList m_availableSheets; // 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; CSSStyleSheetImpl *m_elemSheet; QPaintDevice *m_paintDevice; QPaintDeviceMetrics *m_paintDeviceMetrics; ParseMode pMode; HTMLMode hMode; QColor m_textColor; NodeImpl *m_focusNode; NodeImpl *m_hoverNode; // ### replace me with something more efficient // in lookup and insertion. DOMStringImpl **m_elementNames; unsigned short m_elementNameAlloc; unsigned short m_elementNameCount; DOMStringImpl **m_attrNames; unsigned short m_attrNameAlloc; unsigned short m_attrNameCount; DOMStringImpl** m_namespaceURIs; unsigned short m_namespaceURIAlloc; unsigned short m_namespaceURICount; QPtrList<NodeIteratorImpl> m_nodeIterators; AbstractViewImpl *m_defaultView; unsigned short m_listenerTypes; StyleSheetListImpl* m_styleSheets; LocalStyleRefs m_localStyleRefs; // references to inlined style elements QPtrList<RegisteredEventListener> m_windowEventListeners; QPtrList<NodeImpl> m_maintainsState; QColor m_linkColor; QColor m_visitedLinkColor; QColor m_activeLinkColor; DOMString m_preferredStylesheetSet; bool m_loadingSheet; bool visuallyOrdered; bool m_bParsing; bool m_bAllDataReceived; bool m_docChanged; bool m_styleSelectorDirty; bool m_inStyleRecalc; bool m_usesDescendantRules; bool m_usesSiblingRules; DOMString m_title; RenderArena* m_renderArena;#if APPLE_CHANGES KWQAccObjectCache* m_accCache;#endif QPtrList<HTMLImageLoader> m_imageLoadEventDispatchSoonList; QPtrList<HTMLImageLoader> m_imageLoadEventDispatchingList; int m_imageLoadEventTimer; NodeImpl* m_cssTarget; bool m_processingLoadEvent; QTime m_startTime; bool m_overMinimumLayoutThreshold; #ifndef KHTML_NO_XBL XBL::XBLBindingManager* m_bindingManager; // The access point through which documents and elements communicate with XBL.#endif QMap<QString, HTMLMapElementImpl *> m_imageMapsByName;#if APPLE_CHANGESpublic: KWQSignal m_finishedParsing; static Document createInstance (DocumentImpl *impl); bool inPageCache(); void setInPageCache(bool flag); void restoreRenderer(khtml::RenderObject* render); void passwordFieldAdded(); void passwordFieldRemoved(); bool hasPasswordField() const; void secureFormAdded(); void secureFormRemoved(); bool hasSecureForm() const; void setShouldCreateRenderers(bool f); bool shouldCreateRenderers(); void setDecoder(khtml::Decoder *); khtml::Decoder *decoder() const { return m_decoder; }private: JSEditor *jsEditor(); JSEditor *m_jsEditor; bool relinquishesEditingFocus(NodeImpl *node); bool acceptsEditingFocus(NodeImpl *node); mutable DOMString m_domain; bool m_inPageCache; khtml::RenderObject *m_savedRenderer; int m_passwordFields; int m_secureForms; khtml::Decoder *m_decoder; QDict<ElementImpl> m_elementsById; QDict<ElementImpl> m_elementsByAccessKey; bool m_accessKeyDictValid; bool m_createRenderers;#endif};class DocumentFragmentImpl : public NodeBaseImpl{public: DocumentFragmentImpl(DocumentPtr *doc); DocumentFragmentImpl(const DocumentFragmentImpl &other); // DOM methods overridden from parent classes virtual DOMString nodeName() const; virtual unsigned short nodeType() const; virtual NodeImpl *cloneNode ( bool deep ); // Other methods (not part of DOM) virtual bool childTypeAllowed( unsigned short type ); virtual DOMString toString() const;};class DocumentTypeImpl : public NodeImpl{public: DocumentTypeImpl(DOMImplementationImpl *_implementation, DocumentPtr *doc, const DOMString &qualifiedName, const DOMString &publicId, const DOMString &systemId); ~DocumentTypeImpl(); // DOM methods & attributes for DocumentType NamedNodeMapImpl *entities() const { return m_entities; } NamedNodeMapImpl *notations() const { return m_notations; } DOMString name() const { return m_qualifiedName; } DOMString publicId() const { return m_publicId; } DOMString systemId() const { return m_systemId; } DOMString internalSubset() const { return m_subset; } // DOM methods overridden from parent classes virtual DOMString nodeName() const; virtual unsigned short nodeType() const; virtual bool childTypeAllowed( unsigned short type ); virtual NodeImpl *cloneNode ( bool deep ); // Other methods (not part of DOM) void setName(const DOMString& n) { m_qualifiedName = n; } void setPublicId(const DOMString& publicId) { m_publicId = publicId; } void setSystemId(const DOMString& systemId) { m_systemId = systemId; } DOMImplementationImpl *implementation() const { return m_implementation; } void copyFrom(const DocumentTypeImpl&); virtual DOMString toString() const;#if APPLE_CHANGES static DocumentType createInstance (DocumentTypeImpl *impl);#endifprotected: DOMImplementationImpl *m_implementation; NamedNodeMapImpl* m_entities; NamedNodeMapImpl* m_notations; DOMString m_qualifiedName; DOMString m_publicId; DOMString m_systemId; DOMString m_subset;};}; //namespace#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -