Commit 6f17861a authored by weinig's avatar weinig
Browse files

Reviewed by Darin.

        Part one of patch for http://bugs.webkit.org/show_bug.cgi?id=13830
        Auto-generate JS DOM bindings for HTMLDocument and most of the rest
        of HTMLElement

        - Just the HTMLElement part.

        * bindings/js/kjs_html.cpp:
        (KJS::JSHTMLElement::getValueProperty):
        (KJS::JSHTMLElement::putValueProperty):
        * bindings/js/kjs_html.h:
        (KJS::JSHTMLElement::):
        * html/HTMLElement.idl:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ef9bbdef
2007-05-23 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Part one of patch for http://bugs.webkit.org/show_bug.cgi?id=13830
Auto-generate JS DOM bindings for HTMLDocument and most of the rest
of HTMLElement
- Just the HTMLElement part.
* bindings/js/kjs_html.cpp:
(KJS::JSHTMLElement::getValueProperty):
(KJS::JSHTMLElement::putValueProperty):
* bindings/js/kjs_html.h:
(KJS::JSHTMLElement::):
* html/HTMLElement.idl:
2007-05-22 Kevin McCullough <kmccullough@apple.com>
 
Reviewed by Darin.
......@@ -111,24 +111,9 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
}
/*
@begin JSHTMLElementPrototypeTable 0
@end
@begin HTMLElementTable 14
id KJS::JSHTMLElement::ElementId DontDelete
lang KJS::JSHTMLElement::ElementLang DontDelete
dir KJS::JSHTMLElement::ElementDir DontDelete
### isn't this "class" in the HTML spec?
className KJS::JSHTMLElement::ElementClassName DontDelete
innerHTML KJS::JSHTMLElement::ElementInnerHTML DontDelete
innerText KJS::JSHTMLElement::ElementInnerText DontDelete
outerHTML KJS::JSHTMLElement::ElementOuterHTML DontDelete
outerText KJS::JSHTMLElement::ElementOuterText DontDelete
# IE extension
children KJS::JSHTMLElement::ElementChildren DontDelete|ReadOnly
contentEditable KJS::JSHTMLElement::ElementContentEditable DontDelete
isContentEditable KJS::JSHTMLElement::ElementIsContentEditable DontDelete|ReadOnly
@begin HTMLElementTable 0
@end
@begin HTMLObjectElementTable 20
form KJS::JSHTMLElement::ObjectForm DontDelete|ReadOnly
......@@ -333,37 +318,7 @@ JSValue *JSHTMLElement::frameSetGetter(ExecState* exec, int token) const
JSValue *JSHTMLElement::getValueProperty(ExecState* exec, int token) const
{
// Check our set of generic properties first.
HTMLElement &element = *static_cast<HTMLElement*>(impl());
switch (token) {
case ElementId:
// iht.com relies on this value being "" when no id is present. Other browsers do this as well.
// So we use jsString() instead of jsStringOrNull() here.
return jsString(element.id());
case ElementLang:
return jsString(element.lang());
case ElementDir:
return jsString(element.dir());
case ElementClassName:
return jsString(element.className());
case ElementInnerHTML:
return jsString(element.innerHTML());
case ElementInnerText:
impl()->document()->updateLayoutIgnorePendingStylesheets();
return jsString(element.innerText());
case ElementOuterHTML:
return jsString(element.outerHTML());
case ElementOuterText:
return jsString(element.outerText());
case ElementChildren:
return getHTMLCollection(exec, element.children().get());
case ElementContentEditable:
return jsString(element.contentEditable());
case ElementIsContentEditable:
return jsBoolean(element.isContentEditable());
}
// Now check the properties specific to our element type.
// Check the properties specific to our element type.
const Accessors* access = accessors();
if (access && access->m_getter)
return (this->*(access->m_getter))(exec, token);
......@@ -526,41 +481,7 @@ void JSHTMLElement::frameSetSetter(ExecState* exec, int token, JSValue* value)
void JSHTMLElement::putValueProperty(ExecState* exec, int token, JSValue *value, int)
{
DOMExceptionTranslator exception(exec);
// Check our set of generic properties first.
HTMLElement &element = *static_cast<HTMLElement*>(impl());
switch (token) {
case ElementId:
element.setId(valueToStringWithNullCheck(exec, value));
return;
case ElementLang:
element.setLang(valueToStringWithNullCheck(exec, value));
return;
case ElementDir:
element.setDir(valueToStringWithNullCheck(exec, value));
return;
case ElementClassName:
element.setClassName(valueToStringWithNullCheck(exec, value));
return;
case ElementInnerHTML:
element.setInnerHTML(valueToStringWithNullCheck(exec, value), exception);
return;
case ElementInnerText:
element.setInnerText(valueToStringWithNullCheck(exec, value), exception);
return;
case ElementOuterHTML:
element.setOuterHTML(valueToStringWithNullCheck(exec, value), exception);
return;
case ElementOuterText:
element.setOuterText(valueToStringWithNullCheck(exec, value), exception);
return;
case ElementContentEditable:
element.setContentEditable(valueToStringWithNullCheck(exec, value));
return;
}
// Now check for properties that apply to a specific element type.
// Check for properties that apply to a specific element type.
const Accessors* access = accessors();
if (access && access->m_setter)
return (this->*(access->m_setter))(exec, token, value);
......
......@@ -79,11 +79,7 @@ namespace KJS {
ObjectDeclare, ObjectForm, ObjectCodeBase, ObjectCodeType, ObjectData,
ObjectName, ObjectStandby, ObjectTabIndex, ObjectUseMap, ObjectWidth, ObjectContentDocument, ObjectGetSVGDocument,
EmbedAlign, EmbedHeight, EmbedName, EmbedSrc, EmbedType, EmbedWidth, EmbedGetSVGDocument,
FrameSetCols, FrameSetRows,
GetContext,
ElementInnerHTML, ElementId, ElementDir, ElementLang,
ElementClassName, ElementInnerText, ElementChildren, ElementContentEditable,
ElementIsContentEditable, ElementOuterHTML, ElementOuterText
FrameSetCols, FrameSetRows
};
private:
static JSValue* framesetNameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
......
......@@ -1030,12 +1030,13 @@ void Element::stopUpdateFocusAppearanceTimer()
String Element::innerText() const
{
// We need to update layout, since plainText uses line boxes in the render tree.
document()->updateLayoutIgnorePendingStylesheets();
if (!renderer())
return textContent(true);
// We need to update layout, since plainText uses line boxes in the render tree.
document()->updateLayoutIgnorePendingStylesheets();
return plainText(rangeOfContents(const_cast<Element *>(this)).get());
return plainText(rangeOfContents(const_cast<Element*>(this)).get());
}
String Element::outerText() const
......
......@@ -4,7 +4,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Simon Hausmann <hausmann@kde.org>
* Copyright (C) 2003, 2006 Apple Computer, Inc.
* Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
* (C) 2006 Graham Dennis (graham.dennis@gmail.com)
*
* This library is free software; you can redistribute it and/or
......@@ -455,7 +455,6 @@ String HTMLAnchorElement::search() const
String HTMLAnchorElement::text() const
{
document()->updateLayoutIgnorePendingStylesheets();
return innerText();
}
......
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* This library is free software; you can redistribute it and/or
......@@ -21,16 +21,15 @@
module html {
interface [GenerateConstructor] HTMLElement : Element {
attribute [ConvertNullToNullString] DOMString title;
#if !defined(LANGUAGE_JAVASCRIPT)
// iht.com relies on id returning the empty string when no id is present.
// Other browsers do this as well. So we don't convert null to JS null.
attribute [ConvertNullToNullString] DOMString id;
attribute [ConvertNullToNullString] DOMString title;
attribute [ConvertNullToNullString] DOMString lang;
attribute [ConvertNullToNullString] DOMString dir;
attribute [ConvertNullToNullString] DOMString className;
// extensions
// Extensions
attribute [ConvertNullToNullString] DOMString innerHTML
setter raises(DOMException);
attribute [ConvertNullToNullString] DOMString innerText
......@@ -45,6 +44,7 @@ module html {
attribute [ConvertNullToNullString] DOMString contentEditable;
readonly attribute boolean isContentEditable;
#if defined(LANGUAGE_OBJECTIVE_C)
readonly attribute DOMString titleDisplayString;
#endif
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment