📄 dom_docimpl.h
字号:
ParseMode parseMode() const { return pMode; } bool inCompatMode() const { return pMode == Compat; } bool inTransitionalMode() const { return pMode == Transitional; } bool inStrictMode() const { return pMode == Strict; } //void setHTMLMode( HTMLMode m ) { hMode = m; } HTMLMode htmlMode() const { return hMode; } void setParsing(bool b) { m_bParsing = b; } bool parsing() const { return m_bParsing; } void setTextColor( QColor color ) { m_textColor = color; } QColor textColor() const { return m_textColor; } void setDesignMode(bool b); bool designMode() const; // internal bool prepareMouseEvent( bool readonly, int x, int y, MouseEvent *ev ); virtual bool childAllowed( NodeImpl *newChild ); virtual bool childTypeAllowed( unsigned short nodeType ); virtual NodeImpl *cloneNode ( bool deep ); NodeImpl::Id getId( NodeImpl::IdType _type, DOMStringImpl* _nsURI, DOMStringImpl *_localName, DOMStringImpl *_prefix, bool readonly, bool lookupHTML, int *pExceptioncode = 0); NodeImpl::Id getId( NodeImpl::IdType _type, DOMStringImpl *_nodeName, bool readonly, bool lookupHTML, int *pExceptioncode = 0); DOMString getName( NodeImpl::IdType _type, NodeImpl::Id _id ) const; StyleSheetListImpl* styleSheets() { return m_styleSheets; }; DOMString preferredStylesheetSet() const { return m_preferredStylesheetSet; } DOMString selectedStylesheetSet() const; void setSelectedStylesheetSet(const DOMString&); void setPreferredStylesheetSet(const DOMString& s) { m_preferredStylesheetSet = s; } void addStyleSheet(StyleSheetImpl *, int *exceptioncode = 0); void removeStyleSheet(StyleSheetImpl *, int *exceptioncode = 0); QStringList availableStyleSheets() const { return m_availableSheets; } NodeImpl* hoverNode() const { return m_hoverNode; } void setHoverNode(NodeImpl *newHoverNode); NodeImpl *focusNode() const { return m_focusNode; } void setFocusNode(NodeImpl *newFocusNode); // Updates for :target (CSS3 selector). void setCSSTarget(NodeImpl* n); NodeImpl* getCSSTarget() { return m_cssTarget; } bool isDocumentChanged() { return m_docChanged; } virtual void setDocumentChanged(bool = true); void attachNodeIterator(NodeIteratorImpl *ni); void detachNodeIterator(NodeIteratorImpl *ni); void notifyBeforeNodeRemoval(NodeImpl *n); AbstractViewImpl *defaultView() const { return m_defaultView; } 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); bool async() const { return m_async; } void setAsync(bool b) { m_async = b; } void abort(); void load(const DOMString &uri); void loadXML(const DOMString &source); // from cachedObjectClient void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet); void error(int err, const QString &text); typedef QMap<QString, ProcessingInstructionImpl*> LocalStyleRefs; LocalStyleRefs* localStyleRefs() { return &m_localStyleRefs; } virtual void defaultEventHandler(EventImpl *evt); virtual void setHTMLWindowEventListener(int id, EventListener *listener); EventListener *getHTMLWindowEventListener(int id); EventListener *createHTMLEventListener(const QString& code, const QString& name, NodeImpl* node); 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); ElementImpl* findAccessKeyElement(QChar c); 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(HTMLImageElementImpl *); void dispatchImageLoadEventsNow(); void removeImage(HTMLImageElementImpl *); virtual void timerEvent(QTimerEvent *); // Returns the owning element in the parent document. // Returns 0 if this is the top level document. ElementImpl *ownerElement() const; DOMString domain() const; void setDomain( const DOMString &newDomain ); // not part of the DOM bool isURLAllowed(const QString& url) const; HTMLElementImpl* body(); DOMString toString() const; void incDOMTreeVersion() { ++m_domtree_version; } unsigned int domTreeVersion() const { return m_domtree_version; } QDict<khtml::CounterNode>* counters(const khtml::RenderObject* o) { return m_counterDict[(void*)o]; } void setCounters(const khtml::RenderObject* o, QDict<khtml::CounterNode> *dict) { m_counterDict.insert((void*)o, dict);} void removeCounters(const khtml::RenderObject* o) { m_counterDict.remove((void*)o); } ElementMappingCache& underDocNamedCache() { return m_underDocNamedCache; } NodeListImpl::Cache* acquireCachedNodeListInfo(NodeListImpl::CacheFactory* fact, NodeImpl* base, int type); void releaseCachedNodeListInfo(NodeListImpl::Cache* cache); ElementMappingCache& getElementByIdCache() const { return m_getElementByIdCache; }signals: void finishedParsing();protected: khtml::CSSStyleSelector *m_styleSelector; KHTMLView *m_view; QStringList m_state; khtml::DocLoader *m_docLoader; khtml::Tokenizer *m_tokenizer; KURL m_url; KURL m_baseURL; QString m_baseTarget; DocumentTypeImpl *m_doctype; DOMImplementationImpl *m_implementation; 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; bool m_ignorePendingStylesheets; CSSStyleSheetImpl *m_elemSheet; QPaintDevice *m_paintDevice; QPaintDeviceMetrics *m_paintDeviceMetrics; ParseMode pMode; HTMLMode hMode; QColor m_textColor; NodeImpl *m_hoverNode; NodeImpl *m_focusNode; NodeImpl *m_cssTarget; unsigned int m_domtree_version; struct IdNameMapping { IdNameMapping(unsigned short _start) : idStart(_start), count(0) {} ~IdNameMapping() { QIntDictIterator<DOM::DOMStringImpl> it(names); for (; it.current() ; ++it) it.current()->deref(); } unsigned short idStart; unsigned short count; QIntDict<DOM::DOMStringImpl> names; QDict<void> ids; }; IdNameMapping *m_attrMap; IdNameMapping *m_elementMap; IdNameMapping *m_namespaceMap; QPtrList<NodeIteratorImpl> m_nodeIterators; AbstractViewImpl *m_defaultView; unsigned short m_listenerTypes; StyleSheetListImpl* m_styleSheets; StyleSheetListImpl *m_addedStyleSheets; // programmatically added style sheets LocalStyleRefs m_localStyleRefs; // references to inlined style elements RegisteredListenerList m_windowEventListeners; QPtrList<NodeImpl> m_maintainsState; // ### evaluate for placement in RenderStyle QPtrDict<QDict<khtml::CounterNode> > m_counterDict; bool visuallyOrdered; bool m_bParsing; bool m_docChanged; bool m_styleSelectorDirty; bool m_inStyleRecalc; bool m_usesDescendantRules; bool m_async; bool m_hadLoadError; bool m_docLoading; bool m_inSyncLoad; DOMString m_title; DOMString m_preferredStylesheetSet; khtml::CachedCSSStyleSheet *m_loadingXMLDoc; int m_decoderMibEnum; //Forms, images, etc., must be quickly accessible via document.name. ElementMappingCache m_underDocNamedCache; //Cache for nodelists and collections. QIntDict<NodeListImpl::Cache> m_nodeListCache; QPtrList<HTMLImageElementImpl> m_imageLoadEventDispatchSoonList; QPtrList<HTMLImageElementImpl> m_imageLoadEventDispatchingList; int m_imageLoadEventTimer; //Cache for getElementById mutable ElementMappingCache m_getElementByIdCache; khtml::RenderArena* m_renderArena;private: mutable DOMString m_domain;};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; NamedNodeMapImpl *notations() const; 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;protected: DOMImplementationImpl *m_implementation; mutable NamedNodeMapImpl* m_entities; mutable 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 + -