2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include "WebElement.h"
33 #include "WebDocument.h"
36 #include "RenderBoxModelObject.h"
37 #include "RenderObject.h"
38 #include <wtf/PassRefPtr.h>
40 #include "WebNamedNodeMap.h"
42 using namespace WebCore;
46 bool WebElement::isFormControlElement() const
48 return constUnwrap<Element>()->isFormControlElement();
51 bool WebElement::isTextFormControlElement() const
53 return constUnwrap<Element>()->isTextFormControl();
56 WebString WebElement::tagName() const
58 return constUnwrap<Element>()->tagName();
61 bool WebElement::hasTagName(const WebString& tagName) const
63 return equalIgnoringCase(constUnwrap<Element>()->tagName(),
64 tagName.operator String());
67 bool WebElement::hasAttribute(const WebString& attrName) const
69 return constUnwrap<Element>()->hasAttribute(attrName);
72 WebString WebElement::getAttribute(const WebString& attrName) const
74 return constUnwrap<Element>()->getAttribute(attrName);
77 bool WebElement::setAttribute(const WebString& attrName, const WebString& attrValue)
79 ExceptionCode exceptionCode = 0;
80 unwrap<Element>()->setAttribute(attrName, attrValue, exceptionCode);
81 return !exceptionCode;
84 WebNamedNodeMap WebElement::attributes() const
86 return WebNamedNodeMap(m_private->attributes());
89 WebString WebElement::innerText()
91 return unwrap<Element>()->innerText();
94 WebString WebElement::computeInheritedLanguage() const
96 return WebString(constUnwrap<Element>()->computeInheritedLanguage());
99 void WebElement::requestFullScreen()
101 #if ENABLE(FULLSCREEN_API)
102 unwrap<Element>()->webkitRequestFullScreen(Element::ALLOW_KEYBOARD_INPUT);
106 WebDocument WebElement::document() const
108 return WebDocument(constUnwrap<Element>()->document());
111 WebElement::WebElement(const PassRefPtr<Element>& elem)
116 WebElement& WebElement::operator=(const PassRefPtr<Element>& elem)
122 WebElement::operator PassRefPtr<Element>() const
124 return static_cast<Element*>(m_private.get());
127 } // namespace WebKit