Changeset 21683 in webkit


Ignore:
Timestamp:
May 23, 2007 4:32:06 PM (17 years ago)
Author:
weinig
Message:

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:
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r21682 r21683  
     12007-05-23  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        Part one of patch for http://bugs.webkit.org/show_bug.cgi?id=13830
     6        Auto-generate JS DOM bindings for HTMLDocument and most of the rest
     7        of HTMLElement
     8
     9        - Just the HTMLElement part.
     10
     11        * bindings/js/kjs_html.cpp:
     12        (KJS::JSHTMLElement::getValueProperty):
     13        (KJS::JSHTMLElement::putValueProperty):
     14        * bindings/js/kjs_html.h:
     15        (KJS::JSHTMLElement::):
     16        * html/HTMLElement.idl:
     17
    1182007-05-22  Kevin McCullough  <kmccullough@apple.com>
    219
  • trunk/WebCore/bindings/js/kjs_html.cpp

    r21681 r21683  
    112112
    113113/*
    114 
    115114@begin JSHTMLElementPrototypeTable 0
    116115@end
    117 
    118 @begin HTMLElementTable 14
    119   id            KJS::JSHTMLElement::ElementId     DontDelete
    120   lang          KJS::JSHTMLElement::ElementLang   DontDelete
    121   dir           KJS::JSHTMLElement::ElementDir    DontDelete
    122 ### isn't this "class" in the HTML spec?
    123   className     KJS::JSHTMLElement::ElementClassName DontDelete
    124   innerHTML     KJS::JSHTMLElement::ElementInnerHTML DontDelete
    125   innerText     KJS::JSHTMLElement::ElementInnerText DontDelete
    126   outerHTML     KJS::JSHTMLElement::ElementOuterHTML DontDelete
    127   outerText     KJS::JSHTMLElement::ElementOuterText DontDelete
    128 # IE extension
    129   children      KJS::JSHTMLElement::ElementChildren  DontDelete|ReadOnly
    130   contentEditable   KJS::JSHTMLElement::ElementContentEditable  DontDelete
    131   isContentEditable KJS::JSHTMLElement::ElementIsContentEditable  DontDelete|ReadOnly
     116@begin HTMLElementTable 0
    132117@end
    133118@begin HTMLObjectElementTable 20
     
    334319JSValue *JSHTMLElement::getValueProperty(ExecState* exec, int token) const
    335320{
    336     // Check our set of generic properties first.
    337     HTMLElement &element = *static_cast<HTMLElement*>(impl());
    338     switch (token) {
    339         case ElementId:
    340             // iht.com relies on this value being "" when no id is present. Other browsers do this as well.
    341             // So we use jsString() instead of jsStringOrNull() here.
    342             return jsString(element.id());
    343         case ElementLang:
    344             return jsString(element.lang());
    345         case ElementDir:
    346             return jsString(element.dir());
    347         case ElementClassName:
    348             return jsString(element.className());
    349         case ElementInnerHTML:
    350             return jsString(element.innerHTML());
    351         case ElementInnerText:
    352             impl()->document()->updateLayoutIgnorePendingStylesheets();
    353             return jsString(element.innerText());
    354         case ElementOuterHTML:
    355             return jsString(element.outerHTML());
    356         case ElementOuterText:
    357             return jsString(element.outerText());
    358         case ElementChildren:
    359             return getHTMLCollection(exec, element.children().get());
    360         case ElementContentEditable:
    361             return jsString(element.contentEditable());
    362         case ElementIsContentEditable:
    363             return jsBoolean(element.isContentEditable());
    364     }
    365 
    366     // Now check the properties specific to our element type.
     321    // Check the properties specific to our element type.
    367322    const Accessors* access = accessors();
    368323    if (access && access->m_getter)
     
    527482void JSHTMLElement::putValueProperty(ExecState* exec, int token, JSValue *value, int)
    528483{
    529     DOMExceptionTranslator exception(exec);
    530  
    531     // Check our set of generic properties first.
    532     HTMLElement &element = *static_cast<HTMLElement*>(impl());
    533     switch (token) {
    534         case ElementId:
    535             element.setId(valueToStringWithNullCheck(exec, value));
    536             return;
    537         case ElementLang:
    538             element.setLang(valueToStringWithNullCheck(exec, value));
    539             return;
    540         case ElementDir:
    541             element.setDir(valueToStringWithNullCheck(exec, value));
    542             return;
    543         case ElementClassName:
    544             element.setClassName(valueToStringWithNullCheck(exec, value));
    545             return;
    546         case ElementInnerHTML:
    547             element.setInnerHTML(valueToStringWithNullCheck(exec, value), exception);
    548             return;
    549         case ElementInnerText:
    550             element.setInnerText(valueToStringWithNullCheck(exec, value), exception);
    551             return;
    552         case ElementOuterHTML:
    553             element.setOuterHTML(valueToStringWithNullCheck(exec, value), exception);
    554             return;
    555         case ElementOuterText:
    556             element.setOuterText(valueToStringWithNullCheck(exec, value), exception);
    557             return;
    558         case ElementContentEditable:
    559             element.setContentEditable(valueToStringWithNullCheck(exec, value));
    560             return;
    561     }
    562 
    563     // Now check for properties that apply to a specific element type.
     484    // Check for properties that apply to a specific element type.
    564485    const Accessors* access = accessors();
    565486    if (access && access->m_setter)
  • trunk/WebCore/bindings/js/kjs_html.h

    r21681 r21683  
    8080           ObjectName, ObjectStandby, ObjectTabIndex, ObjectUseMap, ObjectWidth, ObjectContentDocument, ObjectGetSVGDocument,
    8181           EmbedAlign, EmbedHeight, EmbedName, EmbedSrc, EmbedType, EmbedWidth, EmbedGetSVGDocument,
    82            FrameSetCols, FrameSetRows,
    83            GetContext,
    84            ElementInnerHTML, ElementId, ElementDir, ElementLang,
    85            ElementClassName, ElementInnerText, ElementChildren, ElementContentEditable,
    86            ElementIsContentEditable, ElementOuterHTML, ElementOuterText
     82           FrameSetCols, FrameSetRows
    8783    };
    8884  private:
  • trunk/WebCore/dom/Element.cpp

    r21642 r21683  
    10311031String Element::innerText() const
    10321032{
     1033    // We need to update layout, since plainText uses line boxes in the render tree.
     1034    document()->updateLayoutIgnorePendingStylesheets();
     1035
    10331036    if (!renderer())
    10341037        return textContent(true);
    10351038
    1036     // We need to update layout, since plainText uses line boxes in the render tree.
    1037     document()->updateLayoutIgnorePendingStylesheets();
    1038     return plainText(rangeOfContents(const_cast<Element *>(this)).get());
     1039    return plainText(rangeOfContents(const_cast<Element*>(this)).get());
    10391040}
    10401041
  • trunk/WebCore/html/HTMLAnchorElement.cpp

    r20813 r21683  
    55 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    66 *           (C) 2000 Simon Hausmann <hausmann@kde.org>
    7  * Copyright (C) 2003, 2006 Apple Computer, Inc.
     7 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
    88 *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
    99 *
     
    456456String HTMLAnchorElement::text() const
    457457{
    458     document()->updateLayoutIgnorePendingStylesheets();
    459458    return innerText();
    460459}
  • trunk/WebCore/html/HTMLElement.idl

    r21470 r21683  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc.
     2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
    44 *
     
    2222
    2323    interface [GenerateConstructor] HTMLElement : Element {
     24                 // iht.com relies on id returning the empty string when no id is present.
     25                 // Other browsers do this as well. So we don't convert null to JS null.
     26                 attribute [ConvertNullToNullString] DOMString id;
    2427                 attribute [ConvertNullToNullString] DOMString title;
    25 
    26 #if !defined(LANGUAGE_JAVASCRIPT)
    27                  attribute [ConvertNullToNullString] DOMString id;
    2828                 attribute [ConvertNullToNullString] DOMString lang;
    2929                 attribute [ConvertNullToNullString] DOMString dir;
    3030                 attribute [ConvertNullToNullString] DOMString className;
    3131
    32         // extensions
    33 
     32        // Extensions
    3433                 attribute [ConvertNullToNullString] DOMString innerHTML
    3534                     setter raises(DOMException);
     
    4645        readonly attribute boolean isContentEditable;
    4746
     47#if defined(LANGUAGE_OBJECTIVE_C)
    4848        readonly attribute DOMString titleDisplayString;
    4949#endif
Note: See TracChangeset for help on using the changeset viewer.