- next pass of moving code from C++ DOM wrappers into the DOM impl. classes
(this step adds still more member functions missing from the DOM impl. and
changes some of the C++ and Objective-C DOM to call the new ones; also
changes various places that use the C++ DOM to use the DOM impl. instead)
* khtml/css/css_computedstyle.cpp:
(DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
* khtml/css/css_computedstyle.h:
* khtml/css/css_stylesheetimpl.cpp:
(CSSStyleSheetImpl::cssRules):
* khtml/css/css_stylesheetimpl.h:
* khtml/css/css_valueimpl.cpp:
(DOM::CSSStyleDeclarationImpl::getPropertyCSSValue):
(DOM::CSSStyleDeclarationImpl::getPropertyValue):
(DOM::CSSStyleDeclarationImpl::getPropertyPriority):
(DOM::CSSStyleDeclarationImpl::setProperty):
(DOM::CSSStyleDeclarationImpl::removeProperty):
(DOM::CSSMutableStyleDeclarationImpl::getPropertyValue):
(DOM::CSSPrimitiveValueImpl::CSSPrimitiveValueImpl):
(DOM::operator==):
(DOM::CSSStyleDeclarationImpl::propertyID):
* khtml/css/css_valueimpl.h:
(DOM::CSSValueImpl::setCssText):
(DOM::CSSPrimitiveValueImpl::getDashboardRegionValue):
* khtml/dom/css_rule.cpp:
* khtml/dom/css_rule.h:
* khtml/dom/css_stylesheet.h:
(DOM::CSSException::):
* khtml/dom/css_value.cpp:
(DOM::CSSStyleDeclaration::getPropertyValue):
(DOM::CSSStyleDeclaration::getPropertyCSSValue):
(DOM::CSSStyleDeclaration::removeProperty):
(DOM::CSSStyleDeclaration::getPropertyPriority):
(DOM::CSSStyleDeclaration::setProperty):
* khtml/dom/css_value.h:
* khtml/dom/dom2_events.cpp:
(EventListener::handleEvent):
* khtml/dom/dom2_events.h:
* khtml/dom/dom2_traversal.h:
* khtml/dom/dom_doc.cpp:
(DOM::DOMImplementation::createHTMLDocument):
(DOM::DOMImplementation::createCSSStyleSheet):
(DOM::Document::doctype):
(DOM::Document::createAttribute):
(DOM::Document::createAttributeNS):
(DOM::Document::queryCommandValue):
(DOM::Document::handle):
* khtml/dom/dom_doc.h:
* khtml/dom/dom_element.cpp:
(Attr::name):
(Attr::value):
(Element::getAttribute):
(Element::setAttribute):
(Element::removeAttribute):
(Element::getAttributeNode):
(Element::setAttributeNode):
(Element::removeAttributeNode):
(Element::getElementsByTagName):
(Element::getElementsByTagNameNS):
(Element::getAttributeNS):
(Element::setAttributeNS):
(Element::removeAttributeNS):
(Element::getAttributeNodeNS):
(Element::setAttributeNodeNS):
(Element::hasAttribute):
(Element::hasAttributeNS):
(Element::style):
* khtml/dom/dom_exception.h:
* khtml/dom/dom_misc.cpp:
(DOM::DomShared::deleteMe):
* khtml/dom/dom_misc.h:
(DOM::DomShared::deleteMe):
* khtml/dom/dom_node.cpp:
(NamedNodeMap::getNamedItemNS):
(NamedNodeMap::setNamedItemNS):
(NamedNodeMap::removeNamedItemNS):
(Node::ownerDocument):
(Node::hasAttributes):
(Node::isSupported):
(Node::addEventListener):
(Node::removeEventListener):
* khtml/dom/dom_node.h:
* khtml/dom/html_document.cpp:
(HTMLDocument::setTitle):
(HTMLDocument::completeURL):
(HTMLDocument::getElementsByName):
* khtml/dom/html_element.cpp:
(HTMLElement::setInnerHTML):
(HTMLElement::setInnerText):
(HTMLElement::setOuterHTML):
(HTMLElement::setOuterText):
* khtml/dom/html_form.cpp:
(HTMLLabelElement::form):
(HTMLSelectElement::setValue):
(HTMLSelectElement::options):
(HTMLOptionElement::setValue):
* khtml/dom/html_inline.cpp:
(HTMLAnchorElement::accessKey):
(HTMLAnchorElement::setAccessKey):
(HTMLAnchorElement::charset):
(HTMLAnchorElement::setCharset):
(HTMLAnchorElement::coords):
(HTMLAnchorElement::setCoords):
(HTMLAnchorElement::href):
(HTMLAnchorElement::setHref):
(HTMLAnchorElement::hreflang):
(HTMLAnchorElement::setHreflang):
(HTMLAnchorElement::name):
(HTMLAnchorElement::setName):
(HTMLAnchorElement::rel):
(HTMLAnchorElement::setRel):
(HTMLAnchorElement::rev):
(HTMLAnchorElement::setRev):
(HTMLAnchorElement::shape):
(HTMLAnchorElement::setShape):
(HTMLAnchorElement::tabIndex):
(HTMLAnchorElement::setTabIndex):
(HTMLAnchorElement::target):
(HTMLAnchorElement::setTarget):
(HTMLAnchorElement::type):
(HTMLAnchorElement::setType):
(HTMLAnchorElement::blur):
(HTMLAnchorElement::focus):
(HTMLBRElement::clear):
(HTMLBRElement::setClear):
(HTMLFontElement::color):
(HTMLFontElement::setColor):
(HTMLFontElement::face):
(HTMLFontElement::setFace):
(HTMLFontElement::size):
(HTMLFontElement::setSize):
(HTMLModElement::cite):
(HTMLModElement::setCite):
(HTMLModElement::dateTime):
(HTMLModElement::setDateTime):
(HTMLQuoteElement::cite):
(HTMLQuoteElement::setCite):
* khtml/dom/html_misc.cpp:
(HTMLCollection::HTMLCollection):
(HTMLCollection::base):
(HTMLCollection::namedItems):
* khtml/dom/html_misc.h:
* khtml/editing/htmlediting.cpp:
* khtml/editing/selection.cpp:
* khtml/html/html_documentimpl.cpp:
(DOM::HTMLDocumentImpl::determineParseMode):
(DOM::HTMLDocumentImpl::doctype):
* khtml/html/html_documentimpl.h:
* khtml/html/html_elementimpl.cpp:
(HTMLElementImpl::setInnerHTML):
(HTMLElementImpl::setOuterHTML):
(HTMLElementImpl::setInnerText):
(HTMLElementImpl::setOuterText):
(HTMLElementImpl::style):
(HTMLElementImpl::idDOM):
(HTMLElementImpl::setId):
(HTMLElementImpl::title):
(HTMLElementImpl::setTitle):
(HTMLElementImpl::lang):
(HTMLElementImpl::setLang):
(HTMLElementImpl::dir):
(HTMLElementImpl::setDir):
(HTMLElementImpl::className):
(HTMLElementImpl::setClassName):
(HTMLElementImpl::children):
(HTMLGenericElementImpl::HTMLGenericElementImpl):
(HTMLGenericElementImpl::id):
* khtml/html/html_elementimpl.h:
(DOM::HTMLElementImpl::isGenericFormElement):
* khtml/html/html_formimpl.cpp:
(DOM::HTMLFormElementImpl::parseEnctype):
(DOM::HTMLFormElementImpl::parseHTMLAttribute):
(DOM::HTMLFormElementImpl::elements):
(DOM::HTMLFormElementImpl::name):
(DOM::HTMLFormElementImpl::setName):
(DOM::HTMLFormElementImpl::acceptCharset):
(DOM::HTMLFormElementImpl::setAcceptCharset):
(DOM::HTMLFormElementImpl::action):
(DOM::HTMLFormElementImpl::setAction):
(DOM::HTMLFormElementImpl::setEnctype):
(DOM::HTMLFormElementImpl::method):
(DOM::HTMLFormElementImpl::setMethod):
(DOM::HTMLFormElementImpl::target):
(DOM::HTMLFormElementImpl::setTarget):
(DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl):
(DOM::HTMLGenericFormElementImpl::~HTMLGenericFormElementImpl):
(DOM::HTMLGenericFormElementImpl::parseHTMLAttribute):
(DOM::HTMLGenericFormElementImpl::name):
(DOM::HTMLGenericFormElementImpl::setName):
(DOM::HTMLGenericFormElementImpl::setOverrideName):
(DOM::HTMLGenericFormElementImpl::setDisabled):
(DOM::HTMLGenericFormElementImpl::setReadOnly):
(DOM::HTMLGenericFormElementImpl::tabIndex):
(DOM::HTMLGenericFormElementImpl::setTabIndex):
(DOM::HTMLButtonElementImpl::accessKey):
(DOM::HTMLButtonElementImpl::setAccessKey):
(DOM::HTMLButtonElementImpl::value):
(DOM::HTMLButtonElementImpl::setValue):
(DOM::HTMLInputElementImpl::HTMLInputElementImpl):
(DOM::HTMLInputElementImpl::parseHTMLAttribute):
(DOM::HTMLInputElementImpl::defaultValue):
(DOM::HTMLInputElementImpl::setDefaultValue):
(DOM::HTMLInputElementImpl::defaultChecked):
(DOM::HTMLInputElementImpl::setDefaultChecked):
(DOM::HTMLInputElementImpl::accept):
(DOM::HTMLInputElementImpl::setAccept):
(DOM::HTMLInputElementImpl::accessKey):
(DOM::HTMLInputElementImpl::setAccessKey):
(DOM::HTMLInputElementImpl::align):
(DOM::HTMLInputElementImpl::setAlign):
(DOM::HTMLInputElementImpl::alt):
(DOM::HTMLInputElementImpl::setAlt):
(DOM::HTMLInputElementImpl::setMaxLength):
(DOM::HTMLInputElementImpl::sizeDOM):
(DOM::HTMLInputElementImpl::setSize):
(DOM::HTMLInputElementImpl::src):
(DOM::HTMLInputElementImpl::setSrc):
(DOM::HTMLInputElementImpl::useMap):
(DOM::HTMLInputElementImpl::setUseMap):
(DOM::HTMLLabelElementImpl::form):
(DOM::HTMLLabelElementImpl::accessKey):
(DOM::HTMLLabelElementImpl::setAccessKey):
(DOM::HTMLLabelElementImpl::htmlFor):
(DOM::HTMLLabelElementImpl::setHtmlFor):
(DOM::HTMLLegendElementImpl::accessKey):
(DOM::HTMLLegendElementImpl::setAccessKey):
(DOM::HTMLLegendElementImpl::align):
(DOM::HTMLLegendElementImpl::setAlign):
(DOM::HTMLSelectElementImpl::setValue):
(DOM::HTMLSelectElementImpl::optionsHTMLCollection):
(DOM::HTMLSelectElementImpl::setMultiple):
(DOM::HTMLSelectElementImpl::setSize):
(DOM::HTMLOptGroupElementImpl::label):
(DOM::HTMLOptGroupElementImpl::setLabel):
(DOM::HTMLOptionElementImpl::setText):
(DOM::HTMLOptionElementImpl::setIndex):
(DOM::HTMLOptionElementImpl::setValue):
(DOM::HTMLOptionElementImpl::defaultSelected):
(DOM::HTMLOptionElementImpl::setDefaultSelected):
(DOM::HTMLOptionElementImpl::label):
(DOM::HTMLOptionElementImpl::setLabel):
(DOM::HTMLTextAreaElementImpl::accessKey):
(DOM::HTMLTextAreaElementImpl::setAccessKey):
(DOM::HTMLTextAreaElementImpl::setCols):
(DOM::HTMLTextAreaElementImpl::setRows):
(DOM::HTMLIsIndexElementImpl::HTMLIsIndexElementImpl):
(DOM::HTMLIsIndexElementImpl::parseHTMLAttribute):
(DOM::HTMLIsIndexElementImpl::prompt):
(DOM::HTMLIsIndexElementImpl::setPrompt):
* khtml/html/html_formimpl.h:
* khtml/html/html_headimpl.cpp:
(HTMLBaseElementImpl::setHref):
(HTMLBaseElementImpl::setTarget):
(HTMLLinkElementImpl::disabled):
(HTMLLinkElementImpl::setDisabled):
(HTMLLinkElementImpl::charset):
(HTMLLinkElementImpl::setCharset):
(HTMLLinkElementImpl::href):
(HTMLLinkElementImpl::setHref):
(HTMLLinkElementImpl::hreflang):
(HTMLLinkElementImpl::setHreflang):
(HTMLLinkElementImpl::media):
(HTMLLinkElementImpl::setMedia):
(HTMLLinkElementImpl::rel):
(HTMLLinkElementImpl::setRel):
(HTMLLinkElementImpl::rev):
(HTMLLinkElementImpl::setRev):
(HTMLLinkElementImpl::target):
(HTMLLinkElementImpl::setTarget):
(HTMLLinkElementImpl::type):
(HTMLLinkElementImpl::setType):
(HTMLMetaElementImpl::content):
(HTMLMetaElementImpl::setContent):
(HTMLMetaElementImpl::httpEquiv):
(HTMLMetaElementImpl::setHttpEquiv):
(HTMLMetaElementImpl::name):
(HTMLMetaElementImpl::setName):
(HTMLMetaElementImpl::scheme):
(HTMLMetaElementImpl::setScheme):
(HTMLScriptElementImpl::id):
(HTMLScriptElementImpl::isURLAttribute):
(HTMLScriptElementImpl::insertedIntoDocument):
(HTMLScriptElementImpl::notifyFinished):
(HTMLScriptElementImpl::text):
(HTMLScriptElementImpl::setText):
(HTMLScriptElementImpl::htmlFor):
(HTMLScriptElementImpl::setHtmlFor):
(HTMLScriptElementImpl::event):
(HTMLScriptElementImpl::setEvent):
(HTMLScriptElementImpl::charset):
(HTMLScriptElementImpl::setCharset):
(HTMLScriptElementImpl::defer):
(HTMLScriptElementImpl::setDefer):
(HTMLScriptElementImpl::src):
(HTMLScriptElementImpl::setSrc):
(HTMLScriptElementImpl::type):
(HTMLScriptElementImpl::setType):
(HTMLStyleElementImpl::disabled):
(HTMLStyleElementImpl::setDisabled):
(HTMLStyleElementImpl::media):
(HTMLStyleElementImpl::setMedia):
(HTMLStyleElementImpl::type):
(HTMLStyleElementImpl::setType):
(HTMLTitleElementImpl::insertedIntoDocument):
(HTMLTitleElementImpl::childrenChanged):
(HTMLTitleElementImpl::text):
(HTMLTitleElementImpl::setText):
* khtml/html/html_headimpl.h:
* khtml/html/html_miscimpl.cpp:
(DOM::HTMLBaseFontElementImpl::id):
(DOM::HTMLBaseFontElementImpl::color):
(DOM::HTMLBaseFontElementImpl::setColor):
(DOM::HTMLBaseFontElementImpl::face):
(DOM::HTMLBaseFontElementImpl::setFace):
(DOM::HTMLBaseFontElementImpl::size):
(DOM::HTMLBaseFontElementImpl::setSize):
(DOM::HTMLCollectionImpl::HTMLCollectionImpl):
(DOM::HTMLCollectionImpl::~HTMLCollectionImpl):
(DOM::HTMLCollectionImpl::resetCollectionInfo):
(DOM::HTMLCollectionImpl::traverseNextItem):
(DOM::HTMLCollectionImpl::calcLength):
(DOM::HTMLCollectionImpl::item):
(DOM::HTMLCollectionImpl::namedItem):
(DOM::HTMLCollectionImpl::updateNameCache):
(DOM::HTMLCollectionImpl::namedItems):
(DOM::HTMLCollectionImpl::nextNamedItem):
(DOM::HTMLFormCollectionImpl::HTMLFormCollectionImpl):
(DOM::HTMLFormCollectionImpl::calcLength):
(DOM::HTMLFormCollectionImpl::item):
(DOM::HTMLFormCollectionImpl::getNamedFormItem):
(DOM::HTMLFormCollectionImpl::nextNamedItemInternal):
(DOM::HTMLFormCollectionImpl::namedItem):
(DOM::HTMLFormCollectionImpl::updateNameCache):
* khtml/html/html_miscimpl.h:
(DOM::HTMLCollectionImpl::base):
* khtml/html/htmlparser.cpp:
(KHTMLParser::parseToken):
(KHTMLParser::insertNode):
* khtml/html/htmltokenizer.cpp:
(khtml::HTMLTokenizer::scriptExecution):
* khtml/khtml_events.cpp:
(khtml::MouseEvent::MouseEvent):
(khtml::MouseEvent::offset):
* khtml/khtml_events.h:
(khtml::MouseEvent::innerNode):
(khtml::MousePressEvent::MousePressEvent):
(khtml::MouseDoubleClickEvent::MouseDoubleClickEvent):
(khtml::MouseMoveEvent::MouseMoveEvent):
(khtml::MouseReleaseEvent::MouseReleaseEvent):
* khtml/khtml_part.cpp:
(KHTMLPart::closeURL):
(KHTMLPart::executeScript):
(KHTMLPart::scheduleScript):
(KHTMLPart::executeScheduledScript):
(KHTMLPart::clear):
(KHTMLPart::selectClosestWordFromMouseEvent):
(KHTMLPart::handleMousePressEventDoubleClick):
(KHTMLPart::handleMousePressEventTripleClick):
(KHTMLPart::handleMousePressEventSingleClick):
(KHTMLPart::khtmlMousePressEvent):
(KHTMLPart::handleMouseMoveEventDrag):
(KHTMLPart::handleMouseMoveEventOver):
(KHTMLPart::handleMouseMoveEventSelection):
(KHTMLPart::khtmlMouseReleaseEvent):
(KHTMLPart::selectionHasStyle):
(KHTMLPart::selectionStartHasStyle):
* khtml/khtml_part.h:
* khtml/khtmlpart_p.h:
* khtml/khtmlview.cpp:
(KHTMLViewPrivate::reset):
(KHTMLView::viewportMousePressEvent):
(KHTMLView::viewportMouseDoubleClickEvent):
(KHTMLView::contentsContextMenuEvent):
(KHTMLView::updateDragAndDrop):
(KHTMLView::cancelDragAndDrop):
(KHTMLView::performDragAndDrop):
(KHTMLView::focusNextPrevNode):
* kwq/DOM-CSS.mm:
(-[DOMCSSStyleSheet cssRules]):
(-[DOMCSSStyleDeclaration getPropertyValue:]):
(-[DOMCSSStyleDeclaration getPropertyCSSValue:]):
(-[DOMCSSStyleDeclaration removeProperty:]):
(-[DOMCSSStyleDeclaration getPropertyPriority:]):
(-[DOMCSSStyleDeclaration setProperty:::]):
(-[DOMCSSValue setCssText:]):
* kwq/DOMCSS.h:
* kwq/DOMHTML.mm:
(-[DOMHTMLElement setInnerHTML:]):
(-[DOMHTMLElement setOuterHTML:]):
(-[DOMHTMLElement setInnerText:]):
(-[DOMHTMLElement setOuterText:]):
(-[DOMHTMLSelectElement setLength:]):
(-[DOMHTMLTableSectionElement insertRow:]):
* kwq/DOMInternal.h:
* kwq/DOMInternal.mm:
(raiseDOMException):
(-[WebScriptObject _initializeScriptDOMNodeImp]):
* kwq/DOMUtility.mm:
(KJS::ScriptInterpreter::createObjcInstanceForValue):
* kwq/KWQAccObject.mm:
(-[KWQAccObject accessibilityAttributeValue:]):
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::KWQKHTMLPart):
(KWQKHTMLPart::advanceToNextMisspelling):
(KWQKHTMLPart::scrollOverflow):
(KWQKHTMLPart::paint):
(KWQKHTMLPart::openURLFromPageCache):
(KWQKHTMLPart::khtmlMousePressEvent):
(KWQKHTMLPart::passWidgetMouseDownEventToWidget):
(KWQKHTMLPart::dispatchDragSrcEvent):
(KWQKHTMLPart::eventMayStartDrag):
(KWQKHTMLPart::khtmlMouseMoveEvent):
(KWQKHTMLPart::dragSourceEndedAt):
(KWQKHTMLPart::mouseDown):
(KWQKHTMLPart::sendContextMenuEvent):
(listParent):
(isTextFirstInListItem):
(KWQKHTMLPart::attributedString):
(KWQKHTMLPart::snapshotDragImage):
(KWQKHTMLPart::mousePressNode):
* kwq/WebCoreBridge.mm:
(updateRenderingForBindings):
(-[WebCoreBridge _documentTypeString]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9156
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-05-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Chris Blumenberg.
+
+ - next pass of moving code from C++ DOM wrappers into the DOM impl. classes
+ (this step adds still more member functions missing from the DOM impl. and
+ changes some of the C++ and Objective-C DOM to call the new ones; also
+ changes various places that use the C++ DOM to use the DOM impl. instead)
+
+ * khtml/css/css_computedstyle.cpp:
+ (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
+ * khtml/css/css_computedstyle.h:
+ * khtml/css/css_stylesheetimpl.cpp:
+ (CSSStyleSheetImpl::cssRules):
+ * khtml/css/css_stylesheetimpl.h:
+ * khtml/css/css_valueimpl.cpp:
+ (DOM::CSSStyleDeclarationImpl::getPropertyCSSValue):
+ (DOM::CSSStyleDeclarationImpl::getPropertyValue):
+ (DOM::CSSStyleDeclarationImpl::getPropertyPriority):
+ (DOM::CSSStyleDeclarationImpl::setProperty):
+ (DOM::CSSStyleDeclarationImpl::removeProperty):
+ (DOM::CSSMutableStyleDeclarationImpl::getPropertyValue):
+ (DOM::CSSPrimitiveValueImpl::CSSPrimitiveValueImpl):
+ (DOM::operator==):
+ (DOM::CSSStyleDeclarationImpl::propertyID):
+ * khtml/css/css_valueimpl.h:
+ (DOM::CSSValueImpl::setCssText):
+ (DOM::CSSPrimitiveValueImpl::getDashboardRegionValue):
+ * khtml/dom/css_rule.cpp:
+ * khtml/dom/css_rule.h:
+ * khtml/dom/css_stylesheet.h:
+ (DOM::CSSException::):
+ * khtml/dom/css_value.cpp:
+ (DOM::CSSStyleDeclaration::getPropertyValue):
+ (DOM::CSSStyleDeclaration::getPropertyCSSValue):
+ (DOM::CSSStyleDeclaration::removeProperty):
+ (DOM::CSSStyleDeclaration::getPropertyPriority):
+ (DOM::CSSStyleDeclaration::setProperty):
+ * khtml/dom/css_value.h:
+ * khtml/dom/dom2_events.cpp:
+ (EventListener::handleEvent):
+ * khtml/dom/dom2_events.h:
+ * khtml/dom/dom2_traversal.h:
+ * khtml/dom/dom_doc.cpp:
+ (DOM::DOMImplementation::createHTMLDocument):
+ (DOM::DOMImplementation::createCSSStyleSheet):
+ (DOM::Document::doctype):
+ (DOM::Document::createAttribute):
+ (DOM::Document::createAttributeNS):
+ (DOM::Document::queryCommandValue):
+ (DOM::Document::handle):
+ * khtml/dom/dom_doc.h:
+ * khtml/dom/dom_element.cpp:
+ (Attr::name):
+ (Attr::value):
+ (Element::getAttribute):
+ (Element::setAttribute):
+ (Element::removeAttribute):
+ (Element::getAttributeNode):
+ (Element::setAttributeNode):
+ (Element::removeAttributeNode):
+ (Element::getElementsByTagName):
+ (Element::getElementsByTagNameNS):
+ (Element::getAttributeNS):
+ (Element::setAttributeNS):
+ (Element::removeAttributeNS):
+ (Element::getAttributeNodeNS):
+ (Element::setAttributeNodeNS):
+ (Element::hasAttribute):
+ (Element::hasAttributeNS):
+ (Element::style):
+ * khtml/dom/dom_exception.h:
+ * khtml/dom/dom_misc.cpp:
+ (DOM::DomShared::deleteMe):
+ * khtml/dom/dom_misc.h:
+ (DOM::DomShared::deleteMe):
+ * khtml/dom/dom_node.cpp:
+ (NamedNodeMap::getNamedItemNS):
+ (NamedNodeMap::setNamedItemNS):
+ (NamedNodeMap::removeNamedItemNS):
+ (Node::ownerDocument):
+ (Node::hasAttributes):
+ (Node::isSupported):
+ (Node::addEventListener):
+ (Node::removeEventListener):
+ * khtml/dom/dom_node.h:
+ * khtml/dom/html_document.cpp:
+ (HTMLDocument::setTitle):
+ (HTMLDocument::completeURL):
+ (HTMLDocument::getElementsByName):
+ * khtml/dom/html_element.cpp:
+ (HTMLElement::setInnerHTML):
+ (HTMLElement::setInnerText):
+ (HTMLElement::setOuterHTML):
+ (HTMLElement::setOuterText):
+ * khtml/dom/html_form.cpp:
+ (HTMLLabelElement::form):
+ (HTMLSelectElement::setValue):
+ (HTMLSelectElement::options):
+ (HTMLOptionElement::setValue):
+ * khtml/dom/html_inline.cpp:
+ (HTMLAnchorElement::accessKey):
+ (HTMLAnchorElement::setAccessKey):
+ (HTMLAnchorElement::charset):
+ (HTMLAnchorElement::setCharset):
+ (HTMLAnchorElement::coords):
+ (HTMLAnchorElement::setCoords):
+ (HTMLAnchorElement::href):
+ (HTMLAnchorElement::setHref):
+ (HTMLAnchorElement::hreflang):
+ (HTMLAnchorElement::setHreflang):
+ (HTMLAnchorElement::name):
+ (HTMLAnchorElement::setName):
+ (HTMLAnchorElement::rel):
+ (HTMLAnchorElement::setRel):
+ (HTMLAnchorElement::rev):
+ (HTMLAnchorElement::setRev):
+ (HTMLAnchorElement::shape):
+ (HTMLAnchorElement::setShape):
+ (HTMLAnchorElement::tabIndex):
+ (HTMLAnchorElement::setTabIndex):
+ (HTMLAnchorElement::target):
+ (HTMLAnchorElement::setTarget):
+ (HTMLAnchorElement::type):
+ (HTMLAnchorElement::setType):
+ (HTMLAnchorElement::blur):
+ (HTMLAnchorElement::focus):
+ (HTMLBRElement::clear):
+ (HTMLBRElement::setClear):
+ (HTMLFontElement::color):
+ (HTMLFontElement::setColor):
+ (HTMLFontElement::face):
+ (HTMLFontElement::setFace):
+ (HTMLFontElement::size):
+ (HTMLFontElement::setSize):
+ (HTMLModElement::cite):
+ (HTMLModElement::setCite):
+ (HTMLModElement::dateTime):
+ (HTMLModElement::setDateTime):
+ (HTMLQuoteElement::cite):
+ (HTMLQuoteElement::setCite):
+ * khtml/dom/html_misc.cpp:
+ (HTMLCollection::HTMLCollection):
+ (HTMLCollection::base):
+ (HTMLCollection::namedItems):
+ * khtml/dom/html_misc.h:
+ * khtml/editing/htmlediting.cpp:
+ * khtml/editing/selection.cpp:
+ * khtml/html/html_documentimpl.cpp:
+ (DOM::HTMLDocumentImpl::determineParseMode):
+ (DOM::HTMLDocumentImpl::doctype):
+ * khtml/html/html_documentimpl.h:
+ * khtml/html/html_elementimpl.cpp:
+ (HTMLElementImpl::setInnerHTML):
+ (HTMLElementImpl::setOuterHTML):
+ (HTMLElementImpl::setInnerText):
+ (HTMLElementImpl::setOuterText):
+ (HTMLElementImpl::style):
+ (HTMLElementImpl::idDOM):
+ (HTMLElementImpl::setId):
+ (HTMLElementImpl::title):
+ (HTMLElementImpl::setTitle):
+ (HTMLElementImpl::lang):
+ (HTMLElementImpl::setLang):
+ (HTMLElementImpl::dir):
+ (HTMLElementImpl::setDir):
+ (HTMLElementImpl::className):
+ (HTMLElementImpl::setClassName):
+ (HTMLElementImpl::children):
+ (HTMLGenericElementImpl::HTMLGenericElementImpl):
+ (HTMLGenericElementImpl::id):
+ * khtml/html/html_elementimpl.h:
+ (DOM::HTMLElementImpl::isGenericFormElement):
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLFormElementImpl::parseEnctype):
+ (DOM::HTMLFormElementImpl::parseHTMLAttribute):
+ (DOM::HTMLFormElementImpl::elements):
+ (DOM::HTMLFormElementImpl::name):
+ (DOM::HTMLFormElementImpl::setName):
+ (DOM::HTMLFormElementImpl::acceptCharset):
+ (DOM::HTMLFormElementImpl::setAcceptCharset):
+ (DOM::HTMLFormElementImpl::action):
+ (DOM::HTMLFormElementImpl::setAction):
+ (DOM::HTMLFormElementImpl::setEnctype):
+ (DOM::HTMLFormElementImpl::method):
+ (DOM::HTMLFormElementImpl::setMethod):
+ (DOM::HTMLFormElementImpl::target):
+ (DOM::HTMLFormElementImpl::setTarget):
+ (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl):
+ (DOM::HTMLGenericFormElementImpl::~HTMLGenericFormElementImpl):
+ (DOM::HTMLGenericFormElementImpl::parseHTMLAttribute):
+ (DOM::HTMLGenericFormElementImpl::name):
+ (DOM::HTMLGenericFormElementImpl::setName):
+ (DOM::HTMLGenericFormElementImpl::setOverrideName):
+ (DOM::HTMLGenericFormElementImpl::setDisabled):
+ (DOM::HTMLGenericFormElementImpl::setReadOnly):
+ (DOM::HTMLGenericFormElementImpl::tabIndex):
+ (DOM::HTMLGenericFormElementImpl::setTabIndex):
+ (DOM::HTMLButtonElementImpl::accessKey):
+ (DOM::HTMLButtonElementImpl::setAccessKey):
+ (DOM::HTMLButtonElementImpl::value):
+ (DOM::HTMLButtonElementImpl::setValue):
+ (DOM::HTMLInputElementImpl::HTMLInputElementImpl):
+ (DOM::HTMLInputElementImpl::parseHTMLAttribute):
+ (DOM::HTMLInputElementImpl::defaultValue):
+ (DOM::HTMLInputElementImpl::setDefaultValue):
+ (DOM::HTMLInputElementImpl::defaultChecked):
+ (DOM::HTMLInputElementImpl::setDefaultChecked):
+ (DOM::HTMLInputElementImpl::accept):
+ (DOM::HTMLInputElementImpl::setAccept):
+ (DOM::HTMLInputElementImpl::accessKey):
+ (DOM::HTMLInputElementImpl::setAccessKey):
+ (DOM::HTMLInputElementImpl::align):
+ (DOM::HTMLInputElementImpl::setAlign):
+ (DOM::HTMLInputElementImpl::alt):
+ (DOM::HTMLInputElementImpl::setAlt):
+ (DOM::HTMLInputElementImpl::setMaxLength):
+ (DOM::HTMLInputElementImpl::sizeDOM):
+ (DOM::HTMLInputElementImpl::setSize):
+ (DOM::HTMLInputElementImpl::src):
+ (DOM::HTMLInputElementImpl::setSrc):
+ (DOM::HTMLInputElementImpl::useMap):
+ (DOM::HTMLInputElementImpl::setUseMap):
+ (DOM::HTMLLabelElementImpl::form):
+ (DOM::HTMLLabelElementImpl::accessKey):
+ (DOM::HTMLLabelElementImpl::setAccessKey):
+ (DOM::HTMLLabelElementImpl::htmlFor):
+ (DOM::HTMLLabelElementImpl::setHtmlFor):
+ (DOM::HTMLLegendElementImpl::accessKey):
+ (DOM::HTMLLegendElementImpl::setAccessKey):
+ (DOM::HTMLLegendElementImpl::align):
+ (DOM::HTMLLegendElementImpl::setAlign):
+ (DOM::HTMLSelectElementImpl::setValue):
+ (DOM::HTMLSelectElementImpl::optionsHTMLCollection):
+ (DOM::HTMLSelectElementImpl::setMultiple):
+ (DOM::HTMLSelectElementImpl::setSize):
+ (DOM::HTMLOptGroupElementImpl::label):
+ (DOM::HTMLOptGroupElementImpl::setLabel):
+ (DOM::HTMLOptionElementImpl::setText):
+ (DOM::HTMLOptionElementImpl::setIndex):
+ (DOM::HTMLOptionElementImpl::setValue):
+ (DOM::HTMLOptionElementImpl::defaultSelected):
+ (DOM::HTMLOptionElementImpl::setDefaultSelected):
+ (DOM::HTMLOptionElementImpl::label):
+ (DOM::HTMLOptionElementImpl::setLabel):
+ (DOM::HTMLTextAreaElementImpl::accessKey):
+ (DOM::HTMLTextAreaElementImpl::setAccessKey):
+ (DOM::HTMLTextAreaElementImpl::setCols):
+ (DOM::HTMLTextAreaElementImpl::setRows):
+ (DOM::HTMLIsIndexElementImpl::HTMLIsIndexElementImpl):
+ (DOM::HTMLIsIndexElementImpl::parseHTMLAttribute):
+ (DOM::HTMLIsIndexElementImpl::prompt):
+ (DOM::HTMLIsIndexElementImpl::setPrompt):
+ * khtml/html/html_formimpl.h:
+ * khtml/html/html_headimpl.cpp:
+ (HTMLBaseElementImpl::setHref):
+ (HTMLBaseElementImpl::setTarget):
+ (HTMLLinkElementImpl::disabled):
+ (HTMLLinkElementImpl::setDisabled):
+ (HTMLLinkElementImpl::charset):
+ (HTMLLinkElementImpl::setCharset):
+ (HTMLLinkElementImpl::href):
+ (HTMLLinkElementImpl::setHref):
+ (HTMLLinkElementImpl::hreflang):
+ (HTMLLinkElementImpl::setHreflang):
+ (HTMLLinkElementImpl::media):
+ (HTMLLinkElementImpl::setMedia):
+ (HTMLLinkElementImpl::rel):
+ (HTMLLinkElementImpl::setRel):
+ (HTMLLinkElementImpl::rev):
+ (HTMLLinkElementImpl::setRev):
+ (HTMLLinkElementImpl::target):
+ (HTMLLinkElementImpl::setTarget):
+ (HTMLLinkElementImpl::type):
+ (HTMLLinkElementImpl::setType):
+ (HTMLMetaElementImpl::content):
+ (HTMLMetaElementImpl::setContent):
+ (HTMLMetaElementImpl::httpEquiv):
+ (HTMLMetaElementImpl::setHttpEquiv):
+ (HTMLMetaElementImpl::name):
+ (HTMLMetaElementImpl::setName):
+ (HTMLMetaElementImpl::scheme):
+ (HTMLMetaElementImpl::setScheme):
+ (HTMLScriptElementImpl::id):
+ (HTMLScriptElementImpl::isURLAttribute):
+ (HTMLScriptElementImpl::insertedIntoDocument):
+ (HTMLScriptElementImpl::notifyFinished):
+ (HTMLScriptElementImpl::text):
+ (HTMLScriptElementImpl::setText):
+ (HTMLScriptElementImpl::htmlFor):
+ (HTMLScriptElementImpl::setHtmlFor):
+ (HTMLScriptElementImpl::event):
+ (HTMLScriptElementImpl::setEvent):
+ (HTMLScriptElementImpl::charset):
+ (HTMLScriptElementImpl::setCharset):
+ (HTMLScriptElementImpl::defer):
+ (HTMLScriptElementImpl::setDefer):
+ (HTMLScriptElementImpl::src):
+ (HTMLScriptElementImpl::setSrc):
+ (HTMLScriptElementImpl::type):
+ (HTMLScriptElementImpl::setType):
+ (HTMLStyleElementImpl::disabled):
+ (HTMLStyleElementImpl::setDisabled):
+ (HTMLStyleElementImpl::media):
+ (HTMLStyleElementImpl::setMedia):
+ (HTMLStyleElementImpl::type):
+ (HTMLStyleElementImpl::setType):
+ (HTMLTitleElementImpl::insertedIntoDocument):
+ (HTMLTitleElementImpl::childrenChanged):
+ (HTMLTitleElementImpl::text):
+ (HTMLTitleElementImpl::setText):
+ * khtml/html/html_headimpl.h:
+ * khtml/html/html_miscimpl.cpp:
+ (DOM::HTMLBaseFontElementImpl::id):
+ (DOM::HTMLBaseFontElementImpl::color):
+ (DOM::HTMLBaseFontElementImpl::setColor):
+ (DOM::HTMLBaseFontElementImpl::face):
+ (DOM::HTMLBaseFontElementImpl::setFace):
+ (DOM::HTMLBaseFontElementImpl::size):
+ (DOM::HTMLBaseFontElementImpl::setSize):
+ (DOM::HTMLCollectionImpl::HTMLCollectionImpl):
+ (DOM::HTMLCollectionImpl::~HTMLCollectionImpl):
+ (DOM::HTMLCollectionImpl::resetCollectionInfo):
+ (DOM::HTMLCollectionImpl::traverseNextItem):
+ (DOM::HTMLCollectionImpl::calcLength):
+ (DOM::HTMLCollectionImpl::item):
+ (DOM::HTMLCollectionImpl::namedItem):
+ (DOM::HTMLCollectionImpl::updateNameCache):
+ (DOM::HTMLCollectionImpl::namedItems):
+ (DOM::HTMLCollectionImpl::nextNamedItem):
+ (DOM::HTMLFormCollectionImpl::HTMLFormCollectionImpl):
+ (DOM::HTMLFormCollectionImpl::calcLength):
+ (DOM::HTMLFormCollectionImpl::item):
+ (DOM::HTMLFormCollectionImpl::getNamedFormItem):
+ (DOM::HTMLFormCollectionImpl::nextNamedItemInternal):
+ (DOM::HTMLFormCollectionImpl::namedItem):
+ (DOM::HTMLFormCollectionImpl::updateNameCache):
+ * khtml/html/html_miscimpl.h:
+ (DOM::HTMLCollectionImpl::base):
+ * khtml/html/htmlparser.cpp:
+ (KHTMLParser::parseToken):
+ (KHTMLParser::insertNode):
+ * khtml/html/htmltokenizer.cpp:
+ (khtml::HTMLTokenizer::scriptExecution):
+ * khtml/khtml_events.cpp:
+ (khtml::MouseEvent::MouseEvent):
+ (khtml::MouseEvent::offset):
+ * khtml/khtml_events.h:
+ (khtml::MouseEvent::innerNode):
+ (khtml::MousePressEvent::MousePressEvent):
+ (khtml::MouseDoubleClickEvent::MouseDoubleClickEvent):
+ (khtml::MouseMoveEvent::MouseMoveEvent):
+ (khtml::MouseReleaseEvent::MouseReleaseEvent):
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::closeURL):
+ (KHTMLPart::executeScript):
+ (KHTMLPart::scheduleScript):
+ (KHTMLPart::executeScheduledScript):
+ (KHTMLPart::clear):
+ (KHTMLPart::selectClosestWordFromMouseEvent):
+ (KHTMLPart::handleMousePressEventDoubleClick):
+ (KHTMLPart::handleMousePressEventTripleClick):
+ (KHTMLPart::handleMousePressEventSingleClick):
+ (KHTMLPart::khtmlMousePressEvent):
+ (KHTMLPart::handleMouseMoveEventDrag):
+ (KHTMLPart::handleMouseMoveEventOver):
+ (KHTMLPart::handleMouseMoveEventSelection):
+ (KHTMLPart::khtmlMouseReleaseEvent):
+ (KHTMLPart::selectionHasStyle):
+ (KHTMLPart::selectionStartHasStyle):
+ * khtml/khtml_part.h:
+ * khtml/khtmlpart_p.h:
+ * khtml/khtmlview.cpp:
+ (KHTMLViewPrivate::reset):
+ (KHTMLView::viewportMousePressEvent):
+ (KHTMLView::viewportMouseDoubleClickEvent):
+ (KHTMLView::contentsContextMenuEvent):
+ (KHTMLView::updateDragAndDrop):
+ (KHTMLView::cancelDragAndDrop):
+ (KHTMLView::performDragAndDrop):
+ (KHTMLView::focusNextPrevNode):
+ * kwq/DOM-CSS.mm:
+ (-[DOMCSSStyleSheet cssRules]):
+ (-[DOMCSSStyleDeclaration getPropertyValue:]):
+ (-[DOMCSSStyleDeclaration getPropertyCSSValue:]):
+ (-[DOMCSSStyleDeclaration removeProperty:]):
+ (-[DOMCSSStyleDeclaration getPropertyPriority:]):
+ (-[DOMCSSStyleDeclaration setProperty:::]):
+ (-[DOMCSSValue setCssText:]):
+ * kwq/DOMCSS.h:
+ * kwq/DOMHTML.mm:
+ (-[DOMHTMLElement setInnerHTML:]):
+ (-[DOMHTMLElement setOuterHTML:]):
+ (-[DOMHTMLElement setInnerText:]):
+ (-[DOMHTMLElement setOuterText:]):
+ (-[DOMHTMLSelectElement setLength:]):
+ (-[DOMHTMLTableSectionElement insertRow:]):
+ * kwq/DOMInternal.h:
+ * kwq/DOMInternal.mm:
+ (raiseDOMException):
+ (-[WebScriptObject _initializeScriptDOMNodeImp]):
+ * kwq/DOMUtility.mm:
+ (KJS::ScriptInterpreter::createObjcInstanceForValue):
+ * kwq/KWQAccObject.mm:
+ (-[KWQAccObject accessibilityAttributeValue:]):
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::KWQKHTMLPart):
+ (KWQKHTMLPart::advanceToNextMisspelling):
+ (KWQKHTMLPart::scrollOverflow):
+ (KWQKHTMLPart::paint):
+ (KWQKHTMLPart::openURLFromPageCache):
+ (KWQKHTMLPart::khtmlMousePressEvent):
+ (KWQKHTMLPart::passWidgetMouseDownEventToWidget):
+ (KWQKHTMLPart::dispatchDragSrcEvent):
+ (KWQKHTMLPart::eventMayStartDrag):
+ (KWQKHTMLPart::khtmlMouseMoveEvent):
+ (KWQKHTMLPart::dragSourceEndedAt):
+ (KWQKHTMLPart::mouseDown):
+ (KWQKHTMLPart::sendContextMenuEvent):
+ (listParent):
+ (isTextFirstInListItem):
+ (KWQKHTMLPart::attributedString):
+ (KWQKHTMLPart::snapshotDragImage):
+ (KWQKHTMLPart::mousePressNode):
+ * kwq/WebCoreBridge.mm:
+ (updateRenderingForBindings):
+ (-[WebCoreBridge _documentTypeString]):
+
2005-05-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
{
- NodeImpl *node = m_node.handle();
+ NodeImpl *node = m_node.get();
if (!node)
return 0;
virtual DOMString removeProperty(int propertyID, int &exceptionCode);
virtual void setProperty(int propertyId, const DOMString &value, bool important, int &exceptionCode);
- Node m_node;
+ SharedPtr<NodeImpl> m_node;
};
}
return insertRule(selector + " { " + style + " }", index, exceptioncode);
}
-CSSRuleList CSSStyleSheetImpl::cssRules()
+CSSRuleListImpl *CSSStyleSheetImpl::cssRules()
{
- return this;
+ return new CSSRuleListImpl(this);
}
void CSSStyleSheetImpl::deleteRule( unsigned long index, int &exceptioncode )
class CSSStyleSheet;
class MediaListImpl;
class CSSRuleImpl;
-class CSSRuleList;
+class CSSRuleListImpl;
class CSSStyleRuleImpl;
class CSSValueImpl;
class NodeImpl;
virtual DOM::DOMString type() const { return "text/css"; }
CSSRuleImpl *ownerRule() const;
- CSSRuleList cssRules();
+ CSSRuleListImpl *cssRules();
unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index, int &exceptioncode );
void deleteRule ( unsigned long index, int &exceptioncode );
unsigned long addRule ( const DOMString &selector, const DOMString &style, long index, int &exceptioncode );
* Boston, MA 02111-1307, USA.
*/
+#include "css/css_valueimpl.h"
+
#include "dom/css_value.h"
+#include "dom/css_stylesheet.h"
#include "dom/dom_exception.h"
#include "dom/dom_string.h"
-#include "css/css_valueimpl.h"
#include "css/css_ruleimpl.h"
#include "css/css_stylesheetimpl.h"
#include "css/cssparser.h"
namespace DOM {
+// Defined in parser.y, but not in any header, so just declare it here.
+int getPropertyID(const char *str, int len);
+
#if 0
// Too risky to quote all legal identifiers right now.
return true;
}
+CSSValueImpl *CSSStyleDeclarationImpl::getPropertyCSSValue(const DOMString &propertyName)
+{
+ int propID = propertyID(propertyName);
+ if (!propID)
+ return 0;
+ return getPropertyCSSValue(propID);
+}
+
+DOMString CSSStyleDeclarationImpl::getPropertyValue(const DOMString &propertyName)
+{
+ int propID = propertyID(propertyName);
+ if (!propID)
+ return DOMString();
+ return getPropertyValue(propID);
+}
+
+DOMString CSSStyleDeclarationImpl::getPropertyPriority(const DOMString &propertyName)
+{
+ int propID = propertyID(propertyName);
+ if (!propID)
+ return DOMString();
+ return getPropertyPriority(propID) ? "important" : "";
+}
+
+void CSSStyleDeclarationImpl::setProperty(const DOMString &propertyName, const DOMString &value, const DOMString &priority, int &exception)
+{
+ int propID = propertyID(propertyName);
+ if (!propID) // set exception?
+ return;
+ bool important = priority.string().find("important", 0, false) != -1;
+ setProperty(propID, value, important, exception);
+}
+
+DOMString CSSStyleDeclarationImpl::removeProperty(const DOMString &propertyName, int &exception)
+{
+ int propID = propertyID(propertyName);
+ if (!propID)
+ return DOMString();
+ return removeProperty(propID, exception);
+}
+
CSSMutableStyleDeclarationImpl::CSSMutableStyleDeclarationImpl()
: m_node(0)
{
{
CSSValueImpl* value = getPropertyCSSValue( propertyID );
if (value)
- return CSSValue(value).cssText();
+ return value->cssText();
// Shorthand and 4-values properties
switch ( propertyID ) {
m_type = type;
}
-CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(const Counter &c)
+CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(CounterImpl *c)
{
- m_value.counter = c.handle();
+ m_value.counter = c;
if (m_value.counter)
m_value.counter->ref();
m_type = CSSPrimitiveValue::CSS_COUNTER;
return a.m_id == b.m_id && a.m_bImportant == b.m_bImportant && a.m_value == b.m_value;
}
+int CSSStyleDeclarationImpl::propertyID(const DOMString &s, bool *hadPixelOrPosPrefix)
+{
+ QString prop = s.string();
+
+ int i = prop.length();
+ while (--i) {
+ char c = prop[i].latin1();
+ if (!c)
+ return 0; // non-ASCII character
+ if (c >= 'A' && c <= 'Z')
+ prop.insert(i, '-');
+ }
+
+ prop = prop.lower();
+
+ if (hadPixelOrPosPrefix)
+ *hadPixelOrPosPrefix = false;
+
+ if (prop.startsWith("css-")) {
+ prop = prop.mid(4);
+ } else if (prop.startsWith("pixel-")) {
+ prop = prop.mid(6);
+ if (hadPixelOrPosPrefix)
+ *hadPixelOrPosPrefix = true;
+ } else if (prop.startsWith("pos-")) {
+ prop = prop.mid(4);
+ if (hadPixelOrPosPrefix)
+ *hadPixelOrPosPrefix = true;
+ } else if (prop.startsWith("khtml-") || prop.startsWith("apple-") || prop.startsWith("moz-")) {
+ prop.insert(0, '-');
+ }
+
+ return getPropertyID(prop.latin1(), prop.length());
+}
+
}
class CSSMutableStyleDeclarationImpl;
class CounterImpl;
+class DashboardRegionImpl;
+class RectImpl;
extern const int inheritableProperties[];
extern const unsigned numInheritableProperties;
public:
virtual bool isStyleDeclaration();
+ static int propertyID(const DOMString &propertName, bool *hadPixelOrPosPrefix = 0);
+
CSSRuleImpl *parentRule() const;
virtual DOMString cssText() const = 0;
virtual unsigned long length() const = 0;
virtual DOMString item(unsigned long index) const = 0;
+ CSSValueImpl *getPropertyCSSValue(const DOMString &propertyName);
+ DOMString getPropertyValue(const DOMString &propertyName);
+ DOMString getPropertyPriority(const DOMString &propertyName);
virtual CSSValueImpl *getPropertyCSSValue(int propertyID) const = 0;
virtual DOMString getPropertyValue(int propertyID) const = 0;
virtual bool getPropertyPriority(int propertyID) const = 0;
+ void setProperty(const DOMString &propertyName, const DOMString &value, const DOMString &priority, int &exception);
+ DOMString removeProperty(const DOMString &propertyName, int &exception);
virtual void setProperty(int propertyId, const DOMString &value, bool important, int &exceptionCode) = 0;
virtual DOMString removeProperty(int propertyID, int &exceptionCode) = 0;
public:
virtual unsigned short cssValueType() const = 0;
virtual DOMString cssText() const = 0;
+ void setCssText(const DOMString &) { } // FIXME: Not implemented.
virtual bool isValue() { return true; }
virtual bool isFontValue() { return false; }
};
-class Counter;
-class RGBColor;
-class Rect;
-class DashboardRegionImpl;
-
class CSSPrimitiveValueImpl : public CSSValueImpl
{
public:
CSSPrimitiveValueImpl(int ident);
CSSPrimitiveValueImpl(double num, CSSPrimitiveValue::UnitTypes type);
CSSPrimitiveValueImpl(const DOMString &str, CSSPrimitiveValue::UnitTypes type);
- CSSPrimitiveValueImpl(const Counter &c);
+ CSSPrimitiveValueImpl(CounterImpl *c);
CSSPrimitiveValueImpl(RectImpl *r);
CSSPrimitiveValueImpl(DashboardRegionImpl *r);
CSSPrimitiveValueImpl(QRgb color);
return ( m_type != CSSPrimitiveValue::CSS_RGBCOLOR ? 0 : m_value.rgbcolor );
}
-#if APPLE_CHANGES
DashboardRegionImpl *getDashboardRegionValue () const {
return ( m_type != CSSPrimitiveValue::CSS_DASHBOARD_REGION ? 0 : m_value.region );
}
-#endif
virtual bool isPrimitiveValue() const { return true; }
virtual unsigned short cssValueType() const;
if(impl) impl->ref();
}
-CSSRuleList::CSSRuleList(StyleListImpl *lst)
-{
- impl = new CSSRuleListImpl;
- impl->ref();
- if (lst)
- {
- for( unsigned long i = 0; i < lst->length() ; ++i )
- {
- StyleBaseImpl* style = lst->item( i );
- if ( style->isRule() )
- impl->insertRule( static_cast<CSSRuleImpl *>(style), impl->length() );
- }
- }
-}
-
CSSRuleList &CSSRuleList::operator = (const CSSRuleList &other)
{
if ( impl != other.impl ) {
#ifndef _CSS_css_rule_h_
#define _CSS_css_rule_h_
+#if !KHTML_NO_CPLUSPLUS_DOM
+
#include <dom/dom_string.h>
#include <dom/css_stylesheet.h>
#include <dom/css_value.h>
+#endif
+
namespace DOM {
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class CSSRuleImpl;
+#endif
+
/**
* The <code> CSSRule </code> interface is the abstract base interface
* for any type of CSS <a
*/
class CSSRule
{
+
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
CSSRule();
CSSRule(const CSSRule &other);
CSSRule(CSSRuleImpl *impl);
CSSRule & operator = (const CSSRule &other);
~CSSRule();
+
+#endif
+
/**
* An integer indicating which type of rule this is.
*
QUIRKS_RULE = 100 // Not part of the official DOM
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* The type of the rule, as defined above. The expectation is that
* binding-specific casting methods can be used to cast down from
CSSRuleImpl *impl;
void assignOther( const CSSRule &other, RuleType thisType );
+
+#endif
+
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class CSSCharsetRuleImpl;
/**
CSSRuleListImpl *impl;
};
+#endif
-}; // namespace
+} // namespace
#endif
namespace DOM {
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class StyleSheetImpl;
class MediaList;
class NodeImpl;
StyleSheetImpl *impl;
};
+#endif
/**
* This exception is raised when a specific CSS operation is impossible
*/
class CSSException
{
+
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
CSSException(unsigned short _code) { code = _code; }
CSSException(const CSSException &other) { code = other.code; }
*/
unsigned short code;
+#endif
+
enum ExceptionCode
{
SYNTAX_ERR = 0,
INVALID_MODIFICATION_ERR = 1,
- _EXCEPTION_OFFSET = 1000
+ _EXCEPTION_OFFSET = 1000,
+ _EXCEPTION_MAX = 1999
};
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class CSSStyleSheetImpl;
class CSSRule;
class CSSRuleList;
DocumentStyleImpl *impl;
};
+#endif
+
}; // namespace
#endif
DOMString CSSStyleDeclaration::getPropertyValue( const DOMString &propertyName )
{
if(!impl) return DOMString();
- int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
- if (!id) return DOMString();
- return impl->getPropertyValue(id);
+ return impl->getPropertyValue(propertyName);
}
CSSValue CSSStyleDeclaration::getPropertyCSSValue( const DOMString &propertyName )
{
if(!impl) return 0;
- int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
- if (!id) return 0;
- return impl->getPropertyCSSValue(id);
+ return impl->getPropertyCSSValue(propertyName);
}
DOMString CSSStyleDeclaration::removeProperty( const DOMString &property )
{
- int id = getPropertyID(property.string().ascii(), property.length());
- if(!impl || !id) return DOMString();
+ if(!impl) return DOMString();
int exceptionCode = 0;
- DOMString result = impl->removeProperty( id, exceptionCode );
+ DOMString result = impl->removeProperty( property, exceptionCode );
throwException(exceptionCode);
return result;
}
DOMString CSSStyleDeclaration::getPropertyPriority( const DOMString &propertyName )
{
- int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
- if(!impl || !id) return DOMString();
- if (impl->getPropertyPriority(id))
- return DOMString("important");
- return DOMString();
+ if(!impl) return DOMString();
+ return impl->getPropertyPriority(propertyName);
}
void CSSStyleDeclaration::setProperty( const DOMString &propName, const DOMString &value, const DOMString &priority )
{
if(!impl) return;
- int id = getPropertyID(propName.string().lower().ascii(), propName.length());
- if (!id) return;
- bool important = false;
- QString str = priority.string();
- if (str.find("important", 0, false) != -1)
- important = true;
-
int exceptionCode;
- impl->setProperty( id, value, important, exceptionCode );
+ impl->setProperty( propName, value, priority, exceptionCode );
throwException(exceptionCode);
}
class CSSRule;
class CSSValue;
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* The <code> CSSStyleDeclaration </code> interface represents a
* single <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#block">
class CSSValueImpl;
+#endif
+
+
/**
* The <code> CSSValue </code> interface represents a simple or a
* complexe value.
*/
class CSSValue
{
+
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
CSSValue();
CSSValue(const CSSValue &other);
CSSValue(CSSValueImpl *impl);
CSSValue & operator = (const CSSValue &other);
~CSSValue();
+
+#endif
+
/**
* An integer indicating which type of unit applies to the value.
*
CSS_INITIAL = 4
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* A string representation of the current value.
*
protected:
CSSValueImpl *impl;
+
+#endif
+
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class CSSValueListImpl;
class CSSValue;
class RGBColor;
class Rect;
+#endif
+
/**
* The <code> CSSPrimitiveValue </code> interface represents a single
* <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#values"> CSS
*/
class CSSPrimitiveValue : public CSSValue
{
+
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
CSSPrimitiveValue();
CSSPrimitiveValue(const CSSPrimitiveValue &other);
CSSPrimitiveValue(const CSSValue &other);
CSSPrimitiveValue & operator = (const CSSValue &other);
~CSSPrimitiveValue();
+
+#endif
+
/**
* An integer indicating which type of unit applies to the value.
*
CSS_HTML_RELATIVE = 255
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* The type of the value as defined by the constants specified
* above.
*
*/
RGBColor getRGBColorValue ( );
+
+#endif
+
};
+#if !KHTML_NO_CPLUSPLUS_DOM
/**
* The <code> RGBColor </code> interface is used to represent any <a
Counter(CounterImpl *i);
};
+#endif
-}; // namespace
+} // namespace
#endif
{
}
-void EventListener::handleEvent(Event &/*evt*/, bool)
+void EventListener::handleEvent(EventListenerEvent, bool)
{
}
class MutationEventImpl;
class KeyboardEventImpl;
-
+#if KHTML_NO_CPLUSPLUS_DOM
+typedef EventImpl *EventListenerEvent;
+#else
+typedef Event &EventListenerEvent;
+#endif
/**
* Introduced in DOM Level 2
* target (there is no DOM node for the window, so it can't be the target).
*
*/
- virtual void handleEvent(Event &evt, bool isWindowEvent);
+ virtual void handleEvent(EventListenerEvent evt, bool isWindowEvent);
/**
* @internal
*
*/
class Event {
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
friend class Document;
friend class NodeImpl;
friend class DocumentImpl;
+
+#endif
+
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
Event();
Event(const Event &other);
virtual ~Event();
Event & operator = (const Event &other);
+#endif
+
/**
* An integer indicating which phase of event flow is being processed.
*
BUBBLING_PHASE = 3
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* The name of the event (case-insensitive). The name must be an XML name.
*
protected:
EventImpl *impl;
+
+#endif
+
};
class EventException
{
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
EventException(unsigned short _code);
EventException(const EventException &other);
EventException & operator = (const EventException &other);
virtual ~EventException() {}
+#endif
+
/**
* An integer indicating the type of error generated.
*
UNSPECIFIED_EVENT_TYPE_ERR = 0
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
unsigned short code;
+
+#endif
+
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
+
/**
* Introduced in DOM Level 2
*
};
+#endif
+
+
/**
* Introduced in DOM Level 2
*
*/
class MutationEvent : public Event {
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
MutationEvent();
MutationEvent(const MutationEvent &other);
MutationEvent(const Event &other);
MutationEvent & operator = (const Event &other);
virtual ~MutationEvent();
+#endif
+
/**
* An integer indicating in which way the Attr was changed.
*
REMOVAL = 3
};
+#if !KHTML_NO_CPLUSPLUS_DOM
/**
* relatedNode is used to identify a secondary node related to a mutation
unsigned short attrChangeArg);
protected:
MutationEvent(MutationEventImpl *impl);
+
+#endif
+
};
* associated with Keyboard events.
*
*/
-class KeyboardEvent : public UIEvent {
+class KeyboardEvent
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
+ : public UIEvent
+
+#endif
+
+{
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
public:
KeyboardEvent();
KeyboardEvent(const KeyboardEvent &other);
KeyboardEvent & operator = (const Event &other);
virtual ~KeyboardEvent();
+#endif
+
// KeyLocationCode
static const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
static const unsigned long DOM_KEY_LOCATION_LEFT = 0x01;
static const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
static const unsigned long DOM_KEY_LOCATION_UNKNOWN = 0x04;
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* Holds the identifier of the key.
*
protected:
KeyboardEvent(KeyboardEventImpl *impl);
+
+#endif
+
};
}; //namespace
*/
#ifndef _dom2_traversal_h_
#define _dom2_traversal_h_
-#include <dom/dom_node.h>
+
#include <dom/dom_misc.h>
+#if !KHTML_NO_CPLUSPLUS_DOM
+
+#include <dom/dom_node.h>
+
+#endif
namespace DOM {
-class Node;
class NodeImpl;
class NodeFilterImpl;
class NodeIteratorImpl;
class TreeWalkerImpl;
+#if !KHTML_NO_CPLUSPLUS_DOM
+
+typedef const Node &FilterNode;
+
+#else
+
+typedef NodeImpl *FilterNode;
+
+#endif
+
class NodeFilterCondition : public DomShared
{
public:
- virtual short acceptNode(const Node &) const;
+ virtual short acceptNode(FilterNode) const;
};
/**
class NodeFilter
{
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
NodeFilter();
NodeFilter(NodeFilterCondition *);
NodeFilter(NodeFilterImpl *);
NodeFilter &operator=(const NodeFilter &other);
~NodeFilter();
+#endif
+
/**
* The following constants are returned by the acceptNode()
* method:
SHOW_NOTATION = 0x00000800
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* Test whether a specified node is visible in the logical view of
* a TreeWalker or NodeIterator. This function will be called by
private:
NodeFilterImpl *impl;
+
+#endif
+
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* NodeIterators are used to step through a set of nodes, e.g. the set
* of nodes in a NodeList, the document subtree governed by a
friend class NodeIteratorImpl;
friend class Document;
+ NodeIterator(NodeIteratorImpl *);
+
private:
NodeIterator();
- NodeIterator(NodeIteratorImpl *);
NodeIteratorImpl *impl;
};
TreeWalkerImpl *handle() const { return impl; }
bool isNull() const { return impl == 0; }
+ TreeWalker(TreeWalkerImpl *);
+
friend class Document;
friend class TreeWalkerImpl;
private:
TreeWalker();
- TreeWalker(TreeWalkerImpl *);
TreeWalkerImpl *impl;
};
};
*/
+#endif
+
} // namespace
#endif
HTMLDocument DOMImplementation::createHTMLDocument( const DOMString& title )
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
-
- HTMLDocumentImpl* r = impl->createHTMLDocument( 0 /* ### create a view otherwise it doesn't work */);
-
- r->open();
-
- r->write(QString::fromLatin1("<HTML><HEAD><TITLE>") + title.string() +
- QString::fromLatin1("</TITLE></HEAD>"));
-
- return r;
+ return impl->createHTMLDocument(title);
}
DOMImplementation DOMImplementation::getInterface(const DOMString &feature) const
throw DOMException(DOMException::NOT_FOUND_ERR);
int exceptioncode = 0;
- CSSStyleSheetImpl *r = impl->createCSSStyleSheet(title.implementation(), media.implementation(),
- exceptioncode);
+ CSSStyleSheetImpl *r = impl->createCSSStyleSheet(title, media, exceptioncode);
if ( exceptioncode )
throw DOMException( exceptioncode );
return r;
DocumentType Document::doctype() const
{
- if (impl) {
- // Doctype is null for HTML documents.
- if (((DocumentImpl*)impl)->isHTMLDocument())
- return 0;
- else
- return ((DocumentImpl *)impl)->doctype();
- }
+ if (impl) return ((DocumentImpl *)impl)->doctype();
return 0;
}
Attr Document::createAttribute( const DOMString &name )
{
- return createAttributeNS(DOMString(), name);
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ int exception = 0;
+ Attr result = static_cast<DocumentImpl*>(impl)->createAttribute(name, exception);
+ if (exception)
+ throw DOMException(exception);
+ return result;
}
Attr Document::createAttributeNS( const DOMString &namespaceURI, const DOMString &qualifiedName )
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- if (qualifiedName.isNull()) throw DOMException(DOMException::NAMESPACE_ERR);
-
- DOMString localName(qualifiedName.copy());
- DOMString prefix;
- int colonpos;
- if ((colonpos = qualifiedName.find(':')) >= 0) {
- prefix = qualifiedName.copy();
- prefix.truncate(colonpos);
- localName.remove(0, colonpos+1);
- }
-
- if (!DocumentImpl::isValidName(localName)) throw DOMException(DOMException::INVALID_CHARACTER_ERR);
- // ### check correctness of namespace, prefix?
-
- NodeImpl::Id id = static_cast<DocumentImpl*>(impl)->attrId(namespaceURI.implementation(), localName.implementation(), false /* allocate */);
- Attr r = static_cast<DocumentImpl*>(impl)->createAttribute(id);
- int exceptioncode = 0;
- if (r.handle() && prefix.implementation())
- r.handle()->setPrefix(prefix.implementation(), exceptioncode);
- if (exceptioncode)
- throw DOMException(exceptioncode);
- return r;
+ int exception = 0;
+ Attr result = static_cast<DocumentImpl*>(impl)->createAttributeNS(namespaceURI, qualifiedName, exception);
+ if (exception)
+ throw DOMException(exception);
+ return result;
}
EntityReference Document::createEntityReference( const DOMString &name )
bool queryCommandSupported(const DOMString &command);
DOMString queryCommandValue(const DOMString &command);
+ /**
+ * @internal
+ * not part of the DOM
+ */
Document( DocumentImpl *i);
protected:
*/
DOMString internalSubset() const;
-protected:
DocumentType(DocumentTypeImpl *impl);
};
-}; //namespace
+} //namespace
+
#endif
DOMString Attr::name() const
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- return impl->getDocument()->attrName(
- static_cast<AttrImpl*>(impl)->attrImpl()->id());
+ return static_cast<AttrImpl *>(impl)->name();
}
DOMString Attr::value() const
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- return impl->nodeValue();
+ return static_cast<AttrImpl *>(impl)->value();
}
void Attr::setValue( const DOMString &newValue )
DOMString Element::getAttribute( const DOMString &name )
{
- return getAttributeNS(DOMString(), name);
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ return static_cast<ElementImpl*>(impl)->getAttribute(name);
}
void Element::setAttribute( const DOMString &name, const DOMString &value )
{
- setAttributeNS(DOMString(), name, value);
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ int exception = 0;
+ static_cast<ElementImpl*>(impl)->setAttribute(name, value, exception);
+ if (exception)
+ throw DOMException(exception);
}
void Element::removeAttribute( const DOMString &name )
{
- removeAttributeNS(DOMString(), name);
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ int exception = 0;
+ static_cast<ElementImpl*>(impl)->removeAttribute(name, exception);
+ if (exception)
+ throw DOMException(exception);
}
Attr Element::getAttributeNode( const DOMString &name )
{
- return getAttributeNodeNS(DOMString(), name);
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ return static_cast<ElementImpl*>(impl)->getAttributeNode(name);
}
Attr Element::setAttributeNode( const Attr &newAttr )
{
- return setAttributeNodeNS(newAttr);
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ int exception = 0;
+ Attr result = static_cast<ElementImpl*>(impl)->setAttributeNode(static_cast<AttrImpl *>(newAttr.handle()), exception).get();
+ if (exception)
+ throw DOMException(exception);
+ return result;
}
Attr Element::removeAttributeNode( const Attr &oldAttr )
{
- if (!impl)
- throw DOMException(DOMException::NOT_FOUND_ERR);
- int exceptioncode = 0;
- Attr r = static_cast<ElementImpl*>(impl)->removeAttributeNode(static_cast<AttrImpl *>(oldAttr.handle()), exceptioncode).get();
- if ( exceptioncode )
- throw DOMException( exceptioncode );
- return r;
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ int exception = 0;
+ Attr result = static_cast<ElementImpl*>(impl)->removeAttributeNode(static_cast<AttrImpl *>(oldAttr.handle()), exception).get();
+ if (exception)
+ throw DOMException(exception);
+ return result;
}
NodeList Element::getElementsByTagName( const DOMString &name )
{
if (!impl) return 0;
- return static_cast<ElementImpl*>(impl)->getElementsByTagName(name).get();
+ return impl->getElementsByTagName(name).get();
}
NodeList Element::getElementsByTagNameNS( const DOMString &namespaceURI,
const DOMString &localName )
{
if (!impl) return 0;
- return static_cast<ElementImpl*>(impl)->getElementsByTagNameNS(namespaceURI, localName).get();
+ return impl->getElementsByTagNameNS(namespaceURI, localName).get();
}
DOMString Element::getAttributeNS( const DOMString &namespaceURI,
const DOMString &localName)
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- return static_cast<ElementImpl*>(impl)->getAttributeNS(namespaceURI, localName).domString();
+ return static_cast<ElementImpl*>(impl)->getAttributeNS(namespaceURI, localName);
}
void Element::setAttributeNS( const DOMString &namespaceURI,
const DOMString &value)
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
-
- int colonpos = qualifiedName.find(':');
- DOMString localName = qualifiedName;
- if (colonpos >= 0) {
- localName.remove(0, colonpos+1);
- // ### extract and set new prefix
- }
- if (!DocumentImpl::isValidName(localName)) throw DOMException(DOMException::INVALID_CHARACTER_ERR);
- NodeImpl::Id id = impl->getDocument()->attrId(namespaceURI.implementation(),
- localName.implementation(), false /* allocate */);
int exceptioncode = 0;
- static_cast<ElementImpl*>(impl)->setAttribute(id, value.implementation(), exceptioncode);
+ static_cast<ElementImpl*>(impl)->setAttributeNS(namespaceURI, qualifiedName, value, exceptioncode);
if (exceptioncode)
throw DOMException(exceptioncode);
}
const DOMString &localName )
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- NodeImpl::Id id = impl->getDocument()->attrId(namespaceURI.implementation(),
- localName.implementation(), true);
- if (!id) return;
-
int exceptioncode = 0;
- ((ElementImpl *)impl)->removeAttribute(id, exceptioncode);
+ ((ElementImpl *)impl)->removeAttributeNS(namespaceURI, localName, exceptioncode);
if ( exceptioncode )
throw DOMException( exceptioncode );
}
const DOMString &localName )
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- NodeImpl::Id id = impl->getDocument()->attrId(namespaceURI.implementation(),
- localName.implementation(), true);
- if (!id) return 0;
-
- ElementImpl* e = static_cast<ElementImpl*>(impl);
- if (!e->attributes()) return 0; // exception ?
-
- return e->attributes()->getNamedItem(id);
+ return static_cast<ElementImpl *>(impl)->getAttributeNodeNS(namespaceURI, localName);
}
Attr Element::setAttributeNodeNS( const Attr &newAttr )
{
- if (!impl)
- throw DOMException(DOMException::NOT_FOUND_ERR);
-
- int exceptioncode = 0;
- Attr r = static_cast<ElementImpl*>(impl)->setAttributeNodeNS(static_cast<AttrImpl *>(newAttr.handle()), exceptioncode).get();
- if ( exceptioncode )
- throw DOMException( exceptioncode );
- return r;
+ if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
+ int exception = 0;
+ Attr result = static_cast<ElementImpl*>(impl)->setAttributeNodeNS(static_cast<AttrImpl *>(newAttr.handle()), exception).get();
+ if (exception)
+ throw DOMException(exception);
+ return result;
}
-
bool Element::hasAttribute( const DOMString& name )
{
- return hasAttributeNS(DOMString(), name);
+ if (!impl) return false; // ### throw ?
+ return static_cast<ElementImpl*>(impl)->hasAttribute(name);
}
bool Element::hasAttributeNS( const DOMString &namespaceURI,
const DOMString &localName )
{
- if (!impl || !static_cast<ElementImpl*>(impl)->attributes()) return false; // ### throw ?
- NodeImpl::Id id = impl->getDocument()->attrId(namespaceURI.implementation(),
- localName.implementation(), true);
- if (!id) return false;
-
- if (!static_cast<ElementImpl*>(impl)->attributes(true /*readonly*/)) return false;
- return static_cast<ElementImpl*>(impl)->attributes(true)->getAttributeItem(id) != 0;
+ if (!impl) return false; // ### throw ?
+ return static_cast<ElementImpl*>(impl)->hasAttributeNS(namespaceURI, localName);
}
bool Element::isHTMLElement() const
return ((ElementImpl *)impl)->isHTMLElement();
}
-// FIXME: This should move down to HTMLElement.
CSSStyleDeclaration Element::style()
{
- if (isHTMLElement())
- return ((HTMLElementImpl *)impl)->getInlineStyleDecl();
+ if (impl) return ((ElementImpl *)impl)->style();
return 0;
}
namespace DOM {
-
/**
* DOM operations only raise exceptions in "exceptional"
* circumstances, i.e., when an operation is impossible to perform
class DOMException
{
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
DOMException(unsigned short _code) { code = _code; }
DOMException(const DOMException &other) { code = other.code; }
{ code = other.code; return *this; }
virtual ~DOMException() {}
+
+#endif
+
/**
* An integer indicating the type of error generated.
*
NAMESPACE_ERR = 14,
INVALID_ACCESS_ERR = 15
};
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
unsigned short code;
+
+#endif
+
};
-}; //namespace
+} //namespace
+
#endif
*/
#include "dom_misc.h"
-using namespace DOM;
+
+namespace DOM {
DomShared::~DomShared()
{
// deliberately left blank
}
+#if !KHTML_NO_CPLUSPLUS_DOM
bool DomShared::deleteMe()
{
- return !_ref;
+ return true;
}
+#endif
+}
DomShared() : _ref( 0 ) {}
virtual ~DomShared();
+#if KHTML_NO_CPLUSPLUS_DOM
+ bool deleteMe() { return true; }
+#else
/* Overload this function if you want a different deletion behaviour
*/
virtual bool deleteMe();
+#endif
void ref() { _ref++; }
void deref() { if(_ref) _ref--; if(!_ref && deleteMe()) delete this; }
Node NamedNodeMap::getNamedItemNS( const DOMString &namespaceURI, const DOMString &localName ) const
{
if (!impl) return 0;
- return impl->getNamedItem(impl->mapId(namespaceURI, localName, true));
+ return impl->getNamedItemNS(namespaceURI, localName);
}
Node NamedNodeMap::setNamedItemNS( const Node &arg )
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
int exceptioncode = 0;
- Node r = impl->setNamedItem(arg.impl, exceptioncode).get();
+ Node r = impl->setNamedItemNS(arg.impl, exceptioncode).get();
if (exceptioncode)
throw DOMException(exceptioncode);
return r;
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
int exceptioncode = 0;
- Node r = impl->removeNamedItem(impl->mapId(namespaceURI, localName, true), exceptioncode).get();
+ Node r = impl->removeNamedItemNS(namespaceURI, localName, exceptioncode).get();
if (exceptioncode)
throw DOMException(exceptioncode);
return r;
Document Node::ownerDocument() const
{
- // braindead DOM spec says that ownerDocument
- // should return null if called on the document node
- // we don't do that in the *impl tree to avoid excessive if()'s
- // so we simply hack it here in one central place.
- if (!impl || impl->getDocument() == impl) return Document(false);
-
- return impl->getDocument();
+ if (!impl) return Document();
+ return impl->ownerDocument();
}
Node Node::insertBefore( const Node &newChild, const Node &refChild )
bool Node::hasAttributes()
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- if (!impl->isElementNode()) return false;
- ElementImpl* e = static_cast<ElementImpl*>(impl);
- return e->attributes(true) && e->attributes(true)->length();
+ return impl->hasAttributes();
}
bool Node::hasChildNodes( )
bool Node::isSupported( const DOMString &feature, const DOMString &version ) const
{
- return DOMImplementationImpl::instance()->hasFeature(feature, version);
+ if (!impl) return false;
+ return impl->isSupported(feature, version);
}
DOMString Node::namespaceURI( ) const
const bool useCapture)
{
if (!impl) return;
- impl->addEventListener(EventImpl::typeToId(type),listener,useCapture);
+ impl->addEventListener(type,listener,useCapture);
}
void Node::removeEventListener(const DOMString &type,
bool useCapture)
{
if (!impl) return;
- impl->removeEventListener(EventImpl::typeToId(type),listener,useCapture);
+ impl->removeEventListener(type,listener,useCapture);
}
bool Node::dispatchEvent(const Event &evt)
namespace DOM {
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class Node;
class DOMString;
class NodeImpl;
friend class Node;
friend class DocumentType;
friend class NodeImpl;
-#if APPLE_CHANGES
- friend class NamedNodeMapImpl;
-#endif
};
class NamedNodeMap;
class NodeImpl;
+#endif
+
/**
* The <code> Node </code> interface is the primary datatype for the
* entire Document Object Model. It represents a single node in the
*/
class Node
{
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
friend class NamedNodeMap;
friend class NodeList;
friend class HTMLCollection;
friend class StyleSheet;
+#endif
+
public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
Node();
Node(const Node &other);
bool operator != (const Node &other);
virtual ~Node();
+
+#endif
+
/**
* An integer indicating which type of node this is.
*
NOTATION_NODE = 12
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* The name of this node, depending on its type; see the table
* above.
*/
void addEventListener(const DOMString &type,
EventListener *listener,
- const bool useCapture);
+ bool useCapture);
/**
* Introduced in DOM Level 2
protected:
NodeImpl *impl;
+
+#endif
+
};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
class NodeListImpl;
/**
NodeListImpl *handle() const;
bool isNull() const;
+ NodeList(const NodeListImpl *i);
protected:
- NodeList(const NodeListImpl *i);
NodeListImpl *impl;
};
-
+#endif
/**
* A DOMTimeStamp represents a number of milliseconds.
*/
typedef unsigned long long DOMTimeStamp;
+} //namespace
-}; //namespace
#endif
void HTMLDocument::setTitle( const DOMString &v )
{
-#if APPLE_CHANGES
if (!impl) return;
((HTMLDocumentImpl *)impl)->setTitle(v);
-#else
- // ###
-#endif
}
DOMString HTMLDocument::referrer() const
DOMString HTMLDocument::completeURL(const DOMString& str) const
{
if(!impl) return str;
- return ((HTMLDocumentImpl *)impl)->completeURL(str.string());
+ return ((HTMLDocumentImpl *)impl)->completeURL(str);
}
DOMString HTMLDocument::domain() const
}
-#if APPLE_CHANGES
-
void HTMLDocument::setPolicyBaseURL( const DOMString &s )
{
if (impl)
((HTMLDocumentImpl *)impl)->setPolicyBaseURL(s);
}
-#endif
-
void HTMLDocument::open( )
{
if(impl)
NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
{
if(!impl) return 0;
- return new NameNodeListImpl(impl, elementName);
+ return static_cast<HTMLDocumentImpl *>(impl)->getElementsByName(elementName).get();
}
void HTMLElement::setInnerHTML( const DOMString &html )
{
- bool ok = false;
+ int exception = 0;
if( impl )
- ok = ((HTMLElementImpl *)impl)->setInnerHTML( html );
- if ( !ok )
- throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
+ ((HTMLElementImpl *)impl)->setInnerHTML( html, exception );
+ if ( exception )
+ throw DOMException(exception);
}
DOMString HTMLElement::innerText() const
void HTMLElement::setInnerText( const DOMString &text )
{
- bool ok = false;
+ int exception = 0;
if( impl )
- ok = ((HTMLElementImpl *)impl)->setInnerText( text );
- if ( !ok )
- throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
+ ((HTMLElementImpl *)impl)->setInnerText( text, exception );
+ if ( exception )
+ throw DOMException(exception);
}
DOMString HTMLElement::outerHTML() const
void HTMLElement::setOuterHTML( const DOMString &html )
{
- bool ok = false;
+ int exception = 0;
if( impl )
- ok = ((HTMLElementImpl *)impl)->setOuterHTML( html );
- if ( !ok )
- throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
+ ((HTMLElementImpl *)impl)->setOuterHTML( html, exception );
+ if ( exception )
+ throw DOMException(exception);
}
DOMString HTMLElement::outerText() const
void HTMLElement::setOuterText( const DOMString &text )
{
- bool ok = false;
+ int exception = 0;
if( impl )
- ok = ((HTMLElementImpl *)impl)->setOuterText( text );
- if ( !ok )
- throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
+ ((HTMLElementImpl *)impl)->setOuterText( text, exception );
+ if ( exception )
+ throw DOMException(exception);
}
HTMLCollection HTMLElement::children() const
HTMLFormElement HTMLLabelElement::form() const
{
if(!impl) return 0;
- ElementImpl *formElement = ((HTMLLabelElementImpl *)impl)->formElement();
- if (!formElement)
- return 0;
- return ((HTMLGenericFormElementImpl *)formElement)->form();
+ return static_cast<HTMLLabelElementImpl*>(impl)->form();
}
DOMString HTMLLabelElement::accessKey() const
void HTMLSelectElement::setValue( const DOMString &value )
{
- if(!impl || value.isNull()) return;
- static_cast<HTMLSelectElementImpl*>(impl)->setValue(value.implementation());
+ if(!impl) return;
+ static_cast<HTMLSelectElementImpl*>(impl)->setValue(value);
}
long HTMLSelectElement::length() const
HTMLCollection HTMLSelectElement::options() const
{
if(!impl) return HTMLCollection();
- return HTMLCollection(impl, HTMLCollectionImpl::SELECT_OPTIONS);
+ return HTMLCollection(static_cast<HTMLSelectElementImpl *>(impl)->optionsHTMLCollection().get());
}
bool HTMLSelectElement::disabled() const
void HTMLOptionElement::setValue( const DOMString &value )
{
- if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setValue(value.implementation());
+ if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setValue(value);
}
// -----------------------------------------------------------------------------
DOMString HTMLAnchorElement::accessKey() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->accessKey();
}
void HTMLAnchorElement::setAccessKey( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setAccessKey(value);
}
DOMString HTMLAnchorElement::charset() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_CHARSET);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->charset();
}
void HTMLAnchorElement::setCharset( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CHARSET, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setCharset(value);
}
DOMString HTMLAnchorElement::coords() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_COORDS);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->coords();
}
void HTMLAnchorElement::setCoords( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COORDS, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setCoords(value);
}
DOMString HTMLAnchorElement::href() const
{
if(!impl) return DOMString();
- DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_HREF);
- if (!s.isNull())
- s = ownerDocument().completeURL( s );
- return s;
+ return static_cast<HTMLAnchorElementImpl *>(impl)->href();
}
void HTMLAnchorElement::setHref( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setHref(value);
}
DOMString HTMLAnchorElement::hreflang() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_HREFLANG);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->hreflang();
}
void HTMLAnchorElement::setHreflang( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREFLANG, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setHreflang(value);
}
DOMString HTMLAnchorElement::name() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->name();
}
void HTMLAnchorElement::setName( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setName(value);
}
DOMString HTMLAnchorElement::rel() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_REL);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->rel();
}
void HTMLAnchorElement::setRel( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_REL, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setRel(value);
}
DOMString HTMLAnchorElement::rev() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_REV);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->rev();
}
void HTMLAnchorElement::setRev( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_REV, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setRev(value);
}
DOMString HTMLAnchorElement::shape() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->shape();
}
void HTMLAnchorElement::setShape( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setShape(value);
}
long HTMLAnchorElement::tabIndex() const
{
if(!impl) return 0;
- return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt();
+ return static_cast<HTMLAnchorElementImpl *>(impl)->tabIndex();
}
void HTMLAnchorElement::setTabIndex( long _tabIndex )
{
- if(impl) {
- DOMString value(QString::number(_tabIndex));
- ((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value);
- }
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setTabIndex(_tabIndex);
}
DOMString HTMLAnchorElement::target() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->target();
}
void HTMLAnchorElement::setTarget( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setTarget(value);
}
DOMString HTMLAnchorElement::type() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_TYPE);
+ return static_cast<HTMLAnchorElementImpl *>(impl)->type();
}
void HTMLAnchorElement::setType( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TYPE, value);
+ if(impl) static_cast<HTMLAnchorElementImpl *>(impl)->setType(value);
}
void HTMLAnchorElement::blur( )
{
- if(impl && impl->getDocument()->focusNode()==impl)
- impl->getDocument()->setFocusNode(0);
+ if (impl) static_cast<HTMLAnchorElementImpl *>(impl)->blur();
}
void HTMLAnchorElement::focus( )
{
- if(impl)
- impl->getDocument()->setFocusNode(static_cast<ElementImpl*>(impl));
+ if (impl) static_cast<HTMLAnchorElementImpl *>(impl)->focus();
}
// --------------------------------------------------------------------------
DOMString HTMLBRElement::clear() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_CLEAR);
+ return static_cast<HTMLBRElementImpl *>(impl)->clear();
}
void HTMLBRElement::setClear( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CLEAR, value);
+ if(impl) static_cast<HTMLBRElementImpl *>(impl)->setClear(value);
}
// --------------------------------------------------------------------------
DOMString HTMLFontElement::color() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_COLOR);
+ return static_cast<HTMLFontElementImpl *>(impl)->color();
}
void HTMLFontElement::setColor( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COLOR, value);
+ if(impl) static_cast<HTMLFontElementImpl *>(impl)->setColor(value);
}
DOMString HTMLFontElement::face() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_FACE);
+ return static_cast<HTMLFontElementImpl *>(impl)->face();
}
void HTMLFontElement::setFace( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_FACE, value);
+ if(impl) static_cast<HTMLFontElementImpl *>(impl)->setFace(value);
}
DOMString HTMLFontElement::size() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE);
+ return static_cast<HTMLFontElementImpl *>(impl)->size();
}
void HTMLFontElement::setSize( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
+ if(impl) static_cast<HTMLFontElementImpl *>(impl)->setSize(value);
}
DOMString HTMLModElement::cite() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_CITE);
+ return static_cast<HTMLModElementImpl *>(impl)->cite();
}
void HTMLModElement::setCite( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CITE, value);
+ if(impl) static_cast<HTMLModElementImpl *>(impl)->setCite(value);
}
DOMString HTMLModElement::dateTime() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_DATETIME);
+ return static_cast<HTMLModElementImpl *>(impl)->dateTime();
}
void HTMLModElement::setDateTime( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_DATETIME, value);
+ if(impl) static_cast<HTMLModElementImpl *>(impl)->setDateTime(value);
}
// --------------------------------------------------------------------------
DOMString HTMLQuoteElement::cite() const
{
if(!impl) return DOMString();
- return ((ElementImpl *)impl)->getAttribute(ATTR_CITE);
+ return static_cast<HTMLQuoteElementImpl *>(impl)->cite();
}
void HTMLQuoteElement::setCite( const DOMString &value )
{
- if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CITE, value);
+ if(impl) static_cast<HTMLQuoteElementImpl *>(impl)->setCite(value);
}
-
impl->ref();
}
+HTMLCollection::HTMLCollection(HTMLCollectionImpl *other)
+{
+ impl = other;
+ if (other)
+ impl->ref();
+}
+
HTMLCollection &HTMLCollection::operator = (const HTMLCollection &other)
{
if(impl != other.impl) {
if ( !impl )
return 0;
- return static_cast<HTMLCollectionImpl*>( impl )->base;
+ return static_cast<HTMLCollectionImpl*>( impl )->base();
}
Node HTMLCollection::firstItem() const
if ( !impl )
return QValueList<Node>();
- return static_cast<HTMLCollectionImpl*>( impl )->namedItems( name );
+ QValueList< SharedPtr<NodeImpl> > list = static_cast<HTMLCollectionImpl*>( impl )->namedItems( name );
+
+ QValueList<Node> copiedList;
+
+ QValueListConstIterator< SharedPtr<NodeImpl> > end = list.end();
+ for (QValueListConstIterator< SharedPtr<NodeImpl> > it = list.begin(); it != end; ++it)
+ copiedList.append((*it).get());
+
+ return copiedList;
}
HTMLCollection();
HTMLCollection(const HTMLCollection &other);
HTMLCollection(NodeImpl *base, int type);
+ HTMLCollection(HTMLCollectionImpl *imp);
public:
using DOM::DOMString;
using DOM::ElementImpl;
-using DOM::Node;
using DOM::NodeImpl;
using DOM::Position;
using DOM::Range;
using DOM::HTMLElementImpl;
using DOM::HTMLImageElementImpl;
using DOM::NamedAttrMapImpl;
-using DOM::Node;
using DOM::NodeImpl;
using DOM::NodeListImpl;
using DOM::Position;
using DOM::DOMString;
using DOM::ElementImpl;
-using DOM::Node;
using DOM::NodeImpl;
using DOM::Position;
using DOM::Range;
#include "doctypes.cpp"
#undef __inline
-
template class QPtrStack<DOM::NodeImpl>;
-using namespace DOM;
using namespace khtml;
+namespace DOM {
HTMLDocumentImpl::HTMLDocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
: DocumentImpl(_implementation, v)
}
+DocumentTypeImpl *HTMLDocumentImpl::doctype() const
+{
+ // According to a comment in dom_doc.cpp, doctype is null for HTML documents.
+ return 0;
+}
+
+}
+
#include "html_documentimpl.moc"
HTMLCollectionImpl::CollectionInfo *collectionInfo(int type) { return m_collection_info+type; }
+ virtual DocumentTypeImpl *doctype() const;
+
protected:
HTMLElementImpl *bodyElement;
HTMLElementImpl *htmlElement;
#include "khtmlview.h"
#include "khtml_part.h"
+#include "dom/dom_exception.h"
#include "rendering/render_object.h"
#include "rendering/render_replaced.h"
#include "css/css_valueimpl.h"
return fragment;
}
-bool HTMLElementImpl::setInnerHTML( const DOMString &html )
+void HTMLElementImpl::setInnerHTML(const DOMString &html, int &exception)
{
DocumentFragmentImpl *fragment = createContextualFragment( html );
if (fragment == NULL) {
- return false;
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
}
removeChildren();
- int ec = 0;
- appendChild( fragment, ec );
- return !ec;
+ appendChild(fragment, exception);
}
-bool HTMLElementImpl::setOuterHTML( const DOMString &html )
+void HTMLElementImpl::setOuterHTML(const DOMString &html, int &exception)
{
NodeImpl *p = parent();
- if (!p || !p->isHTMLElement())
- return false;
+ if (!p || !p->isHTMLElement()) {
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
+ }
HTMLElementImpl *parent = static_cast<HTMLElementImpl *>(p);
DocumentFragmentImpl *fragment = parent->createContextualFragment( html );
- if (fragment == NULL) {
- return false;
+ if (!fragment) {
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
}
- int ec = 0;
-
if (parentNode()) {
- parentNode()->replaceChild(fragment, this, ec);
+ parentNode()->replaceChild(fragment, this, exception);
}
-
- return !ec;
}
-bool HTMLElementImpl::setInnerText( const DOMString &text )
+void HTMLElementImpl::setInnerText(const DOMString &text, int &exception)
{
// following the IE specs.
- if( endTagRequirement(id()) == FORBIDDEN )
- return false;
+ if (endTagRequirement(id()) == FORBIDDEN) {
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
+ }
+
// IE disallows innerText on inline elements. I don't see why we should have this restriction, as our
// dhtml engine can cope with it. Lars
//if ( isInline() ) return false;
case ID_TFOOT:
case ID_THEAD:
case ID_TR:
- return false;
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
default:
break;
}
removeChildren();
-
- TextImpl *t = new TextImpl( docPtr(), text );
- int ec = 0;
- appendChild( t, ec );
- if ( !ec )
- return true;
- return false;
+ appendChild(new TextImpl(docPtr(), text), exception);
}
-bool HTMLElementImpl::setOuterText( const DOMString &text )
+void HTMLElementImpl::setOuterText(const DOMString &text, int &exception)
{
// following the IE specs.
- if( endTagRequirement(id()) == FORBIDDEN )
- return false;
+ if( endTagRequirement(id()) == FORBIDDEN ) {
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
+ }
switch( id() ) {
case ID_COL:
case ID_COLGROUP:
case ID_TFOOT:
case ID_THEAD:
case ID_TR:
- return false;
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
default:
break;
}
NodeImpl *parent = parentNode();
if (!parent) {
- return false;
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
}
- TextImpl *t = new TextImpl( docPtr(), text );
- int ec = 0;
- parent->replaceChild(t, this, ec);
-
- if ( ec )
- return false;
+ TextImpl *t = new TextImpl(docPtr(), text);
+ parent->replaceChild(t, this, exception);
+ if (exception)
+ return;
// is previous node a text node? if so, merge into it
NodeImpl *prev = t->previousSibling();
if (prev && prev->isTextNode()) {
TextImpl *textPrev = static_cast<TextImpl *>(prev);
- textPrev->appendData(t->data(), ec);
- t->parentNode()->removeChild(t, ec);
+ textPrev->appendData(t->data(), exception);
+ if (exception)
+ return;
+ t->parentNode()->removeChild(t, exception);
+ if (exception)
+ return;
t = textPrev;
}
- if ( ec )
- return false;
-
// is next node a text node? if so, merge it in
NodeImpl *next = t->nextSibling();
if (next && next->isTextNode()) {
TextImpl *textNext = static_cast<TextImpl *>(next);
- t->appendData(textNext->data(), ec);
- textNext->parentNode()->removeChild(textNext, ec);
+ t->appendData(textNext->data(), exception);
+ if (exception)
+ return;
+ textNext->parentNode()->removeChild(textNext, exception);
+ if (exception)
+ return;
}
-
- if ( ec )
- return false;
-
- return true;
}
return ElementImpl::toString();
}
+CSSStyleDeclarationImpl *HTMLElementImpl::style()
+{
+ return getInlineStyleDecl();
+}
+
+DOMString HTMLElementImpl::idDOM() const
+{
+ return getAttribute(ATTR_ID);
+}
+
+void HTMLElementImpl::setId(const DOMString &value)
+{
+ setAttribute(ATTR_ID, value);
+}
+
+DOMString HTMLElementImpl::title() const
+{
+ return getAttribute(ATTR_TITLE);
+}
+
+void HTMLElementImpl::setTitle(const DOMString &value)
+{
+ setAttribute(ATTR_TITLE, value);
+}
+
+DOMString HTMLElementImpl::lang() const
+{
+ return getAttribute(ATTR_LANG);
+}
+
+void HTMLElementImpl::setLang(const DOMString &value)
+{
+ setAttribute(ATTR_LANG, value);
+}
+
+DOMString HTMLElementImpl::dir() const
+{
+ return getAttribute(ATTR_DIR);
+}
+
+void HTMLElementImpl::setDir(const DOMString &value)
+{
+ setAttribute(ATTR_DIR, value);
+}
+
+DOMString HTMLElementImpl::className() const
+{
+ return getAttribute(ATTR_CLASS);
+}
+
+void HTMLElementImpl::setClassName(const DOMString &value)
+{
+ setAttribute(ATTR_CLASS, value);
+}
+
+SharedPtr<HTMLCollectionImpl> HTMLElementImpl::children()
+{
+ return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::NODE_CHILDREN));
+}
+
// -------------------------------------------------------------------------
+
HTMLGenericElementImpl::HTMLGenericElementImpl(DocumentPtr *doc, ushort i)
: HTMLElementImpl(doc)
{
- _id = i;
+ m_elementId = i;
}
-HTMLGenericElementImpl::~HTMLGenericElementImpl()
+NodeImpl::Id HTMLGenericElementImpl::id() const
{
+ return m_elementId;
}
-
namespace DOM {
-class DOMString;
-class HTMLFormElementImpl;
class DocumentFragmentImpl;
+class DOMString;
+class HTMLCollectionImpl;
enum MappedAttributeEntry { eNone, eUniversal, ePersistent, eReplaced, eBlock, eHR, eUnorderedList, eListItem,
eTable, eCell, eCaption, eLastEntry };
void addHTMLColor(HTMLAttributeImpl* attr, int id, const DOMString &c);
void createMappedDecl(HTMLAttributeImpl* attr);
+ SharedPtr<HTMLCollectionImpl> children();
+
+ DOMString idDOM() const; // rename to id after eliminating NodeImpl::id some day
+ void setId(const DOMString &value);
+ DOMString title() const;
+ void setTitle(const DOMString &value);
+ DOMString lang() const;
+ void setLang(const DOMString &value);
+ DOMString dir() const;
+ void setDir(const DOMString &value);
+ DOMString className() const;
+ void setClassName(const DOMString &value);
+
DOMString innerHTML() const;
DOMString outerHTML() const;
DOMString innerText() const;
DOMString outerText() const;
DocumentFragmentImpl *createContextualFragment(const DOMString &html);
- bool setInnerHTML( const DOMString &html );
- bool setOuterHTML( const DOMString &html );
- bool setInnerText( const DOMString &text );
- bool setOuterText( const DOMString &text );
+ void setInnerHTML(const DOMString &html, int &exception);
+ void setOuterHTML(const DOMString &html, int &exception);
+ void setInnerText(const DOMString &text, int &exception);
+ void setOuterText(const DOMString &text, int &exception);
virtual DOMString namespaceURI() const;
virtual AttributeImpl* createAttribute(NodeImpl::Id id, DOMStringImpl* value);
-#if APPLE_CHANGES
virtual bool isGenericFormElement() const { return false; }
-#endif
virtual DOMString toString() const;
void invalidateStyleAttribute();
virtual void updateStyleAttributeIfNeeded() const;
+ virtual CSSStyleDeclarationImpl *style();
+
protected:
// for IMG, OBJECT and APPLET
class HTMLGenericElementImpl : public HTMLElementImpl
{
public:
- HTMLGenericElementImpl(DocumentPtr *doc, ushort i);
-
- virtual ~HTMLGenericElementImpl();
-
- virtual Id id() const { return _id; };
+ HTMLGenericElementImpl(DocumentPtr *doc, ushort elementId);
+ virtual Id id() const;
protected:
- ushort _id;
+ ushort m_elementId;
};
-}; //namespace
+} //namespace
#endif
#include "misc/htmlhashes.h"
#include "misc/formdata.h"
+#include "dom/dom_exception.h"
#include "css/cssstyleselector.h"
#include "css/cssproperties.h"
#include "css/csshelper.h"
return true;
}
-void HTMLFormElementImpl::setEnctype( const DOMString& type )
+void HTMLFormElementImpl::parseEnctype( const DOMString& type )
{
if(type.string().find("multipart", 0, false) != -1 || type.string().find("form-data", 0, false) != -1)
{
m_post = false;
break;
case ATTR_ENCTYPE:
- setEnctype( attr->value() );
+ parseEnctype(attr->value());
break;
case ATTR_ACCEPT_CHARSET:
// space separated list of charsets the server
removeFromVector(imgElements, e);
}
+SharedPtr<HTMLCollectionImpl> HTMLFormElementImpl::elements()
+{
+ return SharedPtr<HTMLCollectionImpl>(new HTMLFormCollectionImpl(this));
+}
+
+DOMString HTMLFormElementImpl::name() const
+{
+ return getAttribute(ATTR_NAME);
+}
+
+void HTMLFormElementImpl::setName(const DOMString &value)
+{
+ setAttribute(ATTR_NAME, value);
+}
+
+DOMString HTMLFormElementImpl::acceptCharset() const
+{
+ return getAttribute(ATTR_ACCEPT_CHARSET);
+}
+
+void HTMLFormElementImpl::setAcceptCharset(const DOMString &value)
+{
+ setAttribute(ATTR_ACCEPT_CHARSET, value);
+}
+
+DOMString HTMLFormElementImpl::action() const
+{
+ return getAttribute(ATTR_ACTION);
+}
+
+void HTMLFormElementImpl::setAction(const DOMString &value)
+{
+ setAttribute(ATTR_ACTION, value);
+}
+
+void HTMLFormElementImpl::setEnctype(const DOMString &value)
+{
+ setAttribute(ATTR_ENCTYPE, value);
+}
+
+DOMString HTMLFormElementImpl::method() const
+{
+ return getAttribute(ATTR_METHOD);
+}
+
+void HTMLFormElementImpl::setMethod(const DOMString &value)
+{
+ setAttribute(ATTR_METHOD, value);
+}
+
+DOMString HTMLFormElementImpl::target() const
+{
+ return getAttribute(ATTR_TARGET);
+}
+
+void HTMLFormElementImpl::setTarget(const DOMString &value)
+{
+ setAttribute(ATTR_TARGET, value);
+}
+
// -------------------------------------------------------------------------
HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
: HTMLElementImpl(doc)
{
m_disabled = m_readOnly = false;
- m_name = 0;
m_dormant = false;
if (f)
{
if (m_form)
m_form->removeFormElement(this);
- if (m_name) m_name->deref();
}
void HTMLGenericFormElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
{
case ATTR_NAME:
break;
- case ATTR_DISABLED:
- setDisabled( !attr->isNull() );
+ case ATTR_DISABLED: {
+ bool oldDisabled = m_disabled;
+ m_disabled = !attr->isNull();
+ if (oldDisabled != m_disabled)
+ setChanged();
break;
- case ATTR_READONLY:
- {
- bool m_oldreadOnly = m_readOnly;
+ }
+ case ATTR_READONLY: {
+ bool oldReadOnly = m_readOnly;
m_readOnly = !attr->isNull();
- if (m_oldreadOnly != m_readOnly) setChanged();
+ if (oldReadOnly != m_readOnly) setChanged();
break;
}
default:
DOMString HTMLGenericFormElementImpl::name() const
{
- if (m_name) return m_name;
+ if (!m_overrideName.isNull())
+ return m_overrideName;
-// ###
-// DOMString n = getDocument()->htmlMode() != DocumentImpl::XHtml ?
-// getAttribute(ATTR_NAME) : getAttribute(ATTR_ID);
DOMString n = getAttribute(ATTR_NAME);
- if (n.isNull())
- return new DOMStringImpl("");
+ return n.isNull() ? "" : n;
+}
- return n;
+void HTMLGenericFormElementImpl::setName(const DOMString &value)
+{
+ setAttribute(ATTR_NAME, value);
}
-void HTMLGenericFormElementImpl::setName(const DOMString& name)
+void HTMLGenericFormElementImpl::setOverrideName(const DOMString& value)
{
- if (m_name) m_name->deref();
- m_name = name.implementation();
- if (m_name) m_name->ref();
+ m_overrideName = value;
}
void HTMLGenericFormElementImpl::onSelect()
return m_disabled;
}
-void HTMLGenericFormElementImpl::setDisabled( bool _disabled )
+void HTMLGenericFormElementImpl::setDisabled(bool b)
{
- if ( m_disabled != _disabled ) {
- m_disabled = _disabled;
- setChanged();
- }
+ setAttribute(ATTR_DISABLED, b ? "" : 0);
+}
+
+void HTMLGenericFormElementImpl::setReadOnly(bool b)
+{
+ setAttribute(ATTR_READONLY, b ? "" : 0);
}
void HTMLGenericFormElementImpl::recalcStyle( StyleChange ch )
return QString::null;
}
+long HTMLGenericFormElementImpl::tabIndex() const
+{
+ return getAttribute(ATTR_TABINDEX).toInt();
+}
+
+void HTMLGenericFormElementImpl::setTabIndex(long value)
+{
+ setAttribute(ATTR_TABINDEX, QString::number(value));
+}
+
// -------------------------------------------------------------------------
HTMLButtonElementImpl::HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
click(sendToAnyElement);
}
+DOMString HTMLButtonElementImpl::accessKey() const
+{
+ return getAttribute(ATTR_ACCESSKEY);
+}
+
+void HTMLButtonElementImpl::setAccessKey(const DOMString &value)
+{
+ setAttribute(ATTR_ACCESSKEY, value);
+}
+
+DOMString HTMLButtonElementImpl::value() const
+{
+ return getAttribute(ATTR_VALUE);
+}
+
+void HTMLButtonElementImpl::setValue(const DOMString &value)
+{
+ setAttribute(ATTR_VALUE, value);
+}
+
// -------------------------------------------------------------------------
HTMLFieldSetElementImpl::HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
xPos = 0;
yPos = 0;
-#if APPLE_CHANGES
m_maxResults = -1;
-#endif
if ( m_form )
m_autocomplete = f->autoComplete();
setHTMLEventListener(EventImpl::INPUT_EVENT,
getDocument()->createHTMLEventListener(attr->value().string(), this));
break;
-#if APPLE_CHANGES
// Search field and slider attributes all just cause updateFromElement to be called through style
// recalcing.
case ATTR_ONSEARCH:
case ATTR_PRECISION:
setChanged();
break;
-#endif
default:
HTMLGenericFormElementImpl::parseHTMLAttribute(attr);
}
return (attr->id() == ATTR_SRC);
}
+DOMString HTMLInputElementImpl::defaultValue() const
+{
+ return getAttribute(ATTR_VALUE);
+}
+
+void HTMLInputElementImpl::setDefaultValue(const DOMString &value)
+{
+ setAttribute(ATTR_VALUE, value);
+}
+
+bool HTMLInputElementImpl::defaultChecked() const
+{
+ return !getAttribute(ATTR_CHECKED).isNull();
+}
+
+void HTMLInputElementImpl::setDefaultChecked(bool defaultChecked)
+{
+ setAttribute(ATTR_CHECKED, defaultChecked ? "" : 0);
+}
+
+DOMString HTMLInputElementImpl::accept() const
+{
+ return getAttribute(ATTR_ACCEPT);
+}
+
+void HTMLInputElementImpl::setAccept(const DOMString &value)
+{
+ setAttribute(ATTR_ACCEPT, value);
+}
+
+DOMString HTMLInputElementImpl::accessKey() const
+{
+ return getAttribute(ATTR_ACCESSKEY);
+}
+
+void HTMLInputElementImpl::setAccessKey(const DOMString &value)
+{
+ setAttribute(ATTR_ACCESSKEY, value);
+}
+
+DOMString HTMLInputElementImpl::align() const
+{
+ return getAttribute(ATTR_ALIGN);
+}
+
+void HTMLInputElementImpl::setAlign(const DOMString &value)
+{
+ setAttribute(ATTR_ALIGN, value);
+}
+
+DOMString HTMLInputElementImpl::alt() const
+{
+ return getAttribute(ATTR_ALT);
+}
+
+void HTMLInputElementImpl::setAlt(const DOMString &value)
+{
+ setAttribute(ATTR_ALT, value);
+}
+
+void HTMLInputElementImpl::setMaxLength(long _maxLength)
+{
+ setAttribute(ATTR_MAXLENGTH, QString::number(_maxLength));
+}
+
+DOMString HTMLInputElementImpl::sizeDOM() const
+{
+ return getAttribute(ATTR_SIZE);
+}
+
+void HTMLInputElementImpl::setSize(const DOMString &value)
+{
+ setAttribute(ATTR_SIZE, value);
+}
+
+DOMString HTMLInputElementImpl::src() const
+{
+ return getDocument()->completeURL(getAttribute(ATTR_SRC));
+}
+
+void HTMLInputElementImpl::setSrc(const DOMString &value)
+{
+ setAttribute(ATTR_SRC, value);
+}
+
+DOMString HTMLInputElementImpl::useMap() const
+{
+ return getAttribute(ATTR_USEMAP);
+}
+
+void HTMLInputElementImpl::setUseMap(const DOMString &value)
+{
+ setAttribute(ATTR_USEMAP, value);
+}
+
// -------------------------------------------------------------------------
HTMLLabelElementImpl::HTMLLabelElementImpl(DocumentPtr *doc)
element->accessKeyAction(sendToAnyElement);
}
+HTMLFormElementImpl *HTMLLabelElementImpl::form()
+{
+ ElementImpl *element = formElement();
+ if (element && isGenericFormElement())
+ return static_cast<HTMLGenericFormElementImpl *>(element)->form();
+ return 0;
+}
+
+DOMString HTMLLabelElementImpl::accessKey() const
+{
+ return getAttribute(ATTR_ACCESSKEY);
+}
+
+void HTMLLabelElementImpl::setAccessKey(const DOMString &value)
+{
+ setAttribute(ATTR_ACCESSKEY, value);
+}
+
+DOMString HTMLLabelElementImpl::htmlFor() const
+{
+ return getAttribute(ATTR_FOR);
+}
+
+void HTMLLabelElementImpl::setHtmlFor(const DOMString &value)
+{
+ setAttribute(ATTR_FOR, value);
+}
+
// -------------------------------------------------------------------------
HTMLLegendElementImpl::HTMLLegendElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
return "legend";
}
+DOMString HTMLLegendElementImpl::accessKey() const
+{
+ return getAttribute(ATTR_ACCESSKEY);
+}
+
+void HTMLLegendElementImpl::setAccessKey(const DOMString &value)
+{
+ setAttribute(ATTR_ACCESSKEY, value);
+}
+
+DOMString HTMLLegendElementImpl::align() const
+{
+ return getAttribute(ATTR_ALIGN);
+}
+
+void HTMLLegendElementImpl::setAlign(const DOMString &value)
+{
+ setAttribute(ATTR_ALIGN, value);
+}
+
// -------------------------------------------------------------------------
HTMLSelectElementImpl::HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
return DOMString("");
}
-void HTMLSelectElementImpl::setValue(DOMStringImpl* value)
+void HTMLSelectElementImpl::setValue(const DOMString &value)
{
+ if (value.isNull())
+ return;
// find the option with value() matching the given parameter
// and make it the current selection.
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
return m_options;
}
+// FIXME: Delete once the above function is working well enough to use for real.
+SharedPtr<HTMLCollectionImpl> HTMLSelectElementImpl::optionsHTMLCollection()
+{
+ return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::SELECT_OPTIONS));
+}
+
void HTMLSelectElementImpl::recalcListItems()
{
NodeImpl* current = firstChild();
setChanged(true);
}
-#if APPLE_CHANGES
-
void HTMLSelectElementImpl::defaultEventHandler(EventImpl *evt)
{
// Use key press event here since sending simulated mouse events
HTMLGenericFormElementImpl::defaultEventHandler(evt);
}
-#endif // APPLE_CHANGES
-
void HTMLSelectElementImpl::accessKeyAction(bool sendToAnyElement)
{
focus();
}
+void HTMLSelectElementImpl::setMultiple(bool multiple)
+{
+ setAttribute(ATTR_MULTIPLE, multiple ? "" : 0);
+}
+
+void HTMLSelectElementImpl::setSize(long size)
+{
+ setAttribute(ATTR_SIZE, QString::number(size));
+}
+
// -------------------------------------------------------------------------
HTMLKeygenElementImpl::HTMLKeygenElementImpl(DocumentPtr* doc, HTMLFormElementImpl* f)
static_cast<HTMLSelectElementImpl*>(select)->setRecalcListItems();
}
+DOMString HTMLOptGroupElementImpl::label() const
+{
+ return getAttribute(ATTR_LABEL);
+}
+
+void HTMLOptGroupElementImpl::setLabel(const DOMString &value)
+{
+ setAttribute(ATTR_LABEL, value);
+}
+
// -------------------------------------------------------------------------
HTMLOptionElementImpl::HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
return text;
}
+void HTMLOptionElementImpl::setText(const DOMString &text, int &exception)
+{
+ // Handle the common special case where there's exactly 1 child node, and it's a text node.
+ NodeImpl *child = firstChild();
+ if (child && child->isTextNode() && !child->nextSibling()) {
+ static_cast<TextImpl *>(child)->setData(text, exception);
+ return;
+ }
+
+ removeChildren();
+ appendChild(new TextImpl(docPtr(), text), exception);
+}
+
long HTMLOptionElementImpl::index() const
{
// Let's do this dynamically. Might be a bit slow, but we're sure
return 0;
}
-void HTMLOptionElementImpl::setIndex( long )
+void HTMLOptionElementImpl::setIndex(long, int &exception)
{
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
kdWarning() << "Unimplemented HTMLOptionElementImpl::setIndex(long) called" << endl;
// ###
}
return text().string().stripWhiteSpace();
}
-void HTMLOptionElementImpl::setValue(DOMStringImpl* value)
+void HTMLOptionElementImpl::setValue(const DOMString &value)
{
setAttribute(ATTR_VALUE, value);
}
return static_cast<HTMLSelectElementImpl*>(select);
}
+bool HTMLOptionElementImpl::defaultSelected() const
+{
+ return !getAttribute(ATTR_SELECTED).isNull();
+}
+
+void HTMLOptionElementImpl::setDefaultSelected(bool b)
+{
+ setAttribute(ATTR_SELECTED, b ? "" : 0);
+}
+
+DOMString HTMLOptionElementImpl::label() const
+{
+ return getAttribute(ATTR_LABEL);
+}
+
+void HTMLOptionElementImpl::setLabel(const DOMString &value)
+{
+ setAttribute(ATTR_LABEL, value);
+}
+
// -------------------------------------------------------------------------
HTMLTextAreaElementImpl::HTMLTextAreaElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
m_valueMatchesRenderer = false;
}
+DOMString HTMLTextAreaElementImpl::accessKey() const
+{
+ return getAttribute(ATTR_ACCESSKEY);
+}
+
+void HTMLTextAreaElementImpl::setAccessKey(const DOMString &value)
+{
+ setAttribute(ATTR_ACCESSKEY, value);
+}
+
+void HTMLTextAreaElementImpl::setCols(long cols)
+{
+ setAttribute(ATTR_COLS, QString::number(cols));
+}
+
+void HTMLTextAreaElementImpl::setRows(long rows)
+{
+ setAttribute(ATTR_ROWS, QString::number(rows));
+}
+
// -------------------------------------------------------------------------
HTMLIsIndexElementImpl::HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
: HTMLInputElementImpl(doc, f)
{
m_type = TEXT;
- setName("isindex");
+ setOverrideName("isindex");
}
NodeImpl::Id HTMLIsIndexElementImpl::id() const
}
}
+DOMString HTMLIsIndexElementImpl::prompt() const
+{
+ return getAttribute(ATTR_PROMPT);
+}
+
+void HTMLIsIndexElementImpl::setPrompt(const DOMString &value)
+{
+ setAttribute(ATTR_PROMPT, value);
+}
+
// -------------------------------------------------------------------------
unsigned long HTMLOptionsCollectionImpl::length() const
virtual void attach();
virtual void detach();
+ SharedPtr<HTMLCollectionImpl> elements();
long length() const;
DOMString enctype() const { return m_enctype; }
- void setEnctype( const DOMString & );
+ void setEnctype(const DOMString &);
DOMString boundary() const { return m_boundary; }
- void setBoundary( const DOMString & );
+ void setBoundary(const DOMString &);
bool autoComplete() const { return m_autocomplete; }
void removeImgElement(HTMLImageElementImpl *);
bool prepareSubmit();
- void submit(bool activateSubmitButton);
+ void submit(bool activateSubmitButton = false);
void reset();
void setMalformed(bool malformed) { m_malformed = malformed; }
virtual bool isURLAttribute(AttributeImpl *attr) const;
-#if APPLE_CHANGES
void submitClick();
bool formWouldHaveSecureSubmission(const DOMString &url);
-#endif
-
+
+ DOMString name() const;
+ void setName(const DOMString &);
+
+ DOMString acceptCharset() const;
+ void setAcceptCharset(const DOMString &);
+
+ DOMString action() const;
+ void setAction(const DOMString &);
+
+ DOMString method() const;
+ void setMethod(const DOMString &);
+
+ DOMString target() const;
+ void setTarget(const DOMString &);
+
static void i18nData();
friend class HTMLFormElement;
bool m_malformed : 1;
private:
+ void parseEnctype(const DOMString &);
bool formData(khtml::FormData &) const;
QString oldIdAttr;
void onSelect();
void onChange();
- virtual bool disabled() const;
+ bool disabled() const;
void setDisabled(bool _disabled);
virtual bool isFocusable() const;
virtual bool isEnumeratable() const { return false; }
bool readOnly() const { return m_readOnly; }
- void setReadOnly(bool _readOnly) { m_readOnly = _readOnly; }
+ void setReadOnly(bool _readOnly);
virtual void recalcStyle( StyleChange );
DOMString name() const;
void setName(const DOMString& name);
+ void setOverrideName(const DOMString& name);
+
virtual bool isGenericFormElement() const { return true; }
/*
virtual bool isActivatedSubmit() const { return false; }
virtual void setActivatedSubmit(bool flag) { }
+ long tabIndex() const;
+ void setTabIndex(long);
+
protected:
HTMLFormElementImpl *getForm() const;
- DOMStringImpl* m_name;
+ DOMString m_overrideName;
HTMLFormElementImpl *m_form;
bool m_disabled, m_readOnly;
virtual void click(bool sendMouseEvents);
virtual void accessKeyAction(bool sendToAnyElement);
+
+ DOMString accessKey() const;
+ void setAccessKey(const DOMString &);
+
+ DOMString value() const;
+ void setValue(const DOMString &);
+
void blur();
void focus();
void select();
- virtual void click(bool sendMouseEvents);
+ virtual void click(bool sendMouseEvents = false);
virtual void accessKeyAction(bool sendToAnyElement);
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual bool isURLAttribute(AttributeImpl *attr) const;
-#if APPLE_CHANGES
long maxResults() const { return m_maxResults; }
-#endif
+
+ DOMString defaultValue() const;
+ void setDefaultValue(const DOMString &);
+ bool defaultChecked() const;
+ void setDefaultChecked(bool);
+
+ DOMString accept() const;
+ void setAccept(const DOMString &);
+
+ DOMString accessKey() const;
+ void setAccessKey(const DOMString &);
+
+ DOMString align() const;
+ void setAlign(const DOMString &);
+
+ DOMString alt() const;
+ void setAlt(const DOMString &);
+
+ DOMString sizeDOM() const; // FIXME: rename to size after renaming existing size attribute
+ void setSize(const DOMString &);
+
+ DOMString src() const;
+ void setSrc(const DOMString &);
+
+ void setMaxLength(long);
+
+ DOMString useMap() const;
+ void setUseMap(const DOMString &);
+
protected:
bool storesValueSeparateFromAttribute() const;
short m_size;
short yPos;
-#if APPLE_CHANGES
short m_maxResults;
-#endif
HTMLImageLoader* m_imageLoader;
*/
ElementImpl *formElement();
+ HTMLFormElementImpl *form();
+
+ DOMString accessKey() const;
+ void setAccessKey(const DOMString &);
+
+ DOMString htmlFor() const;
+ void setHtmlFor(const DOMString &);
+
private:
DOMString m_formElementID;
};
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
virtual DOMString type() const;
+
+ DOMString accessKey() const;
+ void setAccessKey(const DOMString &);
+
+ DOMString align() const;
+ void setAlign(const DOMString &);
};
// -------------------------------------------------------------------------
void focus();
DOMString value();
- void setValue(DOMStringImpl* value);
+ void setValue(const DOMString &);
HTMLOptionsCollectionImpl *options();
+ SharedPtr<HTMLCollectionImpl> optionsHTMLCollection(); // FIXME: Remove this and migrate to options().
virtual bool maintainsState() { return true; }
virtual QString state();
virtual void reset();
void notifyOptionSelected(HTMLOptionElementImpl *selectedOption, bool selected);
-#if APPLE_CHANGES
virtual void defaultEventHandler(EventImpl *evt);
-#endif
-
virtual void accessKeyAction(bool sendToAnyElement);
+ void setMultiple(bool);
+
+ void setSize(long);
+
private:
void recalcListItems();
virtual void parseHTMLAttribute(HTMLAttributeImpl *attr);
void recalcSelectOptions();
+ DOMString label() const;
+ void setLabel(const DOMString &);
};
DOMString type() const;
DOMString text() const;
+ void setText(const DOMString &, int &exception);
long index() const;
- void setIndex( long );
+ void setIndex(long, int &exception);
virtual void parseHTMLAttribute(HTMLAttributeImpl *attr);
DOMString value() const;
- void setValue(DOMStringImpl* value);
+ void setValue(const DOMString &);
bool selected() const { return m_selected; }
void setSelected(bool _selected);
virtual void childrenChanged();
+ bool defaultSelected() const;
+ void setDefaultSelected( bool );
+
+ DOMString label() const;
+ void setLabel( const DOMString & );
+
protected:
DOMString m_value;
bool m_selected;
virtual void accessKeyAction(bool sendToAnyElement);
+ DOMString accessKey() const;
+ void setAccessKey(const DOMString &);
+
+ void setCols(long);
+
+ void setRows(long);
+
protected:
int m_rows;
int m_cols;
virtual Id id() const;
virtual void parseHTMLAttribute(HTMLAttributeImpl *attr);
+ DOMString prompt() const;
+ void setPrompt(const DOMString &);
+
protected:
DOMString m_prompt;
};
// ### should changing a document's base URL dynamically automatically update all images, stylesheets etc?
}
+void HTMLBaseElementImpl::setHref(const DOMString &value)
+{
+ setAttribute(ATTR_HREF, value);
+}
+
+void HTMLBaseElementImpl::setTarget(const DOMString &value)
+{
+ setAttribute(ATTR_TARGET, value);
+}
+
// -------------------------------------------------------------------------
HTMLLinkElementImpl::HTMLLinkElementImpl(DocumentPtr *doc)
return attr->id() == ATTR_HREF;
}
+bool HTMLLinkElementImpl::disabled() const
+{
+ return !getAttribute(ATTR_DISABLED).isNull();
+}
+
+void HTMLLinkElementImpl::setDisabled(bool disabled)
+{
+ setAttribute(ATTR_DISABLED, disabled ? "" : 0);
+}
+
+DOMString HTMLLinkElementImpl::charset() const
+{
+ return getAttribute(ATTR_CHARSET);
+}
+
+void HTMLLinkElementImpl::setCharset(const DOMString &value)
+{
+ setAttribute(ATTR_CHARSET, value);
+}
+
+DOMString HTMLLinkElementImpl::href() const
+{
+ return getDocument()->completeURL(getAttribute(ATTR_HREF));
+}
+
+void HTMLLinkElementImpl::setHref(const DOMString &value)
+{
+ setAttribute(ATTR_HREF, value);
+}
+
+DOMString HTMLLinkElementImpl::hreflang() const
+{
+ return getAttribute(ATTR_HREFLANG);
+}
+
+void HTMLLinkElementImpl::setHreflang(const DOMString &value)
+{
+ setAttribute(ATTR_HREFLANG, value);
+}
+
+DOMString HTMLLinkElementImpl::media() const
+{
+ return getAttribute(ATTR_MEDIA);
+}
+
+void HTMLLinkElementImpl::setMedia(const DOMString &value)
+{
+ setAttribute(ATTR_MEDIA, value);
+}
+
+DOMString HTMLLinkElementImpl::rel() const
+{
+ return getAttribute(ATTR_REL);
+}
+
+void HTMLLinkElementImpl::setRel(const DOMString &value)
+{
+ setAttribute(ATTR_REL, value);
+}
+
+DOMString HTMLLinkElementImpl::rev() const
+{
+ return getAttribute(ATTR_REV);
+}
+
+void HTMLLinkElementImpl::setRev(const DOMString &value)
+{
+ setAttribute(ATTR_REV, value);
+}
+
+DOMString HTMLLinkElementImpl::target() const
+{
+ return getAttribute(ATTR_TARGET);
+}
+
+void HTMLLinkElementImpl::setTarget(const DOMString &value)
+{
+ setAttribute(ATTR_TARGET, value);
+}
+
+DOMString HTMLLinkElementImpl::type() const
+{
+ return getAttribute(ATTR_TYPE);
+}
+
+void HTMLLinkElementImpl::setType(const DOMString &value)
+{
+ setAttribute(ATTR_TYPE, value);
+}
+
// -------------------------------------------------------------------------
HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
getDocument()->processHttpEquiv(m_equiv,m_content);
}
+DOMString HTMLMetaElementImpl::content() const
+{
+ return getAttribute(ATTR_CONTENT);
+}
+
+void HTMLMetaElementImpl::setContent(const DOMString &value)
+{
+ setAttribute(ATTR_CONTENT, value);
+}
+
+DOMString HTMLMetaElementImpl::httpEquiv() const
+{
+ return getAttribute(ATTR_HTTP_EQUIV);
+}
+
+void HTMLMetaElementImpl::setHttpEquiv(const DOMString &value)
+{
+ setAttribute(ATTR_HTTP_EQUIV, value);
+}
+
+DOMString HTMLMetaElementImpl::name() const
+{
+ return getAttribute(ATTR_NAME);
+}
+
+void HTMLMetaElementImpl::setName(const DOMString &value)
+{
+ setAttribute(ATTR_NAME, value);
+}
+
+DOMString HTMLMetaElementImpl::scheme() const
+{
+ return getAttribute(ATTR_SCHEME);
+}
+
+void HTMLMetaElementImpl::setScheme(const DOMString &value)
+{
+ setAttribute(ATTR_SCHEME, value);
+}
+
// -------------------------------------------------------------------------
HTMLScriptElementImpl::HTMLScriptElementImpl(DocumentPtr *doc)
m_cachedScript->deref(this);
}
+NodeImpl::Id HTMLScriptElementImpl::id() const
+{
+ return ID_SCRIPT;
+}
+
+bool HTMLScriptElementImpl::isURLAttribute(AttributeImpl *attr) const
+{
+ return attr->id() == ATTR_SRC;
+}
+
void HTMLScriptElementImpl::insertedIntoDocument()
{
HTMLElementImpl::insertedIntoDocument();
if (!proxy)
return;
- proxy->evaluate(doc->URL(), 0, scriptString.string(), Node());
+ proxy->evaluate(doc->URL(), 0, scriptString.string(), 0);
DocumentImpl::updateDocumentsRendering();
}
if (part) {
KJSProxy *proxy = KJSProxy::proxy(part);
if (proxy) {
- proxy->evaluate(cs->url().string(), 0, cs->script().string(), Node());
+ proxy->evaluate(cs->url().string(), 0, cs->script().string(), 0);
DocumentImpl::updateDocumentsRendering();
}
}
m_cachedScript = 0;
}
-NodeImpl::Id HTMLScriptElementImpl::id() const
+DOMString HTMLScriptElementImpl::text() const
{
- return ID_SCRIPT;
+ return getAttribute(ATTR_TEXT);
}
-bool HTMLScriptElementImpl::isURLAttribute(AttributeImpl *attr) const
+void HTMLScriptElementImpl::setText(const DOMString &value)
{
- return attr->id() == ATTR_SRC;
+ setAttribute(ATTR_TEXT, value);
+}
+
+DOMString HTMLScriptElementImpl::htmlFor() const
+{
+ // DOM Level 1 says: reserved for future use.
+ return DOMString();
+}
+
+void HTMLScriptElementImpl::setHtmlFor(const DOMString &/*value*/)
+{
+ // DOM Level 1 says: reserved for future use.
+}
+
+DOMString HTMLScriptElementImpl::event() const
+{
+ // DOM Level 1 says: reserved for future use.
+ return DOMString();
+}
+
+void HTMLScriptElementImpl::setEvent(const DOMString &/*value*/)
+{
+ // DOM Level 1 says: reserved for future use.
+}
+
+DOMString HTMLScriptElementImpl::charset() const
+{
+ return getAttribute(ATTR_CHARSET);
+}
+
+void HTMLScriptElementImpl::setCharset(const DOMString &value)
+{
+ setAttribute(ATTR_CHARSET, value);
+}
+
+bool HTMLScriptElementImpl::defer() const
+{
+ return !getAttribute(ATTR_DEFER).isNull();
+}
+
+void HTMLScriptElementImpl::setDefer(bool defer)
+{
+ setAttribute(ATTR_DEFER, defer ? "" : 0);
+}
+
+DOMString HTMLScriptElementImpl::src() const
+{
+ return getDocument()->completeURL(getAttribute(ATTR_SRC));
+}
+
+void HTMLScriptElementImpl::setSrc(const DOMString &value)
+{
+ setAttribute(ATTR_SRC, value);
+}
+
+DOMString HTMLScriptElementImpl::type() const
+{
+ return getAttribute(ATTR_TYPE);
+}
+
+void HTMLScriptElementImpl::setType(const DOMString &value)
+{
+ setAttribute(ATTR_TYPE, value);
}
// -------------------------------------------------------------------------
getDocument()->stylesheetLoaded();
}
+bool HTMLStyleElementImpl::disabled() const
+{
+ return !getAttribute(ATTR_DISABLED).isNull();
+}
+
+void HTMLStyleElementImpl::setDisabled(bool disabled)
+{
+ setAttribute(ATTR_DISABLED, disabled ? "" : 0);
+}
+
+DOMString HTMLStyleElementImpl::media() const
+{
+ return getAttribute(ATTR_MEDIA);
+}
+
+void HTMLStyleElementImpl::setMedia(const DOMString &value)
+{
+ setAttribute(ATTR_MEDIA, value);
+}
+
+DOMString HTMLStyleElementImpl::type() const
+{
+ return getAttribute(ATTR_TYPE);
+}
+
+void HTMLStyleElementImpl::setType(const DOMString &value)
+{
+ setAttribute(ATTR_TYPE, value);
+}
+
// -------------------------------------------------------------------------
HTMLTitleElementImpl::HTMLTitleElementImpl(DocumentPtr *doc)
void HTMLTitleElementImpl::insertedIntoDocument()
{
HTMLElementImpl::insertedIntoDocument();
-#if APPLE_CHANGES
// Only allow title to be set by first <title> encountered.
if (getDocument()->title().isEmpty())
getDocument()->setTitle(m_title);
-#else
- getDocument()->setTitle(m_title);
-#endif
}
void HTMLTitleElementImpl::removedFromDocument()
if ((c->nodeType() == Node::TEXT_NODE) || (c->nodeType() == Node::CDATA_SECTION_NODE))
m_title += c->nodeValue();
}
-#if APPLE_CHANGES
// Only allow title to be set by first <title> encountered.
if (inDocument() && getDocument()->title().isEmpty())
-#else
- if (inDocument())
-#endif
getDocument()->setTitle(m_title);
}
+
+DOMString HTMLTitleElementImpl::text() const
+{
+ // FIXME: Obviously wrong! There's no "text" attribute on a title element.
+ // Need to do something with the children perhaps?
+ return getAttribute(ATTR_TEXT);
+}
+
+void HTMLTitleElementImpl::setText(const DOMString &value)
+{
+ // FIXME: Obviously wrong! There's no "text" attribute on a title element.
+ // Need to do something with the children perhaps?
+ setAttribute(ATTR_TEXT, value);
+}
void process();
+ void setHref(const DOMString &);
+ void setTarget(const DOMString &);
+
protected:
DOMString m_href;
DOMString m_target;
virtual Id id() const;
+ bool disabled() const;
+ void setDisabled(bool);
+
+ DOMString charset() const;
+ void setCharset(const DOMString &);
+
+ DOMString href() const;
+ void setHref(const DOMString &);
+
+ DOMString hreflang() const;
+ void setHreflang(const DOMString &);
+
+ DOMString media() const;
+ void setMedia(const DOMString &);
+
+ DOMString rel() const;
+ void setRel(const DOMString &);
+
+ DOMString rev() const;
+ void setRev(const DOMString &);
+
+ DOMString target() const;
+ void setTarget(const DOMString &);
+
+ DOMString type() const;
+ void setType(const DOMString &);
+
StyleSheetImpl* sheet() const { return m_sheet; }
// overload from HTMLElementImpl
void process();
+ DOMString content() const;
+ void setContent(const DOMString &);
+
+ DOMString httpEquiv() const;
+ void setHttpEquiv(const DOMString &);
+
+ DOMString name() const;
+ void setName(const DOMString &);
+
+ DOMString scheme() const;
+ void setScheme(const DOMString &);
+
protected:
DOMString m_equiv;
DOMString m_content;
void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
+ DOMString text() const;
+ void setText(const DOMString &);
+
+ DOMString htmlFor() const;
+ void setHtmlFor(const DOMString &);
+
+ DOMString event() const;
+ void setEvent(const DOMString &);
+
+ DOMString charset() const;
+ void setCharset(const DOMString &);
+
+ bool defer() const;
+ void setDefer(bool);
+
+ DOMString src() const;
+ void setSrc(const DOMString &);
+
+ DOMString type() const;
+ void setType(const DOMString &);
+
private:
khtml::CachedScript *m_cachedScript;
bool m_createdByParser;
bool isLoading() const;
void sheetLoaded();
+ bool disabled() const;
+ void setDisabled(bool);
+
+ DOMString media() const;
+ void setMedia(const DOMString &);
+
+ DOMString type() const;
+ void setType(const DOMString &);
+
protected:
CSSStyleSheetImpl *m_sheet;
bool m_loading;
virtual void removedFromDocument();
virtual void childrenChanged();
+ DOMString text() const;
+ void setText(const DOMString &);
+
protected:
DOMString m_title;
};
-}; //namespace
+} //namespace
#endif
#include "misc/htmlhashes.h"
#include "dom/dom_node.h"
-using namespace DOM;
-
#include <kdebug.h>
+namespace DOM {
+
HTMLBaseFontElementImpl::HTMLBaseFontElementImpl(DocumentPtr *doc)
: HTMLElementImpl(doc)
{
}
-HTMLBaseFontElementImpl::~HTMLBaseFontElementImpl()
+NodeImpl::Id HTMLBaseFontElementImpl::id() const
{
+ return ID_BASEFONT;
}
-NodeImpl::Id HTMLBaseFontElementImpl::id() const
+DOMString HTMLBaseFontElementImpl::color() const
{
- return ID_BASEFONT;
+ return getAttribute(ATTR_COLOR);
+}
+
+void HTMLBaseFontElementImpl::setColor(const DOMString &value)
+{
+ setAttribute(ATTR_COLOR, value);
+}
+
+DOMString HTMLBaseFontElementImpl::face() const
+{
+ return getAttribute(ATTR_FACE);
+}
+
+void HTMLBaseFontElementImpl::setFace(const DOMString &value)
+{
+ setAttribute(ATTR_FACE, value);
+}
+
+DOMString HTMLBaseFontElementImpl::size() const
+{
+ return getAttribute(ATTR_SIZE);
+}
+
+void HTMLBaseFontElementImpl::setSize(const DOMString &value)
+{
+ setAttribute(ATTR_SIZE, value);
}
// -------------------------------------------------------------------------
HTMLCollectionImpl::HTMLCollectionImpl(NodeImpl *_base, int _type)
+ : m_base(_base)
{
- base = _base;
- base->ref();
type = _type;
idsDone = false;
- info = base->isDocumentNode() && base->getDocument()->isHTMLDocument() ? static_cast<HTMLDocumentImpl*>(base->getDocument())->collectionInfo(type) : 0;
+ info = _base->isDocumentNode() && _base->getDocument()->isHTMLDocument() ? static_cast<HTMLDocumentImpl*>(_base->getDocument())->collectionInfo(type) : 0;
}
HTMLCollectionImpl::~HTMLCollectionImpl()
{
- base->deref();
}
HTMLCollectionImpl::CollectionInfo::CollectionInfo() :
void HTMLCollectionImpl::resetCollectionInfo() const
{
- unsigned int docversion = static_cast<HTMLDocumentImpl*>(base->getDocument())->domTreeVersion();
+ unsigned int docversion = static_cast<HTMLDocumentImpl*>(m_base->getDocument())->domTreeVersion();
if (!info) {
info = new CollectionInfo;
{
assert(current);
- current = current->traverseNextNode(base);
+ current = current->traverseNextNode(m_base.get());
while (current) {
if(current->nodeType() == Node::ELEMENT_NODE) {
return current;
}
if (deep) {
- current = current->traverseNextNode(base);
+ current = current->traverseNextNode(m_base.get());
continue;
}
}
- current = current->traverseNextSibling(base);
+ current = current->traverseNextSibling(m_base.get());
}
return 0;
}
{
unsigned long len = 0;
- for (NodeImpl *current = traverseNextItem(base); current; current = traverseNextItem(current)) {
+ for (NodeImpl *current = traverseNextItem(m_base.get()); current; current = traverseNextItem(current)) {
len++;
}
return 0;
}
if (!info->current || info->position > index) {
- info->current = traverseNextItem(base);
+ info->current = traverseNextItem(m_base.get());
info->position = 0;
if (!info->current)
return 0;
idsDone = false;
NodeImpl *n;
- for (n = traverseNextItem(base); n; n = traverseNextItem(n)) {
+ for (n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
if (checkForNameMatch(n, idsDone, name, caseSensitive)) {
break;
}
return info->current;
idsDone = true;
- for (n = traverseNextItem(base); n; n = traverseNextItem(n)) {
+ for (n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
if (checkForNameMatch(n, idsDone, name, caseSensitive)) {
break;
}
if (info->hasNameCache)
return;
- for (NodeImpl *n = traverseNextItem(base); n; n = traverseNextItem(n)) {
+ for (NodeImpl *n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
ElementImpl *e = static_cast<ElementImpl *>(n);
QString idAttr = e->getAttribute(ATTR_ID).string();
QString nameAttr = e->getAttribute(ATTR_NAME).string();
info->hasNameCache = true;
}
-QValueList<Node> HTMLCollectionImpl::namedItems(const DOMString &name) const
+QValueList< SharedPtr<NodeImpl> > HTMLCollectionImpl::namedItems(const DOMString &name) const
{
- QValueList<Node> result;
+ QValueList< SharedPtr<NodeImpl> > result;
if (name.isEmpty())
return result;
QPtrVector<NodeImpl> *nameResults = info->nameCache.find(name.string());
for (unsigned i = 0; idResults && i < idResults->count(); ++i) {
- result.append(idResults->at(i));
+ result.append(SharedPtr<NodeImpl>(idResults->at(i)));
}
for (unsigned i = 0; nameResults && i < nameResults->count(); ++i) {
- result.append(nameResults->at(i));
+ result.append(SharedPtr<NodeImpl>(nameResults->at(i)));
}
return result;
{
resetCollectionInfo();
- for (NodeImpl *n = traverseNextItem(info->current ? info->current : base); n; n = traverseNextItem(n)) {
+ for (NodeImpl *n = traverseNextItem(info->current ? info->current : m_base.get()); n; n = traverseNextItem(n)) {
if (checkForNameMatch(n, idsDone, name, true)) {
info->current = n;
return n;
}
idsDone = true;
- for (NodeImpl *n = traverseNextItem(info->current ? info->current : base); n; n = traverseNextItem(n)) {
+ for (NodeImpl *n = traverseNextItem(info->current ? info->current : m_base.get()); n; n = traverseNextItem(n)) {
if (checkForNameMatch(n, idsDone, name, true)) {
info->current = n;
return n;
HTMLFormCollectionImpl::HTMLFormCollectionImpl(NodeImpl* _base)
: HTMLCollectionImpl(_base, 0)
{
- HTMLFormElementImpl *formBase = static_cast<HTMLFormElementImpl*>(base);
+ HTMLFormElementImpl *formBase = static_cast<HTMLFormElementImpl*>(m_base.get());
if (!formBase->collectionInfo) {
formBase->collectionInfo = new CollectionInfo();
}
unsigned long HTMLFormCollectionImpl::calcLength() const
{
- QPtrVector<HTMLGenericFormElementImpl> &l = static_cast<HTMLFormElementImpl*>( base )->formElements;
+ QPtrVector<HTMLGenericFormElementImpl> &l = static_cast<HTMLFormElementImpl*>(m_base.get())->formElements;
int len = 0;
for ( unsigned i = 0; i < l.count(); i++ )
info->elementsArrayPosition = 0;
}
- QPtrVector<HTMLGenericFormElementImpl> &l = static_cast<HTMLFormElementImpl*>( base )->formElements;
+ QPtrVector<HTMLGenericFormElementImpl> &l = static_cast<HTMLFormElementImpl*>(m_base.get())->formElements;
unsigned currentIndex = info->position;
for (unsigned i = info->elementsArrayPosition; i < l.count(); i++) {
NodeImpl* HTMLFormCollectionImpl::getNamedFormItem(int attr_id, const DOMString& name, int duplicateNumber, bool caseSensitive) const
{
- if(base->nodeType() == Node::ELEMENT_NODE)
+ if(m_base->nodeType() == Node::ELEMENT_NODE)
{
- HTMLElementImpl* baseElement = static_cast<HTMLElementImpl*>(base);
+ HTMLElementImpl* baseElement = static_cast<HTMLElementImpl*>(m_base.get());
bool foundInputElements = false;
if(baseElement->id() == ID_FORM)
{
return 0;
// After doing all ATTR_ID, do ATTR_NAME
idsDone = true;
- return getNamedItem(base->firstChild(), ATTR_NAME, name, true);
+ return getNamedItem(m_base->firstChild(), ATTR_NAME, name, true);
}
NodeImpl *HTMLFormCollectionImpl::namedItem( const DOMString &name, bool caseSensitive ) const
// that are allowed a name attribute.
resetCollectionInfo();
idsDone = false;
- info->current = getNamedItem(base->firstChild(), ATTR_ID, name, true);
+ info->current = getNamedItem(m_base->firstChild(), ATTR_ID, name, true);
if(info->current)
return info->current;
idsDone = true;
- info->current = getNamedItem(base->firstChild(), ATTR_NAME, name, true);
+ info->current = getNamedItem(m_base->firstChild(), ATTR_NAME, name, true);
return info->current;
}
QDict<char> foundInputElements;
- if (base->nodeType() != Node::ELEMENT_NODE ||static_cast<HTMLElementImpl*>(base)->id() != ID_FORM) {
+ if (m_base->id() != ID_FORM) {
info->hasNameCache = true;
return;
}
- HTMLElementImpl* baseElement = static_cast<HTMLElementImpl*>(base);
+ HTMLElementImpl* baseElement = static_cast<HTMLElementImpl*>(m_base.get());
HTMLFormElementImpl* f = static_cast<HTMLFormElementImpl*>(baseElement);
for (unsigned i = 0; i < f->formElements.count(); ++i) {
info->hasNameCache = true;
}
+
+}
public:
HTMLBaseFontElementImpl(DocumentPtr *doc);
- ~HTMLBaseFontElementImpl();
-
virtual Id id() const;
+
+ DOMString color() const;
+ void setColor(const DOMString &);
+
+ DOMString face() const;
+ void setFace(const DOMString &);
+
+ DOMString size() const;
+ void setSize(const DOMString &);
};
// -------------------------------------------------------------------------
// In case of multiple items named the same way
virtual NodeImpl *nextNamedItem( const DOMString &name ) const;
- QValueList<Node> namedItems( const DOMString &name ) const;
+ QValueList< SharedPtr<NodeImpl> > namedItems(const DOMString &name) const;
+
+ NodeImpl *base() { return m_base.get(); }
struct CollectionInfo {
CollectionInfo();
virtual unsigned long calcLength() const;
virtual void resetCollectionInfo() const;
// the base node, the collection refers to
- NodeImpl *base;
+ SharedPtr<NodeImpl> m_base;
// The collection list the following elements
int type;
mutable CollectionInfo *info;
if(!n)
return;
- Node protectNode(n);
+ SharedPtr<NodeImpl> protectNode(n);
// set attributes
if(n->isElementNode())
bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
{
- Node protectNode(n);
+ SharedPtr<NodeImpl> protectNode(n);
int id = n->id();
using DOM::DOMStringImpl;
using DOM::DocumentImpl;
using DOM::FORBIDDEN;
-using DOM::Node;
using DOM::emptyAtom;
using DOM::endTagRequirement;
printf("beginning script execution at %d\n", parser->doc()->elapsedTime());
#endif
- view->part()->executeScript(url,baseLine,Node(),str);
+ view->part()->executeScript(url,baseLine,0,str);
allowYield = true;
#include "xml/dom_nodeimpl.h"
#include "xml/dom_position.h"
-using namespace khtml;
using namespace DOM;
-class khtml::MouseEvent::MouseEventPrivate
+namespace khtml {
+
+class MouseEvent::MouseEventPrivate
{
};
-khtml::MouseEvent::MouseEvent( const char *name, QMouseEvent *qmouseEvent, int x, int y,
+MouseEvent::MouseEvent( const char *name, QMouseEvent *qmouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString& target,
- const DOM::Node &innerNode )
+ NodeImpl *innerNode )
: KParts::Event( name ), m_qmouseEvent( qmouseEvent ), m_x( x ), m_y( y ),
m_url( url ), m_target(target), m_innerNode( innerNode )
{
d = 0;
- if (innerNode.handle() && innerNode.handle()->renderer()) {
+ if (innerNode && innerNode->renderer()) {
// FIXME: For text nodes, for now, we get the absolute position from
// the parent.
- DOM::Node n = innerNode;
- if (n.nodeType() == Node::TEXT_NODE)
- n = n.parentNode();
- n.handle()->renderer()->absolutePosition(m_nodeAbsX, m_nodeAbsY);
+ NodeImpl *n = innerNode;
+ if (n->isTextNode())
+ n = n->parentNode();
+ n->renderer()->absolutePosition(m_nodeAbsX, m_nodeAbsY);
}
}
-khtml::MouseEvent::~MouseEvent()
+MouseEvent::~MouseEvent()
{
delete d;
}
-long khtml::MouseEvent::offset() const
+long MouseEvent::offset() const
{
Position pos;
- if (innerNode().handle()) {
+ if (NodeImpl *inner = m_innerNode.get()) {
// FIXME: Shouldn't be necessary to skip text nodes.
- DOM::Node inner = innerNode();
- if (inner.nodeType() == Node::TEXT_NODE)
- inner = inner.parentNode();
- if (inner.handle()->renderer())
- pos = inner.handle()->renderer()->positionForCoordinates(m_x, m_y).deepEquivalent();
+ if (inner->isTextNode())
+ inner = inner->parentNode();
+ if (inner->renderer())
+ pos = inner->renderer()->positionForCoordinates(m_x, m_y).deepEquivalent();
}
return pos.offset();
}
-const char *khtml::MousePressEvent::s_strMousePressEvent = "khtml/Events/MousePressEvent";
-
-const char *khtml::MouseDoubleClickEvent::s_strMouseDoubleClickEvent = "khtml/Events/MouseDoubleClickEvent";
-
-const char *khtml::MouseMoveEvent::s_strMouseMoveEvent = "khtml/Events/MouseMoveEvent";
-
-const char *khtml::MouseReleaseEvent::s_strMouseReleaseEvent = "khtml/Events/MouseReleaseEvent";
+const char *MousePressEvent::s_strMousePressEvent = "khtml/Events/MousePressEvent";
+const char *MouseDoubleClickEvent::s_strMouseDoubleClickEvent = "khtml/Events/MouseDoubleClickEvent";
+const char *MouseMoveEvent::s_strMouseMoveEvent = "khtml/Events/MouseMoveEvent";
+const char *MouseReleaseEvent::s_strMouseReleaseEvent = "khtml/Events/MouseReleaseEvent";
+const char *DrawContentsEvent::s_strDrawContentsEvent = "khtml/Events/DrawContentsEvent";
-const char *khtml::DrawContentsEvent::s_strDrawContentsEvent = "khtml/Events/DrawContentsEvent";
-
-class khtml::DrawContentsEvent::DrawContentsEventPrivate
+class DrawContentsEvent::DrawContentsEventPrivate
{
-public:
- DrawContentsEventPrivate()
- {
- }
- ~DrawContentsEventPrivate()
- {
- }
};
-khtml::DrawContentsEvent::DrawContentsEvent( QPainter *painter, int clipx, int clipy, int clipw, int cliph )
+DrawContentsEvent::DrawContentsEvent( QPainter *painter, int clipx, int clipy, int clipw, int cliph )
: KParts::Event( s_strDrawContentsEvent ), m_painter( painter ), m_clipx( clipx ), m_clipy( clipy ),
m_clipw( clipw ), m_cliph( cliph )
{
d = new DrawContentsEventPrivate;
}
-khtml::DrawContentsEvent::~DrawContentsEvent()
+DrawContentsEvent::~DrawContentsEvent()
{
delete d;
}
+}
#include <kparts/event.h>
-#include "dom/dom_node.h"
#include "dom/dom_string.h"
+namespace DOM {
+ class NodeImpl;
+}
+
namespace khtml
{
public:
MouseEvent( const char *name, QMouseEvent *qmouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString& target,
- const DOM::Node &innerNode);
+ DOM::NodeImpl *innerNode);
virtual ~MouseEvent();
QMouseEvent *qmouseEvent() const { return m_qmouseEvent; }
DOM::DOMString url() const { return m_url; }
DOM::DOMString target() const { return m_target; }
- DOM::Node innerNode() const { return m_innerNode; }
+ DOM::NodeImpl *innerNode() const { return m_innerNode.get(); }
// return the offset of innerNode
long offset() const;
int m_nodeAbsX, m_nodeAbsY;
DOM::DOMString m_url;
DOM::DOMString m_target;
- DOM::Node m_innerNode;
+ SharedPtr<DOM::NodeImpl> m_innerNode;
class MouseEventPrivate;
MouseEventPrivate *d;
};
public:
MousePressEvent( QMouseEvent *mouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString& target,
- const DOM::Node &innerNode)
+ DOM::NodeImpl *innerNode)
: MouseEvent( s_strMousePressEvent, mouseEvent, x, y, url, target, innerNode )
{}
public:
MouseDoubleClickEvent( QMouseEvent *mouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString& target,
- const DOM::Node &innerNode)
+ DOM::NodeImpl *innerNode)
: MouseEvent( s_strMouseDoubleClickEvent, mouseEvent, x, y, url, target, innerNode )
{}
public:
MouseMoveEvent( QMouseEvent *mouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString& target,
- const DOM::Node &innerNode)
+ DOM::NodeImpl *innerNode)
: MouseEvent( s_strMouseMoveEvent, mouseEvent, x, y, url, target, innerNode )
{}
public:
MouseReleaseEvent( QMouseEvent *mouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString& target,
- const DOM::Node &innerNode, long = 0 )
+ DOM::NodeImpl *innerNode, long = 0 )
: MouseEvent( s_strMouseReleaseEvent, mouseEvent, x, y, url, target, innerNode )
{}
// Stop any started redirections as well!! (DA)
cancelRedirection();
+#if !KHTML_NO_CPLUSPLUS_DOM
// null node activated.
emit nodeActivated(Node());
+#endif
return true;
}
+#if !KHTML_NO_CPLUSPLUS_DOM
+
DOM::HTMLDocument KHTMLPart::htmlDocument() const
{
if (d->m_doc && d->m_doc->isHTMLDocument())
return d->m_doc;
}
+#endif
KParts::BrowserExtension *KHTMLPart::browserExtension() const
{
QVariant KHTMLPart::executeScript( const QString &script, bool forceUserGesture )
{
- return executeScript( DOM::Node(), script, forceUserGesture );
+ return executeScript( 0, script, forceUserGesture );
}
//Enable this to see all JS scripts being executed
//#define KJS_VERBOSE
+#if !KHTML_NO_CPLUSPLUS_DOM
+
QVariant KHTMLPart::executeScript( const DOM::Node &n, const QString &script, bool forceUserGesture )
+{
+ return executeScript(n.handle(), script, forceUserGesture);
+}
+
+#endif
+
+QVariant KHTMLPart::executeScript( DOM::NodeImpl *n, const QString &script, bool forceUserGesture )
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "KHTMLPart::executeScript n=" << n.nodeName().string().latin1() << "(" << (n.isNull() ? 0 : n.nodeType()) << ") " << script << endl;
return ret;
}
-bool KHTMLPart::scheduleScript(const DOM::Node &n, const QString& script)
+bool KHTMLPart::scheduleScript(DOM::NodeImpl *n, const QString& script)
{
//kdDebug(6050) << "KHTMLPart::scheduleScript "<< script << endl;
d->scheduledScript = script;
- d->scheduledScriptNode = n;
+ d->scheduledScriptNode.reset(n);
return true;
}
//kdDebug(6050) << "executing delayed " << d->scheduledScript << endl;
- QVariant ret = executeScript( d->scheduledScriptNode, d->scheduledScript );
+ QVariant ret = executeScript( d->scheduledScriptNode.get(), d->scheduledScript );
d->scheduledScript = QString();
- d->scheduledScriptNode = DOM::Node();
+ d->scheduledScriptNode.reset();
return ret;
}
findTextBegin(); // resets d->m_findNode and d->m_findPos
#endif
- d->m_mousePressNode = DOM::Node();
+ d->m_mousePressNode.reset();
if ( d->m_doc )
#endif // APPLE_CHANGES
+#if !KHTML_NO_CPLUSPLUS_DOM
+
DOM::Node KHTMLPart::nodeUnderMouse() const
{
return d->m_view->nodeUnderMouse();
}
+#endif
+
void KHTMLPart::emitSelectionChanged()
{
#if !APPLE_CHANGES
return false;
}
-void KHTMLPart::selectClosestWordFromMouseEvent(QMouseEvent *mouse, DOM::Node &innerNode, int x, int y)
+void KHTMLPart::selectClosestWordFromMouseEvent(QMouseEvent *mouse, NodeImpl *innerNode, int x, int y)
{
Selection selection;
- if (!innerNode.isNull() && innerNode.handle()->renderer() && innerNode.handle()->renderer()->shouldSelect()) {
- VisiblePosition pos(innerNode.handle()->renderer()->positionForCoordinates(x, y));
+ if (innerNode && innerNode->renderer() && innerNode->renderer()->shouldSelect()) {
+ VisiblePosition pos(innerNode->renderer()->positionForCoordinates(x, y));
if (pos.isNotNull()) {
selection.moveTo(pos);
selection.expandUsingGranularity(WORD);
// from setting caret selection.
d->m_beganSelectingText = true;
} else {
- DOM::Node node = event->innerNode();
- selectClosestWordFromMouseEvent(event->qmouseEvent(), node, event->x(), event->y());
+ selectClosestWordFromMouseEvent(event->qmouseEvent(), event->innerNode(), event->x(), event->y());
}
}
}
void KHTMLPart::handleMousePressEventTripleClick(khtml::MousePressEvent *event)
{
QMouseEvent *mouse = event->qmouseEvent();
- DOM::Node innerNode = event->innerNode();
+ NodeImpl *innerNode = event->innerNode();
Selection selection;
- if (mouse->button() == LeftButton && !innerNode.isNull() && innerNode.handle()->renderer() &&
- innerNode.handle()->renderer()->shouldSelect()) {
- VisiblePosition pos(innerNode.handle()->renderer()->positionForCoordinates(event->x(), event->y()));
+ if (mouse->button() == LeftButton && innerNode && innerNode->renderer() &&
+ innerNode->renderer()->shouldSelect()) {
+ VisiblePosition pos(innerNode->renderer()->positionForCoordinates(event->x(), event->y()));
if (pos.isNotNull()) {
selection.moveTo(pos);
selection.expandUsingGranularity(PARAGRAPH);
void KHTMLPart::handleMousePressEventSingleClick(khtml::MousePressEvent *event)
{
QMouseEvent *mouse = event->qmouseEvent();
- DOM::Node innerNode = event->innerNode();
+ NodeImpl *innerNode = event->innerNode();
if (mouse->button() == LeftButton) {
Selection sel;
- if (!innerNode.isNull() && innerNode.handle()->renderer() &&
- innerNode.handle()->renderer()->shouldSelect()) {
+ if (innerNode && innerNode->renderer() &&
+ innerNode->renderer()->shouldSelect()) {
// Extend the selection if the Shift key is down, unless the click is in a link.
bool extendSelection = (mouse->state() & ShiftButton) && (event->url().isNull());
return;
}
- VisiblePosition visiblePos(innerNode.handle()->renderer()->positionForCoordinates(event->x(), event->y()));
+ VisiblePosition visiblePos(innerNode->renderer()->positionForCoordinates(event->x(), event->y()));
if (visiblePos.isNull())
- visiblePos = VisiblePosition(innerNode.handle(), innerNode.handle()->caretMinOffset(), khtml::DOWNSTREAM);
+ visiblePos = VisiblePosition(innerNode, innerNode->caretMinOffset(), khtml::DOWNSTREAM);
Position pos = visiblePos.deepEquivalent();
sel = selection();
{
DOM::DOMString url = event->url();
QMouseEvent *mouse = event->qmouseEvent();
- DOM::Node innerNode = event->innerNode();
+ NodeImpl *innerNode = event->innerNode();
- d->m_mousePressNode = innerNode;
+ d->m_mousePressNode.reset(innerNode);
d->m_dragStartPos = mouse->pos();
if (!event->url().isNull()) {
#else
QMouseEvent *mouse = event->qmouseEvent();
- DOM::Node innerNode = event->innerNode();
+ NodeImpl *innerNode = event->innerNode();
- if (d->m_bMousePressed && (!d->m_strSelectedURL.isEmpty() || (!innerNode.isNull() && innerNode.elementId() == ID_IMG)) &&
+ if (d->m_bMousePressed && (!d->m_strSelectedURL.isEmpty() || (innerNode && innerNode->id() == ID_IMG)) &&
(d->m_dragStartPos - mouse->pos()).manhattanLength() > KGlobalSettings::dndEventDelay() &&
d->m_bDnd && d->m_mousePressNode == innerNode) {
p = KMimeType::pixmapForURL(u, 0, KIcon::Desktop, KIcon::SizeMedium);
}
else {
- HTMLImageElementImpl *i = static_cast<HTMLImageElementImpl *>(innerNode.handle());
+ HTMLImageElementImpl *i = static_cast<HTMLImageElementImpl *>(innerNode);
if (i) {
KMultipleDrag *mdrag = new KMultipleDrag( d->m_view->viewport());
mdrag->addDragObject(new QImageDrag(i->currentImage(), 0L));
bool shiftPressed = (mouse->state() & ShiftButton);
// Image map
- if (!innerNode.isNull() && innerNode.elementId() == ID_IMG) {
- HTMLImageElementImpl *i = static_cast<HTMLImageElementImpl *>(innerNode.handle());
+ if (innerNode && innerNode->id() == ID_IMG) {
+ HTMLImageElementImpl *i = static_cast<HTMLImageElementImpl *>(innerNode);
if (i && i->isServerMap()) {
khtml::RenderObject *r = i->renderer();
if(r) {
#else
QMouseEvent *mouse = event->qmouseEvent();
- DOM::Node innerNode = event->innerNode();
+ NodeImpl *innerNode = event->innerNode();
- if (mouse->state() != LeftButton || !innerNode.handle() || !innerNode.handle()->renderer() ||
- !innerNode.handle()->renderer()->shouldSelect())
+ if (mouse->state() != LeftButton || !innerNode || !innerNode->renderer() ||
+ !innerNode->renderer()->shouldSelect())
return;
// handle making selection
- VisiblePosition pos(innerNode.handle()->renderer()->positionForCoordinates(event->x(), event->y()));
+ VisiblePosition pos(innerNode->renderer()->positionForCoordinates(event->x(), event->y()));
// Don't modify the selection if we're not on a node.
if (pos.isNull())
&& d->m_dragStartPos.y() == event->qmouseEvent()->y()
&& d->m_selection.isRange()) {
Selection selection;
- NodeImpl *node = event->innerNode().handle();
+ NodeImpl *node = event->innerNode();
if (node && node->isContentEditable() && node->renderer()) {
VisiblePosition pos = node->renderer()->positionForCoordinates(event->x(), event->y());
selection.moveTo(pos);
#endif
-QVariant KHTMLPart::executeScript(QString filename, int baseLine, const DOM::Node &n, const QString &script)
+QVariant KHTMLPart::executeScript(QString filename, int baseLine, NodeImpl *n, const QString &script)
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "executeScript: filename=" << filename << " baseLine=" << baseLine << " script=" << script << endl;
#endif
+#if !KHTML_NO_CPLUSPLUS_DOM
+
void KHTMLPart::setActiveNode(const DOM::Node &node)
{
if (!d->m_doc || !d->m_view)
return DOM::Node(d->m_doc?d->m_doc->focusNode():0);
}
+#endif
+
DOM::EventListener *KHTMLPart::createHTMLEventListener( QString code, NodeImpl *node )
{
KJSProxy *proxy = jScript();
TriState state = falseTriState;
CSSMutableStyleDeclarationImpl *mutableStyle = style->makeMutable();
- CSSStyleDeclaration protectQueryStyle(mutableStyle);
+ SharedPtr<CSSStyleDeclarationImpl> protectQueryStyle(mutableStyle);
if (!d->m_selection.isRange()) {
NodeImpl *nodeToRemove;
CSSMutableStyleDeclarationImpl *mutableStyle = style->makeMutable();
- CSSStyleDeclaration protectSelectionStyle(selectionStyle);
- CSSStyleDeclaration protectQueryStyle(mutableStyle);
+ SharedPtr<CSSStyleDeclarationImpl> protectSelectionStyle(selectionStyle);
+ SharedPtr<CSSStyleDeclarationImpl> protectQueryStyle(mutableStyle);
bool match = true;
QValueListConstIterator<CSSProperty> end;
virtual void showError(KIO::Job* job);
#endif
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* Returns a reference to the DOM HTML document (for non-HTML documents, returns null)
*/
*/
DOM::Node activeNode() const;
+#endif
+
/**
* Returns a pointer to the @ref KParts::BrowserExtension.
*/
* @deprecated, use the one below.
*/
QVariant executeScript( const QString &script, bool forceUserGesture = false );
+
/**
* Same as above except the Node parameter specifying the 'this' value.
*/
+#if !KHTML_NO_CPLUSPLUS_DOM
QVariant executeScript( const DOM::Node &n, const QString &script, bool forceUserGesture = false );
+#endif
+ QVariant executeScript( DOM::NodeImpl *n, const QString &script, bool forceUserGesture = false );
/**
* Enables or disables Drag'n'Drop support. A drag operation is started if
virtual void tokenizerProcessedData() {};
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* Returns the @p Node currently under the mouse
*/
DOM::Node nodeUnderMouse() const;
+#endif
+
/**
* @internal
*/
*/
void selectionChanged();
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* This signal is emitted when an element retrieves the
* keyboard focus. Note that the signal argument can be
*/
void nodeActivated(const DOM::Node &);
+#endif
+
public:
/**
*/
virtual void khtmlDrawContentsEvent( khtml::DrawContentsEvent * );
- void selectClosestWordFromMouseEvent(QMouseEvent *mouse, DOM::Node &innerNode, int x, int y);
+ void selectClosestWordFromMouseEvent(QMouseEvent *mouse, DOM::NodeImpl *innerNode, int x, int y);
#if !APPLE_CHANGES
/**
public slots:
+#if !KHTML_NO_CPLUSPLUS_DOM
+
/**
* Sets the focussed node of the document to the specified node. If the node is a form control, the control will
* receive focus in the same way that it would if the user had clicked on it or tabbed to it with the keyboard. For
*/
void setActiveNode(const DOM::Node &node);
+#endif
+
/**
* Stops all animated images on the current and child pages
*/
virtual void clear();
- bool scheduleScript( const DOM::Node &n, const QString& script);
+ bool scheduleScript( DOM::NodeImpl *n, const QString& script);
QVariant executeScheduledScript();
void disconnectChild(const khtml::ChildFrame *) const;
bool checkLinkSecurity(const KURL &linkURL,const QString &message = QString::null, const QString &button = QString::null);
- QVariant executeScript(QString filename, int baseLine, const DOM::Node &n, const QString &script);
+ QVariant executeScript(QString filename, int baseLine, DOM::NodeImpl *n, const QString &script);
void cancelRedirection(bool newLoadInProgress = false);
QString m_sheetUsed;
long m_cacheId;
QString scheduledScript;
- DOM::Node scheduledScriptNode;
+ khtml::SharedPtr<DOM::NodeImpl> scheduledScriptNode;
KJSProxy *m_jscript;
KLibrary *m_kjs_lib;
SubmitForm *m_submitForm;
bool m_bMousePressed;
- DOM::Node m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
+ khtml::SharedPtr<DOM::NodeImpl> m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
khtml::ETextGranularity m_selectionGranularity;
bool m_beganSelectingText;
underMouse = 0;
linkPressed = false;
useSlowRepaints = false;
- dragTarget = 0;
+ dragTarget.reset();
borderTouched = false;
#if !APPLE_CHANGES
#ifndef KHTML_NO_SCROLLBARS
// after all layout has been completed.
QPtrList<RenderObject::RepaintInfo>* repaintRects;
- Node dragTarget;
+ SharedPtr<NodeImpl> dragTarget;
};
#ifndef QT_NO_TOOLTIP
d->mousePressed = false;
}
#endif
+#if !KHTML_NO_CPLUSPLUS_DOM
emit m_part->nodeActivated(mev.innerNode.get());
+#endif
}
}
// single and double-click events as separate (only the detail, i.e. number of clicks differs)
// In other words an even detail value for a mouse click event means a double click, and an
// odd detail value means a single click
- bool swallowEvent = dispatchMouseEvent(EventImpl::MOUSEDOWN_EVENT,mev.innerNode.handle(),true,
+ bool swallowEvent = dispatchMouseEvent(EventImpl::MOUSEDOWN_EVENT,mev.innerNode.get(),true,
d->clickCount,_mouse,true,DOM::NodeImpl::MouseDblClick);
if (!swallowEvent) {
- khtml::MouseDoubleClickEvent event( _mouse, xm, ym, mev.url, mev.target, mev.innerNode );
+ khtml::MouseDoubleClickEvent event( _mouse, xm, ym, mev.url, mev.target, mev.innerNode.get() );
QApplication::sendEvent( m_part, &event );
// ###
DOM::NodeImpl::MouseEvent mev( _ce->state(), DOM::NodeImpl::MouseMove ); // ### not a mouse event!
m_part->xmlDocImpl()->prepareMouseEvent( xm, ym, &mev );
- NodeImpl *targetNode = mev.innerNode.handle();
+ NodeImpl *targetNode = mev.innerNode.get();
if (targetNode && targetNode->renderer() && targetNode->renderer()->isWidget()) {
int absx = 0;
int absy = 0;
viewportToContents(loc.x(), loc.y(), xm, ym);
DOM::NodeImpl::MouseEvent mev(0, DOM::NodeImpl::MouseMove);
m_part->xmlDocImpl()->prepareMouseEvent(true, xm, ym, &mev);
- DOM::Node newTarget = mev.innerNode.get();
+ NodeImpl *newTarget = mev.innerNode.get();
// Drag events should never go to text nodes (following IE, and proper mouseover/out dispatch)
- if (newTarget.nodeType() == Node::TEXT_NODE) {
- newTarget = newTarget.parentNode();
+ if (newTarget->isTextNode()) {
+ newTarget = newTarget->parentNode();
}
if (d->dragTarget != newTarget) {
// note this ordering is explicitly chosen to match WinIE
- if (!newTarget.isNull()) {
- accept = dispatchDragEvent(EventImpl::DRAGENTER_EVENT, newTarget.handle(), loc, clipboard);
+ if (newTarget) {
+ accept = dispatchDragEvent(EventImpl::DRAGENTER_EVENT, newTarget, loc, clipboard);
}
if (!d->dragTarget.isNull()) {
- dispatchDragEvent(EventImpl::DRAGLEAVE_EVENT, d->dragTarget.handle(), loc, clipboard);
+ dispatchDragEvent(EventImpl::DRAGLEAVE_EVENT, d->dragTarget.get(), loc, clipboard);
}
- } else if (!newTarget.isNull()) {
- accept = dispatchDragEvent(EventImpl::DRAGOVER_EVENT, newTarget.handle(), loc, clipboard);
+ } else if (newTarget) {
+ accept = dispatchDragEvent(EventImpl::DRAGOVER_EVENT, newTarget, loc, clipboard);
}
- d->dragTarget = newTarget;
+ d->dragTarget.reset(newTarget);
return accept;
}
void KHTMLView::cancelDragAndDrop(const QPoint &loc, DOM::ClipboardImpl *clipboard)
{
if (!d->dragTarget.isNull()) {
- dispatchDragEvent(EventImpl::DRAGLEAVE_EVENT, d->dragTarget.handle(), loc, clipboard);
+ dispatchDragEvent(EventImpl::DRAGLEAVE_EVENT, d->dragTarget.get(), loc, clipboard);
}
- d->dragTarget = 0;
+ d->dragTarget.reset();
}
bool KHTMLView::performDragAndDrop(const QPoint &loc, DOM::ClipboardImpl *clipboard)
{
bool accept = false;
if (!d->dragTarget.isNull()) {
- accept = dispatchDragEvent(EventImpl::DROP_EVENT, d->dragTarget.handle(), loc, clipboard);
+ accept = dispatchDragEvent(EventImpl::DROP_EVENT, d->dragTarget.get(), loc, clipboard);
}
- d->dragTarget = 0;
+ d->dragTarget.reset();
return accept;
}
}
// Set focus node on the document
m_part->xmlDocImpl()->setFocusNode(newFocusNode);
- emit m_part->nodeActivated(Node(newFocusNode));
+#if !KHTML_NO_CPLUSPLUS_DOM
+ emit m_part->nodeActivated(newFocusNode);
+#endif
#if 0
if (newFocusNode) {
+ (DOMCounter *)_counterWithImpl:(CounterImpl *)impl;
@end
-static inline int getPropertyID(NSString *string)
-{
- //use a fixed sized buffer to avoid malloc() allocations done by -[NSString UTF8String]
- static char buffer[1024];
- BOOL success = CFStringGetCString((CFStringRef)string, buffer, 1023, kCFStringEncodingUTF8);
-
- // CFStringGetCString returns false if conversion isn't possible
- // (due to conversion error, or not enough space in the provided buffer)
- // fall back to UTF8String instead
- if (!success) {
- const char *s = [string UTF8String];
- return DOM::getPropertyID(s, strlen(s));
- }
-
- return DOM::getPropertyID(buffer, strlen(buffer));
-}
-
//------------------------------------------------------------------------------------------
// DOMStyleSheet
- (DOMCSSRuleList *)cssRules
{
- return [DOMCSSRuleList _ruleListWithImpl:[self _CSSStyleSheetImpl]->cssRules().handle()];
+ return [DOMCSSRuleList _ruleListWithImpl:[self _CSSStyleSheetImpl]->cssRules()];
}
- (unsigned long)insertRule:(NSString *)rule :(unsigned long)index
- (NSString *)getPropertyValue:(NSString *)propertyName
{
- int propid = getPropertyID(propertyName);
- if (!propid)
- return nil;
- return [self _styleDeclarationImpl]->getPropertyValue(propid);
+ return [self _styleDeclarationImpl]->getPropertyValue(propertyName);
}
- (DOMCSSValue *)getPropertyCSSValue:(NSString *)propertyName
{
- int propid = getPropertyID(propertyName);
- if (!propid)
- return nil;
- return [DOMCSSValue _valueWithImpl:[self _styleDeclarationImpl]->getPropertyCSSValue(propid)];
+ return [DOMCSSValue _valueWithImpl:[self _styleDeclarationImpl]->getPropertyCSSValue(propertyName)];
}
- (NSString *)removeProperty:(NSString *)propertyName
{
- int propid = getPropertyID(propertyName);
- if (!propid)
- return nil;
int exceptionCode = 0;
- DOMString result = [self _styleDeclarationImpl]->removeProperty(propid, exceptionCode);
+ DOMString result = [self _styleDeclarationImpl]->removeProperty(propertyName, exceptionCode);
raiseOnDOMError(exceptionCode);
return result;
}
- (NSString *)getPropertyPriority:(NSString *)propertyName
{
- int propid = getPropertyID(propertyName);
- if (!propid)
- return nil;
- if ([self _styleDeclarationImpl]->getPropertyPriority(propid))
- return @"important";
- else
- return @"";
+ return [self _styleDeclarationImpl]->getPropertyPriority(propertyName);
}
- (void)setProperty:(NSString *)propertyName :(NSString *)value :(NSString *)priority
{
- int propid = getPropertyID(propertyName);
- if (!propid)
- return;
- bool important = strcasecmp(DOMString(priority), "important") == 0;
int exceptionCode;
- [self _styleDeclarationImpl]->setProperty(propid, value, important, exceptionCode);
+ [self _styleDeclarationImpl]->setProperty(propertyName, value, priority, exceptionCode);
raiseOnDOMError(exceptionCode);
}
- (void)setCssText:(NSString *)cssText
{
- ERROR("unimplemented");
+ [self _valueImpl]->setCssText(cssText);
}
- (unsigned short)cssValueType
@class DOMRect;
@class DOMRGBColor;
+extern NSString * const DOMCSSException;
+
+enum {
+ //
+ // CSS exception codes
+ //
+ DOM_CSS_SYNTAX_ERR = 0,
+ DOM_CSS_INVALID_MODIFICATION_ERR = 1,
+};
+
@interface DOMCSSRuleList : DOMObject
- (unsigned long)length;
- (DOMCSSRule *)item:(unsigned long)index;
- (void)setInnerHTML:(NSString *)innerHTML
{
- [self _HTMLElementImpl]->setInnerHTML(innerHTML);
+ int exception = 0;
+ [self _HTMLElementImpl]->setInnerHTML(innerHTML, exception);
+ raiseOnDOMError(exception);
}
- (NSString *)outerHTML
- (void)setOuterHTML:(NSString *)outerHTML
{
- [self _HTMLElementImpl]->setOuterHTML(outerHTML);
+ int exception = 0;
+ [self _HTMLElementImpl]->setOuterHTML(outerHTML, exception);
+ raiseOnDOMError(exception);
}
- (NSString *)innerText
- (void)setInnerText:(NSString *)innerText
{
- [self _HTMLElementImpl]->setInnerText(innerText);
+ int exception = 0;
+ [self _HTMLElementImpl]->setInnerText(innerText, exception);
+ raiseOnDOMError(exception);
}
-
- (NSString *)outerText
{
return [self _HTMLElementImpl]->outerText();
- (void)setOuterText:(NSString *)outerText
{
- [self _HTMLElementImpl]->setOuterText(outerText);
+ int exception = 0;
+ [self _HTMLElementImpl]->setOuterText(outerText, exception);
+ raiseOnDOMError(exception);
}
- (DOMHTMLCollection *)children
- (void)setLength:(long)length
{
- ASSERT_WITH_MESSAGE(0, "not implemented by khtml");
+ // FIXME: Not yet clear what to do about this one.
+ // There's some JavaScript-specific hackery in the JavaScript bindings for this.
+ //[self _selectElementImpl]->setLength(length);
}
- (DOMHTMLFormElement *)form
- (DOMHTMLElement *)insertRow:(long)index
{
int exceptioncode = 0;
- HTMLTableElementImpl *impl = static_cast<HTMLTableElementImpl *>([self _tableSectionElementImpl]->insertRow(index, exceptioncode));
+ HTMLElementImpl *impl = [self _tableSectionElementImpl]->insertRow(index, exceptioncode);
raiseOnDOMError(exceptioncode);
- return [DOMHTMLTableElement _tableElementWithImpl:impl];
+ return [DOMHTMLElement _elementWithImpl:impl];
}
- (void)deleteRow:(long)index
class CSSStyleSheetImpl;
class DocumentFragmentImpl;
class DocumentImpl;
+ class DocumentTypeImpl;
class ElementImpl;
class NodeFilterImpl;
class NodeImpl;
#import "DOMInternal.h"
-#import <dom/dom2_range.h>
-#import <dom/dom_exception.h>
-#import <dom/dom_string.h>
-#import <xml/dom_docimpl.h>
-#import <xml/dom_stringimpl.h>
+#import "css_stylesheet.h"
+#import "dom2_range.h"
+#import "dom_exception.h"
+#import "dom_string.h"
+#import "dom_docimpl.h"
#import "kjs_proxy.h"
#import <JavaScriptCore/runtime_root.h>
#import <JavaScriptCore/WebScriptObjectPrivate.h>
-//#import "kjs_dom.h"
-// We can't include kjs_dom.h here because of ObjC and C++ namespace compiler craziness.
-// kjs_dom.h:169: error: statically allocated instance of Objective-C class `DOMImplementation'
-// Declaring getDOMNode directly instead.
-namespace KJS {
- Value getDOMNode(ExecState *exec, const DOM::Node &n);
-}
-
+using DOM::CSSException;
using DOM::DOMString;
using DOM::DOMStringImpl;
+using DOM::NodeImpl;
using DOM::RangeException;
+using KJS::ExecState;
+using KJS::Interpreter;
+using KJS::ObjectImp;
+
+using KJS::Bindings::RootObject;
+
+// FIXME: Can't include kjs_dom.h because of name conflict (for the moment).
+// So re-declare this here.
+namespace KJS {
+ Value getDOMNode(ExecState *exec, const DOM::Node &n);
+};
+
//------------------------------------------------------------------------------------------
// Wrapping khtml implementation objects
NSString * const DOMException = @"DOMException";
NSString * const DOMRangeException = @"DOMRangeException";
+NSString * const DOMCSSException = @"DOMCSSException";
void raiseDOMException(int code)
{
ASSERT(code);
-
- NSString *name;
- if (code >= RangeException::_EXCEPTION_OFFSET) {
+
+ NSString *name = DOMException;
+
+ if (code >= RangeException::_EXCEPTION_OFFSET && code <= RangeException::_EXCEPTION_MAX) {
name = DOMRangeException;
code -= RangeException::_EXCEPTION_OFFSET;
+ } else if (code >= CSSException::_EXCEPTION_OFFSET && code <= CSSException::_EXCEPTION_MAX) {
+ name = DOMCSSException;
+ code -= CSSException::_EXCEPTION_OFFSET;
}
- else {
- name = DOMException;
- }
+
NSString *reason = [NSString stringWithFormat:@"*** Exception received from DOM API: %d", code];
NSException *exception = [NSException exceptionWithName:name reason:reason
userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:code] forKey:name]];
// Extract the DOM::NodeImpl from the ObjectiveC wrapper.
DOMNode *n = (DOMNode *)self;
- DOM::NodeImpl *nodeImpl = [n _nodeImpl];
+ NodeImpl *nodeImpl = [n _nodeImpl];
// Dig up Interpreter and ExecState.
KHTMLPart *part = nodeImpl->getDocument()->part();
- KJS::Interpreter *interpreter = KJSProxy::proxy(part)->interpreter();
- KJS::ExecState *exec = interpreter->globalExec();
+ Interpreter *interpreter = KJSProxy::proxy(part)->interpreter();
+ ExecState *exec = interpreter->globalExec();
// Get (or create) a cached JS object for the DOM node.
- KJS::ObjectImp *scriptImp = static_cast<KJS::ObjectImp *>(KJS::getDOMNode (exec, DOM::Node (nodeImpl)).imp());
+ ObjectImp *scriptImp = static_cast<ObjectImp *>(getDOMNode(exec, nodeImpl).imp());
+
+ const RootObject *executionContext = KWQ(part)->bindingRootObject();
- const KJS::Bindings::RootObject *executionContext = KWQ(part)->bindingRootObject();
[self _initializeWithObjectImp:scriptImp originExecutionContext:executionContext executionContext:executionContext];
}
@end
-
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "kjs_binding.h"
#import "kjs_dom.h"
+#import "dom_nodeimpl.h"
+
#import "DOM.h"
#import "DOMInternal.h"
namespace KJS {
-void *ScriptInterpreter::createObjcInstanceForValue (ExecState *exec, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
+void *ScriptInterpreter::createObjcInstanceForValue(ExecState *exec, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
{
if (value.inherits(&DOMNode::info)) {
DOMNode *imp = static_cast<DOMNode *>(value.imp());
- DOM::Node node = imp->toNode();
-
- id newObjcNode = createObjCDOMNode(node.handle());
- ObjectImp *scriptImp = static_cast<ObjectImp *>(getDOMNode(exec, node).imp());
-
- [newObjcNode _initializeWithObjectImp:scriptImp originExecutionContext:origin executionContext:current];
-
+ id newObjcNode = createObjCDOMNode(imp->toNode().handle());
+ [newObjcNode _initializeWithObjectImp:imp originExecutionContext:origin executionContext:current];
return newObjcNode;
}
return 0;
if (m_renderer->isCanvas()) {
if ([attributeName isEqualToString: @"AXLinkUIElements"]) {
- NSMutableArray* links = [NSMutableArray arrayWithCapacity: 32];
- HTMLCollection coll(m_renderer->document(), HTMLCollectionImpl::DOC_LINKS);
- if (coll.isNull())
- return links;
- Node curr = coll.firstItem();
- while (!curr.isNull()) {
- RenderObject* obj = curr.handle()->renderer();
+ NSMutableArray *links = [NSMutableArray arrayWithCapacity: 32];
+ HTMLCollectionImpl *coll = new HTMLCollectionImpl(m_renderer->document(), HTMLCollectionImpl::DOC_LINKS);
+ coll->ref();
+ NodeImpl *curr = coll->firstItem();
+ while (curr) {
+ RenderObject *obj = curr->renderer();
if (obj) {
KWQAccObject *axobj = obj->document()->getAccObjectCache()->accObject(obj);
ASSERT([[axobj role] isEqualToString:@"AXLink"]);
if (![axobj accessibilityIsIgnored])
[links addObject: axobj];
}
- curr = coll.nextItem();
+ curr = coll->nextItem();
}
+ coll->deref();
return links;
}
- else if ([attributeName isEqualToString: @"AXLoaded"])
+ if ([attributeName isEqualToString: @"AXLoaded"])
return [NSNumber numberWithBool: (!m_renderer->document()->tokenizer())];
- else if ([attributeName isEqualToString: @"AXLayoutCount"])
+ if ([attributeName isEqualToString: @"AXLayoutCount"])
return [NSNumber numberWithInt: (static_cast<RenderCanvas*>(m_renderer)->view()->layoutCount())];
}
NSRect visibleSelectionRect() const;
void centerSelectionInVisibleArea() const;
NSImage *selectionImage() const;
- NSImage *snapshotDragImage(DOM::Node node, NSRect *imageRect, NSRect *elementRect) const;
+ NSImage *snapshotDragImage(DOM::NodeImpl *node, NSRect *imageRect, NSRect *elementRect) const;
NSFont *fontForSelection(bool *hasMultipleFonts) const;
NSDictionary *fontAttributesForSelectionStart() const;
WebScriptObject *_windowScriptObject;
NPObject *_windowScriptNPObject;
- DOM::Node _dragSrc; // element that may be a drag source, for the current mouse gesture
+ khtml::SharedPtr<DOM::NodeImpl> _dragSrc; // element that may be a drag source, for the current mouse gesture
bool _dragSrcIsLink;
bool _dragSrcIsImage;
bool _dragSrcInSelection;
bool _dragSrcIsDHTML;
KWQClipboard *_dragClipboard; // used on only the source side of dragging
- mutable DOM::Node _elementToDraw;
+ mutable khtml::SharedPtr<DOM::NodeImpl> _elementToDraw;
DOM::Range m_markedTextRange;
bool m_markedTextUsesUnderlines;
KWQ(this)->_completed.call(arg);
}
+#if !KHTML_NO_CPLUSPLUS_DOM
+
void KHTMLPart::nodeActivated(const Node &)
{
}
+#endif
+
bool KHTMLPart::openURL(const KURL &URL)
{
ASSERT_NOT_REACHED();
, _bindingRoot(0)
, _windowScriptObject(0)
, _windowScriptNPObject(0)
- , _dragSrc(0)
, _dragClipboard(0)
- , _elementToDraw(0)
, m_markedTextUsesUnderlines(false)
, m_windowHasFocus(false)
{
}
// topNode defines the whole range we want to operate on
- Node topNode(editableNodeImpl->rootEditableElement());
+ NodeImpl *topNode = editableNodeImpl->rootEditableElement();
searchRange.setEndAfter(topNode);
// Make sure start of searchRange is not in the middle of a word. Jumping back a char and then
// We go to the end of our first range instead of the start of it, just to be sure
// we don't get foiled by any word boundary problems at the start. It means we might
// do a tiny bit more searching.
- Node searchEndAfterWrapNode = it.range().endContainer();
+ NodeImpl *searchEndAfterWrapNode = it.range().endContainer().handle();
long searchEndAfterWrapOffset = it.range().endOffset();
while (1) {
NodeImpl *node = xmlDocImpl()->focusNode();
if (node == 0) {
- node = d->m_mousePressNode.handle();
+ node = d->m_mousePressNode.get();
}
if (node != 0) {
fillWithRed = false; // Transparent, don't fill with red.
else if (_drawSelectionOnly)
fillWithRed = false; // Selections are transparent, don't fill with red.
- else if (_elementToDraw != 0)
+ else if (_elementToDraw.notNull())
fillWithRed = false; // Element images are transparent, don't fill with red.
else
fillWithRed = true;
if (renderer()) {
// _elementToDraw is used to draw only one element
- RenderObject *eltRenderer = (_elementToDraw != 0) ? _elementToDraw.handle()->renderer() : 0;
+ RenderObject *eltRenderer = _elementToDraw.notNull() ? _elementToDraw->renderer() : 0;
renderer()->layer()->paint(p, rect, _drawSelectionOnly, eltRenderer);
#if APPLE_CHANGES
d->m_doc = doc;
d->m_doc->ref();
- d->m_mousePressNode = Node(mousePressNode);
+ d->m_mousePressNode.reset(mousePressNode);
Decoder *decoder = doc->decoder();
if (decoder) {
// Careful that the drag starting logic stays in sync with eventMayStartDrag()
_mouseDownMayStartDrag = singleClick;
- d->m_mousePressNode = event->innerNode();
+ d->m_mousePressNode.reset(event->innerNode());
if (!passWidgetMouseDownEventToWidget(event)) {
// We don't do this at the start of mouse down handling (before calling into WebCore),
bool KWQKHTMLPart::passWidgetMouseDownEventToWidget(khtml::MouseEvent *event)
{
// Figure out which view to send the event to.
- RenderObject *target = event->innerNode().handle() ? event->innerNode().handle()->renderer() : 0;
+ RenderObject *target = event->innerNode() ? event->innerNode()->renderer() : 0;
if (!target)
return false;
// returns if we should continue "default processing", i.e., whether eventhandler canceled
bool KWQKHTMLPart::dispatchDragSrcEvent(int eventId, const QPoint &loc) const
{
- bool noDefaultProc = d->m_view->dispatchDragEvent(eventId, _dragSrc.handle(), loc, _dragClipboard);
+ bool noDefaultProc = d->m_view->dispatchDragEvent(eventId, _dragSrc.get(), loc, _dragClipboard);
return !noDefaultProc;
}
RenderObject::NodeInfo nodeInfo(true, false);
renderer()->layer()->hitTest(nodeInfo, mouseDownX, mouseDownY);
bool srcIsDHTML;
- Node possibleSrc = nodeInfo.innerNode()->renderer()->draggableNode(DHTMLFlag, UAFlag, mouseDownX, mouseDownY, srcIsDHTML);
- return !possibleSrc.isNull();
+ return nodeInfo.innerNode()->renderer()->draggableNode(DHTMLFlag, UAFlag, mouseDownX, mouseDownY, srcIsDHTML);
}
void KWQKHTMLPart::khtmlMouseMoveEvent(MouseMoveEvent *event)
// try to find an element that wants to be dragged
RenderObject::NodeInfo nodeInfo(true, false);
renderer()->layer()->hitTest(nodeInfo, _mouseDownX, _mouseDownY);
- _dragSrc = nodeInfo.innerNode()->renderer()->draggableNode(_dragSrcMayBeDHTML, _dragSrcMayBeUA, _mouseDownX, _mouseDownY, _dragSrcIsDHTML);
+ _dragSrc.reset(nodeInfo.innerNode()->renderer()->draggableNode(_dragSrcMayBeDHTML, _dragSrcMayBeUA, _mouseDownX, _mouseDownY, _dragSrcIsDHTML));
if (_dragSrc.isNull()) {
_mouseDownMayStartDrag = false; // no element is draggable
} else {
// WebKit will generate the default, the element doesn't override.
if (_dragSrcIsDHTML) {
int srcX, srcY;
- _dragSrc.handle()->renderer()->absolutePosition(srcX, srcY);
- _dragClipboard->setDragImageElement(_dragSrc.handle(), QPoint(_mouseDownX - srcX, _mouseDownY - srcY));
+ _dragSrc->renderer()->absolutePosition(srcX, srcY);
+ _dragClipboard->setDragImageElement(_dragSrc.get(), QPoint(_mouseDownX - srcX, _mouseDownY - srcY));
}
_mouseDownMayStartDrag = dispatchDragSrcEvent(EventImpl::DRAGSTART_EVENT, QPoint(_mouseDownWinX, _mouseDownWinY));
if (!_mouseDownMayStartDrag) {
// something failed to start the drag, cleanup
freeClipboard();
- _dragSrc = 0;
+ _dragSrc.reset();
}
}
dispatchDragSrcEvent(EventImpl::DRAGEND_EVENT, loc);
}
freeClipboard();
- _dragSrc = 0;
+ _dragSrc.reset();
}
// Returns whether caller should continue with "the default processing", which is the same as
prepareForUserAction();
_mouseDownView = nil;
- _dragSrc = 0;
+ _dragSrc.reset();
NSEvent *oldCurrentEvent = _currentEvent;
_currentEvent = KWQRetain(event);
mev.innerNode.get(), true, 0, &qev, true, NodeImpl::MousePress);
if (!swallowEvent && !isPointInsideSelection(xm, ym) &&
([_bridge selectWordBeforeMenuEvent] || [_bridge isEditable] || mev.innerNode->isContentEditable())) {
- DOM::Node node(mev.innerNode.get());
- selectClosestWordFromMouseEvent(&qev, node, xm, ym);
+ selectClosestWordFromMouseEvent(&qev, mev.innerNode.get(), xm, ym);
}
ASSERT(_currentEvent == event);
static ElementImpl *listParent(ElementImpl *item)
{
// Ick! Avoid use of item->id() which confuses ObjC++.
- unsigned short _id = Node(item).elementId();
+ unsigned short _id = item->identifier();
while (_id != ID_UL && _id != ID_OL) {
item = static_cast<ElementImpl *>(item->parentNode());
if (!item)
break;
- _id = Node(item).elementId();
+ _id = item->identifier();
}
return item;
}
static NodeImpl* isTextFirstInListItem(NodeImpl *e)
{
- if (Node(e).nodeType() != Node::TEXT_NODE)
+ if (!e->isTextNode())
return 0;
NodeImpl* par = e->parentNode();
while (par) {
if (par->firstChild() != e)
return 0;
- if (Node(par).elementId() == ID_LI)
+ if (par->identifier() == ID_LI)
return par;
e = par;
par = par->parentNode();
QValueList<ListItemInfo> listItemLocations;
float maxMarkerWidth = 0;
- Node n = _startNode;
+ NodeImpl *n = _startNode;
// If the first item is the entire text of a list item, use the list item node as the start of the
// selection, not the text node. The user's intent was probably to select the list.
- if (n.nodeType() == Node::TEXT_NODE && startOffset == 0) {
+ if (n->isTextNode() && startOffset == 0) {
NodeImpl *startListNode = isTextFirstInListItem(_startNode);
if (startListNode){
_startNode = startListNode;
}
}
- while (!n.isNull()) {
- RenderObject *renderer = n.handle()->renderer();
+ while (n) {
+ RenderObject *renderer = n->renderer();
if (renderer) {
RenderStyle *style = renderer->style();
NSFont *font = style->font().getNSFont();
bool needSpace = pendingStyledSpace != nil;
- if (n.nodeType() == Node::TEXT_NODE) {
+ if (n->isTextNode()) {
if (hasNewLine) {
addedSpace = true;
needSpace = false;
hasNewLine = false;
}
QString text;
- QString str = n.nodeValue().string();
+ QString str = n->nodeValue().string();
int start = (n == _startNode) ? startOffset : -1;
int end = (n == endNode) ? endOffset : -1;
if (renderer->isText()) {
} else {
// This is our simple HTML -> ASCII transformation:
QString text;
- unsigned short _id = n.elementId();
+ NodeImpl::Id _id = n->identifier();
switch(_id) {
case ID_A:
// Note the start of the <a> element. We will add the NSLinkAttributeName
// attribute to the attributed string when navigating to the next sibling
// of this node.
linkStartLocation = [result length];
- linkStartNode = static_cast<ElementImpl*>(n.handle());
+ linkStartNode = static_cast<ElementImpl*>(n);
break;
case ID_BR:
case ID_LI:
{
QString listText;
- ElementImpl *itemParent = listParent(static_cast<ElementImpl *>(n.handle()));
+ ElementImpl *itemParent = listParent(static_cast<ElementImpl *>(n));
if (!hasNewLine)
listText += '\n';
hasNewLine = true;
- listItems.append(static_cast<ElementImpl*>(n.handle()));
+ listItems.append(static_cast<ElementImpl*>(n));
ListItemInfo info;
info.start = [result length];
info.end = 0;
[pendingStyledSpace release];
pendingStyledSpace = nil;
}
- NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<ElementImpl *>(n.handle()));
+ NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<ElementImpl *>(n));
NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
NSAttributedString *iString = [NSAttributedString attributedStringWithAttachment:attachment];
[result appendAttributedString: iString];
if (n == endNode)
break;
- Node next = n.firstChild();
- if (next.isNull()){
- next = n.nextSibling();
+ NodeImpl *next = n->firstChild();
+ if (!next) {
+ next = n->nextSibling();
}
- while (next.isNull() && !n.parentNode().isNull()) {
+ while (!next && n->parentNode()) {
QString text;
- n = n.parentNode();
+ n = n->parentNode();
if (n == endNode)
break;
- next = n.nextSibling();
+ next = n->nextSibling();
- unsigned short _id = n.elementId();
+ NodeImpl::Id _id = n->identifier();
switch(_id) {
case ID_A:
// End of a <a> element. Create an attributed string NSLinkAttributeName attribute
// for the range of the link. Note that we create the attributed string from the DOM, which
// will have corrected any illegally nested <a> elements.
- if (linkStartNode && n.handle() == linkStartNode){
+ if (linkStartNode && n == linkStartNode){
DOMString href = parseURL(linkStartNode->getAttribute(ATTR_HREF));
KURL kURL = KWQ(linkStartNode->getDocument()->part())->completeURL(href.string());
{
int i, count = listItems.count();
for (i = 0; i < count; i++){
- if (listItems.at(i) == n.handle()){
+ if (listItems.at(i) == n){
listItemLocations[i].end = [result length];
break;
}
return result;
}
-NSImage *KWQKHTMLPart::snapshotDragImage(DOM::Node node, NSRect *imageRect, NSRect *elementRect) const
+NSImage *KWQKHTMLPart::snapshotDragImage(DOM::NodeImpl *node, NSRect *imageRect, NSRect *elementRect) const
{
- RenderObject *renderer = node.handle()->renderer();
+ RenderObject *renderer = node->renderer();
if (!renderer) {
return nil;
}
QRect topLevelRect;
NSRect paintingRect = renderer->paintingRootRect(topLevelRect);
- _elementToDraw = node; // invoke special sub-tree drawing mode
+ _elementToDraw.reset(node); // invoke special sub-tree drawing mode
NSImage *result = imageFromRect(paintingRect);
renderer->updateDragState(false);
- _elementToDraw = 0;
+ _elementToDraw.reset();
if (elementRect) {
*elementRect = topLevelRect;
DOM::NodeImpl *KWQKHTMLPart::mousePressNode()
{
- return d->m_mousePressNode.handle();
+ return d->m_mousePressNode.get();
}
using DOM::HTMLGenericFormElementImpl;
using DOM::HTMLImageElementImpl;
using DOM::HTMLInputElementImpl;
-using DOM::Node;
using DOM::NodeImpl;
using DOM::Position;
using DOM::Range;
if (!window)
return;
- DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(window->part()->document().handle());
+ DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(window->part()->xmlDocImpl());
if (doc)
doc->updateRendering();
}
NSString *documentTypeString = nil;
DOM::DocumentImpl *doc = _part->xmlDocImpl();
if (doc) {
- DocumentTypeImpl *doctype = doc->doctype();
+ DocumentTypeImpl *doctype = doc->realDocType();
if (doctype) {
documentTypeString = doctype->toString().string().getNSString();
}