📄 dom_doc.cpp
字号:
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = exceptioncode; return 0; }
#else
throw DOMException(exceptioncode);
#endif
return r;
}
bool Document::isHTMLDocument() const
{
if (impl) return ((DocumentImpl *)impl)->isHTMLDocument();
return 0;
}
Range Document::createRange()
{
if (impl) return ((DocumentImpl *)impl)->createRange();
return 0;
}
NodeIterator Document::createNodeIterator(const Node &root, unsigned long whatToShow,
const NodeFilter &filter, bool expandEntityReferences)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return 0; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
int exceptioncode = 0;
NodeIteratorImpl *result = static_cast<DocumentImpl*>(impl)->createNodeIterator(root.handle(), whatToShow,
filter.handle(), expandEntityReferences, exceptioncode);
if (exceptioncode)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = exceptioncode; return 0; }
#else
throw DOMException(exceptioncode);
#endif
return result;
}
TreeWalker Document::createTreeWalker(const Node &root, unsigned long whatToShow,
const NodeFilter &filter, bool expandEntityReferences)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return 0; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
int exceptioncode = 0;
TreeWalkerImpl *result = static_cast<DocumentImpl*>(impl)->createTreeWalker(root.handle(), whatToShow,
filter.handle(), expandEntityReferences, exceptioncode);
if (exceptioncode)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = exceptioncode; return 0Lu; }
#else
throw DOMException(exceptioncode);
#endif
return result;
}
Event Document::createEvent(const DOMString &eventType)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return 0; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
int exceptioncode = 0;
EventImpl *r = ((DocumentImpl *)impl)->createEvent(eventType,exceptioncode);
if (exceptioncode)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = exceptioncode; return 0; }
#else
throw DOMException(exceptioncode);
#endif
return r;
}
AbstractView Document::defaultView() const
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return 0; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
return ((DocumentImpl *)impl)->defaultView();
}
StyleSheetList Document::styleSheets() const
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return 0; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
return ((DocumentImpl *)impl)->styleSheets();
}
DOMString Document::preferredStylesheetSet()
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return DOMString(); }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
return ((DocumentImpl*)impl)->preferredStylesheetSet();
}
DOMString Document::selectedStylesheetSet()
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; DOMString(); }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
return ((DocumentImpl*)impl)->selectedStylesheetSet();
}
void Document::setSelectedStylesheetSet(const DOMString& aString)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
return ((DocumentImpl*)impl)->setSelectedStylesheetSet(aString);
}
KHTMLView *Document::view() const
{
if (!impl) return 0;
return static_cast<DocumentImpl*>(impl)->view();
}
KHTMLPart *Document::part() const
{
if (!impl) return 0;
return static_cast<DocumentImpl*>(impl)->part();
}
DOMString Document::completeURL(const DOMString& url)
{
if ( !impl ) return url;
return static_cast<DocumentImpl*>( impl )->completeURL( url.string() );
}
DOMString Document::toString() const
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::NOT_FOUND_ERR; return DOMString(); }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->toString();
}
CSSStyleDeclaration Document::getOverrideStyle(const Element &elt, const DOMString &pseudoElt)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::INVALID_STATE_ERR; return 0; }
#else
throw DOMException(DOMException::INVALID_STATE_ERR);
#endif
int exceptioncode = 0;
CSSStyleDeclarationImpl *r = ((DocumentImpl *)impl)->getOverrideStyle(static_cast<ElementImpl*>(elt.handle()),pseudoElt.implementation());
if (exceptioncode)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = exceptioncode; return 0; }
#else
throw DOMException(exceptioncode);
#endif
return r;
}
bool Document::execCommand(const DOMString &command, bool userInterface, const DOMString &value)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode =DOMException::NOT_FOUND_ERR; return false; }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->execCommand(command, userInterface, value);
}
bool Document::queryCommandEnabled(const DOMString &command)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode =DOMException::NOT_FOUND_ERR; return false; }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->queryCommandEnabled(command);
}
bool Document::queryCommandIndeterm(const DOMString &command)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode =DOMException::NOT_FOUND_ERR; return false; }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->queryCommandIndeterm(command);
}
bool Document::queryCommandState(const DOMString &command)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode =DOMException::NOT_FOUND_ERR; return false; }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->queryCommandState(command);
}
bool Document::queryCommandSupported(const DOMString &command)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode =DOMException::NOT_FOUND_ERR; return false; }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->queryCommandSupported(command);
}
DOMString Document::queryCommandValue(const DOMString &command)
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode =DOMException::NOT_FOUND_ERR; return DOMString(); }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentImpl*>(impl)->queryCommandValue(command);
}
// ----------------------------------------------------------------------------
DocumentFragment::DocumentFragment() : Node()
{
}
DocumentFragment::DocumentFragment(const DocumentFragment &other) : Node(other)
{
}
DocumentFragment &DocumentFragment::operator = (const Node &other)
{
NodeImpl* ohandle = other.handle();
if ( impl != ohandle ) {
if (!ohandle || ohandle->nodeType() != DOCUMENT_FRAGMENT_NODE) {
if ( impl ) impl->deref();
impl = 0;
} else {
Node::operator =(other);
}
}
return *this;
}
DocumentFragment &DocumentFragment::operator = (const DocumentFragment &other)
{
Node::operator =(other);
return *this;
}
DocumentFragment::~DocumentFragment()
{
}
DocumentFragment::DocumentFragment(DocumentFragmentImpl *i) : Node(i)
{
}
// ----------------------------------------------------------------------------
DocumentType::DocumentType()
: Node()
{
}
DocumentType::DocumentType(const DocumentType &other)
: Node(other)
{
}
DocumentType::DocumentType(DocumentTypeImpl *impl) : Node(impl)
{
}
DocumentType &DocumentType::operator = (const Node &other)
{
NodeImpl* ohandle = other.handle();
if ( impl != ohandle ) {
if (!ohandle || ohandle->nodeType() != DOCUMENT_TYPE_NODE) {
if ( impl ) impl->deref();
impl = 0;
} else {
Node::operator =(other);
}
}
return *this;
}
DocumentType &DocumentType::operator = (const DocumentType &other)
{
Node::operator =(other);
return *this;
}
DocumentType::~DocumentType()
{
}
DOMString DocumentType::name() const
{
if (!impl)
return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
return static_cast<DocumentTypeImpl*>(impl)->name();
}
NamedNodeMap DocumentType::entities() const
{
if (!impl)
return 0; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
return static_cast<DocumentTypeImpl*>(impl)->entities();
}
NamedNodeMap DocumentType::notations() const
{
if (!impl)
return 0; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
return static_cast<DocumentTypeImpl*>(impl)->notations();
}
DOMString DocumentType::publicId() const
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::NOT_FOUND_ERR; DOMString(); }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentTypeImpl*>(impl)->publicId();
}
DOMString DocumentType::systemId() const
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::NOT_FOUND_ERR; DOMString(); }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentTypeImpl*>(impl)->systemId();
}
DOMString DocumentType::internalSubset() const
{
if (!impl)
#if KHTML_NO_EXCEPTIONS
{ _exceptioncode = DOMException::NOT_FOUND_ERR; DOMString(); }
#else
throw DOMException(DOMException::NOT_FOUND_ERR);
#endif
return static_cast<DocumentTypeImpl*>(impl)->internalSubset();
}
} // namespace DOM
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -