Changeset 162062 in webkit


Ignore:
Timestamp:
Jan 15, 2014 2:14:09 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

DocumentFragment should be constructable.
https://bugs.webkit.org/show_bug.cgi?id=115641

Patch by László Langó <llango.u-szeged@partner.samsung.com> on 2014-01-15
Reviewed by Ryosuke Niwa.

Source/WebCore:

http://www.w3.org/TR/2013/WD-dom-20131107/#interface-documentfragment
This allows us to do new DocumentFragment instead of
document.createDocumentFragment().

Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/86855c44a5a127716840fb377281b1c428e5eb2d%5E%21

Test: fast/dom/DocumentFragment/document-fragment-constructor.html

  • dom/DocumentFragment.cpp:

(WebCore::DocumentFragment::create):

  • dom/DocumentFragment.h:
  • dom/DocumentFragment.idl:

LayoutTests:

  • fast/dom/DocumentFragment/document-fragment-constructor-expected.txt: Added.
  • fast/dom/DocumentFragment/document-fragment-constructor.html: Added.
  • fast/dom/dom-constructors-expected.txt:
  • fast/dom/dom-constructors.html:
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r162058 r162062  
     12014-01-15  László Langó  <llango.u-szeged@partner.samsung.com>
     2
     3        DocumentFragment should be constructable.
     4        https://bugs.webkit.org/show_bug.cgi?id=115641
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/dom/DocumentFragment/document-fragment-constructor-expected.txt: Added.
     9        * fast/dom/DocumentFragment/document-fragment-constructor.html: Added.
     10        * fast/dom/dom-constructors-expected.txt:
     11        * fast/dom/dom-constructors.html:
     12
    1132014-01-14  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/LayoutTests/fast/dom/dom-constructors-expected.txt

    r161876 r162062  
    88PASS TryAllocate('CDATASection') is 'exception'
    99PASS TryAllocate('Document') is 'exception'
    10 PASS TryAllocate('DocumentFragment') is 'exception'
    1110PASS TryAllocate('DocumentType') is 'exception'
    1211PASS TryAllocate('Element') is 'exception'
     
    134133PASS TryAllocate('DOMParser') is '[object DOMParser]'
    135134PASS TryAllocate('DOMParser') is '[object DOMParser]'
     135PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]'
     136PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]'
     137PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]'
    136138PASS TryAllocate('Text') is '[object Text]'
    137139PASS TryAllocate('Text') is '[object Text]'
  • trunk/LayoutTests/fast/dom/dom-constructors.html

    r161876 r162062  
    1414// arguments to be valid.)
    1515var objects_exception = [
    16     'Attr', 'CharacterData', 'CDATASection', 'Document',
    17     'DocumentFragment', 'DocumentType', 'Element', 'Entity',
    18     'EntityReference', 'HTMLDocument', 'Node', 'Notation',
    19     'ProcessingInstruction', 'HTMLAllCollection', 'HTMLAnchorElement',
    20     'HTMLAppletElement', 'HTMLAreaElement', 'HTMLBaseElement',
    21     'HTMLBaseFontElement', 'HTMLBodyElement',
    22     'HTMLBRElement', 'HTMLButtonElement', 'HTMLCanvasElement',
    23     'HTMLDirectoryElement', 'HTMLDivElement', 'HTMLDListElement',
    24     'HTMLEmbedElement', 'HTMLFieldSetElement', 'HTMLFontElement',
    25     'HTMLFormElement', 'HTMLFrameElement', 'HTMLFrameSetElement',
    26     'HTMLHeadingElement', 'HTMLHeadElement', 'HTMLHRElement',
    27     'HTMLHtmlElement', 'HTMLIFrameElement', 'HTMLImageElement',
    28     'HTMLInputElement', 'HTMLLabelElement',
    29     'HTMLLegendElement', 'HTMLLIElement', 'HTMLLinkElement',
    30     'HTMLMapElement', 'HTMLMarqueeElement', 'HTMLMenuElement',
    31     'HTMLMetaElement', 'HTMLModElement', 'HTMLObjectElement',
    32     'HTMLOListElement', 'HTMLOptGroupElement', 'HTMLOptionElement',
    33     'HTMLParagraphElement', 'HTMLParamElement', 'HTMLPreElement',
    34     'HTMLQuoteElement', 'HTMLScriptElement', 'HTMLSelectElement',
    35     'HTMLStyleElement', 'HTMLTableCaptionElement',
    36     'HTMLTableColElement', 'HTMLTableElement',
    37     'HTMLTableSectionElement', 'HTMLTableCellElement',
    38     'HTMLTableRowElement', 'HTMLTextAreaElement', 'HTMLTitleElement',
    39     'HTMLUListElement', 'HTMLElement', 'CanvasRenderingContext2D',
    40     'Clipboard', 'Counter', 'CSSCharsetRule', 'CSSFontFaceRule',
    41     'CSSImportRule', 'CSSMediaRule', 'CSSPageRule',
    42     'CSSPrimitiveValue', 'CSSRule', 'CSSRuleList',
    43     'CSSStyleDeclaration', 'CSSStyleRule', 'CSSStyleSheet',
    44     'CSSValue', 'CSSValueList', 'DOMImplementation',
    45     'HTMLCollection', 'MediaList', 'MimeType',
    46     'MimeTypeArray', 'MutationEvent', 'NamedNodeMap',
    47     'NodeFilter', 'NodeList', 'Plugin',
    48     'PluginArray', 'Range', 'Rect', 'StyleSheet', 'StyleSheetList',
    49     'TextEvent', 'XPathResult', 'BarInfo',
    50     'CanvasGradient', 'CanvasPattern', 'Console', 'Selection',
    51     'Window', 'History', 'HTMLOptionsCollection', 'Location',
    52     'Navigator', 'NodeIterator', 'RGBColor', 'Screen', 'TreeWalker',
    53     'XPathExpression', 'Worker'
     16    'Attr',
     17    'CharacterData',
     18    'CDATASection',
     19    'Document',
     20    'DocumentType',
     21    'Element',
     22    'Entity',
     23    'EntityReference',
     24    'HTMLDocument',
     25    'Node',
     26    'Notation',
     27    'ProcessingInstruction',
     28    'HTMLAllCollection',
     29    'HTMLAnchorElement',
     30    'HTMLAppletElement',
     31    'HTMLAreaElement',
     32    'HTMLBaseElement',
     33    'HTMLBaseFontElement',
     34    'HTMLBodyElement',
     35    'HTMLBRElement',
     36    'HTMLButtonElement',
     37    'HTMLCanvasElement',
     38    'HTMLDirectoryElement',
     39    'HTMLDivElement',
     40    'HTMLDListElement',
     41    'HTMLEmbedElement',
     42    'HTMLFieldSetElement',
     43    'HTMLFontElement',
     44    'HTMLFormElement',
     45    'HTMLFrameElement',
     46    'HTMLFrameSetElement',
     47    'HTMLHeadingElement',
     48    'HTMLHeadElement',
     49    'HTMLHRElement',
     50    'HTMLHtmlElement',
     51    'HTMLIFrameElement',
     52    'HTMLImageElement',
     53    'HTMLInputElement',
     54    'HTMLLabelElement',
     55    'HTMLLegendElement',
     56    'HTMLLIElement',
     57    'HTMLLinkElement',
     58    'HTMLMapElement',
     59    'HTMLMarqueeElement',
     60    'HTMLMenuElement',
     61    'HTMLMetaElement',
     62    'HTMLModElement',
     63    'HTMLObjectElement',
     64    'HTMLOListElement',
     65    'HTMLOptGroupElement',
     66    'HTMLOptionElement',
     67    'HTMLParagraphElement',
     68    'HTMLParamElement',
     69    'HTMLPreElement',
     70    'HTMLQuoteElement',
     71    'HTMLScriptElement',
     72    'HTMLSelectElement',
     73    'HTMLStyleElement',
     74    'HTMLTableCaptionElement',
     75    'HTMLTableColElement',
     76    'HTMLTableElement',
     77    'HTMLTableSectionElement',
     78    'HTMLTableCellElement',
     79    'HTMLTableRowElement',
     80    'HTMLTextAreaElement',
     81    'HTMLTitleElement',
     82    'HTMLUListElement',
     83    'HTMLElement',
     84    'CanvasRenderingContext2D',
     85    'Clipboard',
     86    'Counter',
     87    'CSSCharsetRule',
     88    'CSSFontFaceRule',
     89    'CSSImportRule',
     90    'CSSMediaRule',
     91    'CSSPageRule',
     92    'CSSPrimitiveValue',
     93    'CSSRule',
     94    'CSSRuleList',
     95    'CSSStyleDeclaration',
     96    'CSSStyleRule',
     97    'CSSStyleSheet',
     98    'CSSValue',
     99    'CSSValueList',
     100    'DOMImplementation',
     101    'HTMLCollection',
     102    'MediaList',
     103    'MimeType',
     104    'MimeTypeArray',
     105    'MutationEvent',
     106    'NamedNodeMap',
     107    'NodeFilter',
     108    'NodeList',
     109    'Plugin',
     110    'PluginArray',
     111    'Range',
     112    'Rect',
     113    'StyleSheet',
     114    'StyleSheetList',
     115    'TextEvent',
     116    'XPathResult',
     117    'BarInfo',
     118    'CanvasGradient',
     119    'CanvasPattern',
     120    'Console',
     121    'Selection',
     122    'Window',
     123    'History',
     124    'HTMLOptionsCollection',
     125    'Location',
     126    'Navigator',
     127    'NodeIterator',
     128    'RGBColor',
     129    'Screen',
     130    'TreeWalker',
     131    'XPathExpression',
     132    'Worker'
    54133];
    55134
    56135// These objects should have a working constructor.
    57136var objects_constructor = [
    58     'Comment', 'DOMParser', 'Text', 'XMLHttpRequest', 'XMLSerializer', 'XPathEvaluator',
     137    'Comment',
     138    'DOMParser',
     139    'DocumentFragment',
     140    'Text',
     141    'XMLHttpRequest',
     142    'XMLSerializer',
     143    'XPathEvaluator',
    59144    'XSLTProcessor'
    60145];
  • trunk/Source/WebCore/ChangeLog

    r162055 r162062  
     12014-01-15  László Langó  <llango.u-szeged@partner.samsung.com>
     2
     3        DocumentFragment should be constructable.
     4        https://bugs.webkit.org/show_bug.cgi?id=115641
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        http://www.w3.org/TR/2013/WD-dom-20131107/#interface-documentfragment
     9        This allows us to do `new DocumentFragment` instead of
     10        `document.createDocumentFragment()`.
     11
     12        Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/86855c44a5a127716840fb377281b1c428e5eb2d%5E%21
     13
     14        Test: fast/dom/DocumentFragment/document-fragment-constructor.html
     15
     16        * dom/DocumentFragment.cpp:
     17        (WebCore::DocumentFragment::create):
     18        * dom/DocumentFragment.h:
     19        * dom/DocumentFragment.idl:
     20
    1212014-01-14  ChangSeok Oh  <changseok.oh@collabora.com>
    222
  • trunk/Source/WebCore/dom/DocumentFragment.cpp

    r156980 r162062  
    4040{
    4141    return adoptRef(new DocumentFragment(&document, Node::CreateDocumentFragment));
     42}
     43
     44PassRefPtr<DocumentFragment> DocumentFragment::create(ScriptExecutionContext& context)
     45{
     46    return adoptRef(new DocumentFragment(&toDocument(context), Node::CreateDocumentFragment));
    4247}
    4348
  • trunk/Source/WebCore/dom/DocumentFragment.h

    r157405 r162062  
    3030namespace WebCore {
    3131
     32class ScriptExecutionContext;
     33
    3234class DocumentFragment : public ContainerNode {
    3335public:
    3436    static PassRefPtr<DocumentFragment> create(Document&);
     37    static PassRefPtr<DocumentFragment> create(ScriptExecutionContext&);
    3538
    3639    void parseHTML(const String&, Element* contextElement, ParserContentPolicy = AllowScriptingContent);
  • trunk/Source/WebCore/dom/DocumentFragment.idl

    r159061 r162062  
    1818 */
    1919
    20 interface DocumentFragment : Node {
     20 [
     21    Constructor,
     22    ConstructorCallWith=ScriptExecutionContext
     23 ] interface DocumentFragment : Node {
    2124    // NodeSelector - Selector API
    2225    [RaisesException] Element querySelector(DOMString selectors);
Note: See TracChangeset for help on using the changeset viewer.