Changeset 161876 in webkit


Ignore:
Timestamp:
Jan 13, 2014 4:52:28 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Text should be constructable.
https://bugs.webkit.org/show_bug.cgi?id=115640

Patch by László Langó <llango.u-szeged@partner.samsung.com> on 2014-01-13
Reviewed by Csaba Osztrogonác.

Source/WebCore:

http://dom.spec.whatwg.org/#interface-text
Make Text constructable so that one can do "new Text('abc')"
instead of "document.createTexte('abc')".

Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/cdd5a914daf3862379a5ce4596149bd690d0fa08

Test: fast/dom/Text/text-constructor.html

  • dom/Text.cpp:

(WebCore::Text::create):

  • dom/Text.h:
  • dom/Text.idl:

LayoutTests:

  • fast/dom/Text/text-constructor-expected.txt: Added.
  • fast/dom/Text/text-constructor.html: Added.
  • fast/dom/dom-constructors-expected.txt:
  • fast/dom/dom-constructors.html:
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r161872 r161876  
     12014-01-13  László Langó  <llango.u-szeged@partner.samsung.com>
     2
     3        Text should be constructable.
     4        https://bugs.webkit.org/show_bug.cgi?id=115640
     5
     6        Reviewed by Csaba Osztrogonác.
     7
     8        * fast/dom/Text/text-constructor-expected.txt: Added.
     9        * fast/dom/Text/text-constructor.html: Added.
     10        * fast/dom/dom-constructors-expected.txt:
     11        * fast/dom/dom-constructors.html:
     12
    1132014-01-13  Zan Dobersek  <zdobersek@igalia.com>
    214
  • trunk/LayoutTests/fast/dom/dom-constructors-expected.txt

    r161867 r161876  
    1717PASS TryAllocate('Notation') is 'exception'
    1818PASS TryAllocate('ProcessingInstruction') is 'exception'
    19 PASS TryAllocate('Text') is 'exception'
    2019PASS TryAllocate('HTMLAllCollection') is 'exception'
    2120PASS TryAllocate('HTMLAnchorElement') is 'exception'
     
    135134PASS TryAllocate('DOMParser') is '[object DOMParser]'
    136135PASS TryAllocate('DOMParser') is '[object DOMParser]'
     136PASS TryAllocate('Text') is '[object Text]'
     137PASS TryAllocate('Text') is '[object Text]'
     138PASS TryAllocate('Text') is '[object Text]'
    137139PASS TryAllocate('XMLHttpRequest') is '[object XMLHttpRequest]'
    138140PASS TryAllocate('XMLHttpRequest') is '[object XMLHttpRequest]'
  • trunk/LayoutTests/fast/dom/dom-constructors.html

    r161867 r161876  
    1717    'DocumentFragment', 'DocumentType', 'Element', 'Entity',
    1818    'EntityReference', 'HTMLDocument', 'Node', 'Notation',
    19     'ProcessingInstruction', 'Text', 'HTMLAllCollection', 'HTMLAnchorElement',
     19    'ProcessingInstruction', 'HTMLAllCollection', 'HTMLAnchorElement',
    2020    'HTMLAppletElement', 'HTMLAreaElement', 'HTMLBaseElement',
    2121    'HTMLBaseFontElement', 'HTMLBodyElement',
     
    5656// These objects should have a working constructor.
    5757var objects_constructor = [
    58     'Comment', 'DOMParser', 'XMLHttpRequest', 'XMLSerializer', 'XPathEvaluator',
     58    'Comment', 'DOMParser', 'Text', 'XMLHttpRequest', 'XMLSerializer', 'XPathEvaluator',
    5959    'XSLTProcessor'
    6060];
  • trunk/Source/WebCore/ChangeLog

    r161873 r161876  
     12014-01-13  László Langó  <llango.u-szeged@partner.samsung.com>
     2
     3        Text should be constructable.
     4        https://bugs.webkit.org/show_bug.cgi?id=115640
     5
     6        Reviewed by Csaba Osztrogonác.
     7
     8        http://dom.spec.whatwg.org/#interface-text
     9        Make Text constructable so that one can do "new Text('abc')"
     10        instead of "document.createTexte('abc')".
     11
     12        Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/cdd5a914daf3862379a5ce4596149bd690d0fa08
     13
     14        Test: fast/dom/Text/text-constructor.html
     15
     16        * dom/Text.cpp:
     17        (WebCore::Text::create):
     18        * dom/Text.h:
     19        * dom/Text.idl:
     20
    1212014-01-13  Zan Dobersek  <zdobersek@igalia.com>
    222
  • trunk/Source/WebCore/dom/Text.cpp

    r161153 r161876  
    4747}
    4848
     49PassRefPtr<Text> Text::create(ScriptExecutionContext& context, const String& data)
     50{
     51    return adoptRef(new Text(toDocument(context), data, CreateText));
     52}
     53
    4954PassRefPtr<Text> Text::createEditingText(Document& document, const String& data)
    5055{
  • trunk/Source/WebCore/dom/Text.h

    r161208 r161876  
    3030
    3131class RenderText;
     32class ScriptExecutionContext;
    3233
    3334class Text : public CharacterData {
     
    3637
    3738    static PassRefPtr<Text> create(Document&, const String&);
     39    static PassRefPtr<Text> create(ScriptExecutionContext&, const String&);
    3840    static PassRefPtr<Text> createWithLengthLimit(Document&, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit);
    3941    static PassRefPtr<Text> createEditingText(Document&, const String&);
  • trunk/Source/WebCore/dom/Text.idl

    r159061 r161876  
    1717 * Boston, MA 02110-1301, USA.
    1818 */
    19 
    20 interface Text : CharacterData {
     19[
     20    Constructor([Default=NullString] optional DOMString data),
     21    ConstructorCallWith=ScriptExecutionContext
     22] interface Text : CharacterData {
    2123
    2224    // DOM Level 1
Note: See TracChangeset for help on using the changeset viewer.