[webkit-changes] cvs commit: WebCore/khtml/ecma kjs_window.cpp kjs_window.h

Maciej mjs at opensource.apple.com
Wed Jun 8 01:39:21 PDT 2005


mjs         05/06/08 01:39:21

  Modified:    .        ChangeLog
               khtml/ecma kjs_window.cpp kjs_window.h
  Added:       layout-tests/fast/dom
                        dom-parse-serialize-display-expected.txt
                        dom-parse-serialize-display.html
                        dom-parse-serialize-expected.txt
                        dom-parse-serialize.html
  Log:
  	Reviewed and committed by Maciej.
  
  	- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3337
  	(Support the Mozilla DOMParser and XMLSerializer objects)
  
  	<rdar://problem/3533735> implement Mozilla "DOMParser" extension for use with XMLHTTPRequest
  
          Test cases added:
          * layout-tests/fast/dom/dom-parse-serialize-display-expected.txt: Added.
          * layout-tests/fast/dom/dom-parse-serialize-display.html: Added.
          * layout-tests/fast/dom/dom-parse-serialize-expected.txt: Added.
          * layout-tests/fast/dom/dom-parse-serialize.html: Added.
  
  	* khtml/ecma/domparser.h:
  	* khtml/ecma/domparser.cpp:
  	Add files implementing the DOMParser object.
  
  	* khtml/ecma/kjs_window.h:
  	* khtml/ecma/kjs_window.cpp:
  	Expose DOMParser object.
  
  Revision  Changes    Path
  1.4250    +23 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4249
  retrieving revision 1.4250
  diff -u -r1.4249 -r1.4250
  --- ChangeLog	8 Jun 2005 00:41:17 -0000	1.4249
  +++ ChangeLog	8 Jun 2005 08:39:16 -0000	1.4250
  @@ -1,3 +1,26 @@
  +2005-06-08  Anders Carlsson  <andersca at mac.com>
  +
  +	Reviewed and committed by Maciej.
  +
  +	- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3337
  +	(Support the Mozilla DOMParser and XMLSerializer objects)
  +
  +	<rdar://problem/3533735> implement Mozilla "DOMParser" extension for use with XMLHTTPRequest
  +
  +        Test cases added:
  +        * layout-tests/fast/dom/dom-parse-serialize-display-expected.txt: Added.
  +        * layout-tests/fast/dom/dom-parse-serialize-display.html: Added.
  +        * layout-tests/fast/dom/dom-parse-serialize-expected.txt: Added.
  +        * layout-tests/fast/dom/dom-parse-serialize.html: Added.
  +
  +	* khtml/ecma/domparser.h:
  +	* khtml/ecma/domparser.cpp:
  +	Add files implementing the DOMParser object.
  +
  +	* khtml/ecma/kjs_window.h:
  +	* khtml/ecma/kjs_window.cpp:
  +	Expose DOMParser object.
  +	
   2005-06-07  David Hyatt  <hyatt at apple.com>
   
   	Patch from Brian Campbell.  Make sure the min and max values of slider properly update.
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/dom-parse-serialize-display-expected.txt
  
  Index: dom-parse-serialize-display-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (8,8) size 784x584
        RenderBlock {H1} at (0,0) size 784x37
          RenderText {TEXT} at (0,0) size 438x37
            text run at (0,0) width 438: "DOMParser/XMLSerializer test"
        RenderBlock {DIV} at (0,58) size 784x36
          RenderText {TEXT} at (0,0) size 779x36
            text run at (0,0) width 779: "The \"text to parse\" and \"document object serialized\" boxes should show the same text, and it should be an XML document,"
            text run at (0,18) width 160: "not \"@@No result@@\"."
        RenderBlock {DIV} at (0,94) size 784x181 [border: (1px solid #000000)]
          RenderBlock (anonymous) at (1,1) size 782x18
            RenderInline {SPAN} at (0,0) size 83x18 [color=#800000]
              RenderText {TEXT} at (0,0) size 83x18
                text run at (0,0) width 83: "text to parse"
            RenderText {TEXT} at (0,0) size 0x0
          RenderBlock {PRE} at (27,32) size 756x135
            RenderText {TEXT} at (0,0) size 536x135
              text run at (0,0) width 168: "<?xml version=\"1.0\"?>"
              text run at (0,15) width 424: "<?xml-stylesheet href=\"display.css\" type=\"text/css\"?>"
              text run at (0,30) width 120: "<!DOCTYPE doc ["
              text run at (0,45) width 216: "<!ATTLIST d id ID #IMPLIED>"
              text run at (0,60) width 16: "]>"
              text run at (0,75) width 40: "<doc>"
              text run at (0,90) width 536: "  <foo xmlns=\"foobar\">One</foo> <x:bar xmlns:x=\"barfoo\">Two</x:bar>"
              text run at (0,105) width 184: "  <d id=\"id3\">Three</d>"
              text run at (0,120) width 48: "</doc>"
        RenderBlock {DIV} at (0,283) size 784x61 [border: (1px solid #000000)]
          RenderBlock (anonymous) at (1,1) size 782x18
            RenderInline {SPAN} at (0,0) size 112x18 [color=#800000]
              RenderText {TEXT} at (0,0) size 112x18
                text run at (0,0) width 112: "document object"
            RenderText {TEXT} at (0,0) size 0x0
          RenderBlock {PRE} at (27,32) size 756x15
            RenderText {TEXT} at (0,0) size 136x15
              text run at (0,0) width 136: "[object Document]"
        RenderBlock {DIV} at (0,352) size 784x106 [border: (1px solid #000000)]
          RenderBlock (anonymous) at (1,1) size 782x18
            RenderInline {SPAN} at (0,0) size 179x18 [color=#800000]
              RenderText {TEXT} at (0,0) size 179x18
                text run at (0,0) width 179: "document object serialized"
            RenderText {TEXT} at (0,0) size 0x0
          RenderBlock {PRE} at (27,32) size 756x60
            RenderText {TEXT} at (0,0) size 488x60
              text run at (0,0) width 456: "<?xml-stylesheet href=\"display.css\" type=\"text/css\"><doc>"
              text run at (0,15) width 488: "  <foo xmlns=\"foobar\">One</foo> <x:bar x=\"barfoo\">Two</x:bar>"
              text run at (0,30) width 184: "  <d id=\"id3\">Three</d>"
              text run at (0,45) width 48: "</doc>"
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/dom-parse-serialize-display.html
  
  Index: dom-parse-serialize-display.html
  ===================================================================
  <!-- 
     - The contents of this file are subject to the Mozilla Public
     - License Version 1.1 (the "License"); you may not use this file
     - except in compliance with the License. You may obtain a copy of
     - the License at http://www.mozilla.org/MPL/
     - 
     - Software distributed under the License is distributed on an "AS
     - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
     - implied. See the License for the specific language governing
     - rights and limitations under the License.
     - 
     - The Original Code is Mozilla Test Cases.
     - 
     - The Initial Developer of the Original Code is Netscape Communications
     - Corp.  Portions created by Netscape Communications Corp. are 
     - Copyright (C) 2001 Netscape Communications Corp.  All
     - Rights Reserved.
     - 
     - Contributor(s): 
    -->
  <html>
  <head>
  <title>DOMParser/XMLSerializer test</title>
  <style type="text/css">
  .box {
    display: box;
    border: 1px solid black;
    margin-bottom: 0.5em;
  }
  .boxheader {
    font-weight: bold;
    color: maroon;
  }
  pre {
    margin-left: 2em;
  }
  </style>
  <script type="text/javascript">
  function execute()
  {
    var parser = new DOMParser();
    var str = 
      '<?xml version="1.0"?>\n<?xml-stylesheet href="display.css" type="text/css"?>\n<!DOCTYPE doc [\n<!ATTLIST d id ID #IMPLIED>\n]>\n<doc>\n  <foo xmlns="foobar">One</foo> <x:bar xmlns:x="barfoo">Two</x:bar>\n  <d id="id3">Three</d>\n</doc>\n';
    var doc = parser.parseFromString(str,"text/xml");
   
    document.getElementById("id1").firstChild.nodeValue = str;
    document.getElementById("id2").firstChild.nodeValue = doc;
    var ser = new XMLSerializer();
    document.getElementById("id3").firstChild.nodeValue = ser.serializeToString(doc);
  }
  
  </script>
  </head>
  <body onload="execute();">
  <h1>DOMParser/XMLSerializer test</h1>
  
  <div>The "text to parse" and "document object serialized" boxes should show the same text, and it should be an XML document, not "@@No result@@".
  </div>
  
  <div class="box"><span class="boxheader">text to parse</span>
  <pre id="id1">@@No result@@</pre>
  </div>
  <div class="box"><span class="boxheader">document object</span>
  <pre id="id2">@@No result@@</pre>
  </div>
  <div class="box"><span class="boxheader">document object serialized</span>
  <pre id="id3">@@No result@@</pre>
  </div>
  
  </body>
  </html>
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/dom-parse-serialize-expected.txt
  
  Index: dom-parse-serialize-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (8,8) size 784x584
        RenderBlock {H1} at (0,0) size 784x37
          RenderText {TEXT} at (0,0) size 438x37
            text run at (0,0) width 438: "DOMParser/XMLSerializer test"
        RenderBlock {DIV} at (0,58) size 784x36
          RenderText {TEXT} at (0,0) size 779x36
            text run at (0,0) width 779: "The \"text to parse\" and \"document object serialized\" boxes should show the same text, and it should be an XML document,"
            text run at (0,18) width 160: "not \"@@No result@@\"."
        RenderBlock {DIV} at (0,94) size 784x166 [border: (1px solid #000000)]
          RenderBlock (anonymous) at (1,1) size 782x18
            RenderInline {SPAN} at (0,0) size 83x18 [color=#800000]
              RenderText {TEXT} at (0,0) size 83x18
                text run at (0,0) width 83: "text to parse"
            RenderText {TEXT} at (0,0) size 0x0
          RenderBlock {PRE} at (27,32) size 756x120
            RenderText {TEXT} at (0,0) size 536x120
              text run at (0,0) width 168: "<?xml version=\"1.0\"?>"
              text run at (0,15) width 120: "<!DOCTYPE doc ["
              text run at (0,30) width 216: "<!ATTLIST d id ID #IMPLIED>"
              text run at (0,45) width 16: "]>"
              text run at (0,60) width 40: "<doc>"
              text run at (0,75) width 536: "  <foo xmlns=\"foobar\">One</foo> <x:bar xmlns:x=\"barfoo\">Two</x:bar>"
              text run at (0,90) width 184: "  <d id=\"id3\">Three</d>"
              text run at (0,105) width 48: "</doc>"
        RenderBlock {DIV} at (0,268) size 784x61 [border: (1px solid #000000)]
          RenderBlock (anonymous) at (1,1) size 782x18
            RenderInline {SPAN} at (0,0) size 112x18 [color=#800000]
              RenderText {TEXT} at (0,0) size 112x18
                text run at (0,0) width 112: "document object"
            RenderText {TEXT} at (0,0) size 0x0
          RenderBlock {PRE} at (27,32) size 756x15
            RenderText {TEXT} at (0,0) size 136x15
              text run at (0,0) width 136: "[object Document]"
        RenderBlock {DIV} at (0,337) size 784x106 [border: (1px solid #000000)]
          RenderBlock (anonymous) at (1,1) size 782x18
            RenderInline {SPAN} at (0,0) size 179x18 [color=#800000]
              RenderText {TEXT} at (0,0) size 179x18
                text run at (0,0) width 179: "document object serialized"
            RenderText {TEXT} at (0,0) size 0x0
          RenderBlock {PRE} at (27,32) size 756x60
            RenderText {TEXT} at (0,0) size 488x60
              text run at (0,0) width 40: "<doc>"
              text run at (0,15) width 488: "  <foo xmlns=\"foobar\">One</foo> <x:bar x=\"barfoo\">Two</x:bar>"
              text run at (0,30) width 184: "  <d id=\"id3\">Three</d>"
              text run at (0,45) width 48: "</doc>"
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/dom-parse-serialize.html
  
  Index: dom-parse-serialize.html
  ===================================================================
  <!-- 
     - The contents of this file are subject to the Mozilla Public
     - License Version 1.1 (the "License"); you may not use this file
     - except in compliance with the License. You may obtain a copy of
     - the License at http://www.mozilla.org/MPL/
     - 
     - Software distributed under the License is distributed on an "AS
     - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
     - implied. See the License for the specific language governing
     - rights and limitations under the License.
     - 
     - The Original Code is Mozilla Test Cases.
     - 
     - The Initial Developer of the Original Code is Netscape Communications
     - Corp.  Portions created by Netscape Communications Corp. are 
     - Copyright (C) 2001 Netscape Communications Corp.  All
     - Rights Reserved.
     - 
     - Contributor(s): 
    -->
  <html>
  <head>
  <title>DOMParser/XMLSerializer test</title>
  <style type="text/css">
  .box {
    display: box;
    border: 1px solid black;
    margin-bottom: 0.5em;
  }
  .boxheader {
    font-weight: bold;
    color: maroon;
  }
  pre {
    margin-left: 2em;
  }
  </style>
  <script type="text/javascript">
  function execute()
  {
    var parser = new DOMParser();
    var str = 
      '<?xml version="1.0"?>\n<!DOCTYPE doc [\n<!ATTLIST d id ID #IMPLIED>\n]>\n<doc>\n  <foo xmlns="foobar">One</foo> <x:bar xmlns:x="barfoo">Two</x:bar>\n  <d id="id3">Three</d>\n</doc>\n';
    var doc = parser.parseFromString(str,"text/xml");
    
    document.getElementById("id1").firstChild.nodeValue = str;
    document.getElementById("id2").firstChild.nodeValue = doc;
    var ser = new XMLSerializer();
    document.getElementById("id3").firstChild.nodeValue = ser.serializeToString(doc);
  }
  
  </script>
  </head>
  <body onload="execute();">
  <h1>DOMParser/XMLSerializer test</h1>
  
  <div>The "text to parse" and "document object serialized" boxes should show the same text, and it should be an XML document, not "@@No result@@".
  </div>
  
  <div class="box"><span class="boxheader">text to parse</span>
  <pre id="id1">@@No result@@</pre>
  </div>
  <div class="box"><span class="boxheader">document object</span>
  <pre id="id2">@@No result@@</pre>
  </div>
  <div class="box"><span class="boxheader">document object serialized</span>
  <pre id="id3">@@No result@@</pre>
  </div>
  
  </body>
  </html>
  
  
  
  1.158     +4 -0      WebCore/khtml/ecma/kjs_window.cpp
  
  Index: kjs_window.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.cpp,v
  retrieving revision 1.157
  retrieving revision 1.158
  diff -u -r1.157 -r1.158
  --- kjs_window.cpp	1 Jun 2005 23:49:49 -0000	1.157
  +++ kjs_window.cpp	8 Jun 2005 08:39:20 -0000	1.158
  @@ -51,6 +51,7 @@
   #include "kjs_events.h"
   #include "xmlhttprequest.h"
   #include "xmlserializer.h"
  +#include "domparser.h"
   
   #include "khtmlview.h"
   #include "khtml_part.h"
  @@ -271,6 +272,7 @@
     Option	Window::Option		DontDelete|ReadOnly
     XMLHttpRequest	Window::XMLHttpRequest	DontDelete|ReadOnly
     XMLSerializer	Window::XMLSerializer	DontDelete|ReadOnly
  +  DOMParser	Window::DOMParser	DontDelete|ReadOnly
     alert		Window::Alert		DontDelete|Function 1
     confirm	Window::Confirm		DontDelete|Function 1
     prompt	Window::Prompt		DontDelete|Function 2
  @@ -889,6 +891,8 @@
         return new XMLHttpRequestConstructorImp(exec, m_part->xmlDocImpl());
       case XMLSerializer:
         return new XMLSerializerConstructorImp(exec);
  +    case DOMParser:
  +      return new DOMParserConstructorImp(exec, m_part->xmlDocImpl());
       case Focus:
       case Blur:
       case Close:
  
  
  
  1.41      +1 -1      WebCore/khtml/ecma/kjs_window.h
  
  Index: kjs_window.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.h,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- kjs_window.h	1 Jun 2005 23:49:49 -0000	1.40
  +++ kjs_window.h	8 Jun 2005 08:39:20 -0000	1.41
  @@ -143,7 +143,7 @@
              ScrollTo, ScrollX, ScrollY, MoveBy, MoveTo, ResizeBy, ResizeTo, Self, _Window, Top, _Screen,
              Image, Option, Alert, Confirm, Prompt, Open, Print, SetTimeout, ClearTimeout,
              Focus, GetSelection, Blur, Close, SetInterval, ClearInterval, CaptureEvents, 
  -           ReleaseEvents, AddEventListener, RemoveEventListener, XMLHttpRequest, XMLSerializer,
  +           ReleaseEvents, AddEventListener, RemoveEventListener, XMLHttpRequest, XMLSerializer, DOMParser,
   	   Onabort, Onblur, Onchange, Onclick, Ondblclick, Ondragdrop, Onerror, 
   	   Onfocus, Onkeydown, Onkeypress, Onkeyup, Onload, Onmousedown, Onmousemove,
              Onmouseout, Onmouseover, Onmouseup, OnWindowMouseWheel, Onmove, Onreset, Onresize, Onscroll, Onsearch,
  
  
  



More information about the webkit-changes mailing list