Changeset 21683 in webkit
- Timestamp:
- May 23, 2007 4:32:06 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r21682 r21683 1 2007-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 1 18 2007-05-22 Kevin McCullough <kmccullough@apple.com> 2 19 -
trunk/WebCore/bindings/js/kjs_html.cpp
r21681 r21683 112 112 113 113 /* 114 115 114 @begin JSHTMLElementPrototypeTable 0 116 115 @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 132 117 @end 133 118 @begin HTMLObjectElementTable 20 … … 334 319 JSValue *JSHTMLElement::getValueProperty(ExecState* exec, int token) const 335 320 { 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. 367 322 const Accessors* access = accessors(); 368 323 if (access && access->m_getter) … … 527 482 void JSHTMLElement::putValueProperty(ExecState* exec, int token, JSValue *value, int) 528 483 { 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. 564 485 const Accessors* access = accessors(); 565 486 if (access && access->m_setter) -
trunk/WebCore/bindings/js/kjs_html.h
r21681 r21683 80 80 ObjectName, ObjectStandby, ObjectTabIndex, ObjectUseMap, ObjectWidth, ObjectContentDocument, ObjectGetSVGDocument, 81 81 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 87 83 }; 88 84 private: -
trunk/WebCore/dom/Element.cpp
r21642 r21683 1031 1031 String Element::innerText() const 1032 1032 { 1033 // We need to update layout, since plainText uses line boxes in the render tree. 1034 document()->updateLayoutIgnorePendingStylesheets(); 1035 1033 1036 if (!renderer()) 1034 1037 return textContent(true); 1035 1038 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()); 1039 1040 } 1040 1041 -
trunk/WebCore/html/HTMLAnchorElement.cpp
r20813 r21683 5 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 6 * (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. 8 8 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 9 9 * … … 456 456 String HTMLAnchorElement::text() const 457 457 { 458 document()->updateLayoutIgnorePendingStylesheets();459 458 return innerText(); 460 459 } -
trunk/WebCore/html/HTMLElement.idl
r21470 r21683 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 22 22 23 23 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; 24 27 attribute [ConvertNullToNullString] DOMString title; 25 26 #if !defined(LANGUAGE_JAVASCRIPT)27 attribute [ConvertNullToNullString] DOMString id;28 28 attribute [ConvertNullToNullString] DOMString lang; 29 29 attribute [ConvertNullToNullString] DOMString dir; 30 30 attribute [ConvertNullToNullString] DOMString className; 31 31 32 // extensions 33 32 // Extensions 34 33 attribute [ConvertNullToNullString] DOMString innerHTML 35 34 setter raises(DOMException); … … 46 45 readonly attribute boolean isContentEditable; 47 46 47 #if defined(LANGUAGE_OBJECTIVE_C) 48 48 readonly attribute DOMString titleDisplayString; 49 49 #endif
Note: See TracChangeset
for help on using the changeset viewer.