[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:11:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 78dcb37081da88a3f525ca6c9e1ce83c4d92ac33
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 5 03:29:01 2002 +0000

            Reviewed by: David Hyatt
    
    	- fixed 3049601 - support the equivalent of
    	createcontextualfragment(NS6) or insertAdjacentHTML (IE)
    
    	- fixed 3108065 - DHTML at expedia.com doesn't work-- lack of
    	support for createContextualFragment
    
    	- fixed 3114627 - DHTML menus used in Yahoo mail don't work-- lack
    	of support for createContextualFragment
    
    	- improvement towards 3052113 - "site menu" part of .mac home page
    	editing doesn't work
    
            * khtml/ecma/kjs_range.h:
            * khtml/ecma/kjs_range.cpp:
            (DOMRangeProtoFunc::tryCall): Added suppor for
    	createContextualFragment method.
            * khtml/ecma/kjs_range.lut.h: Regenerated.
            * khtml/dom/dom2_range.h:
            * khtml/dom/dom2_range.cpp:
            (Range::createContextualFragment): Implemented (calls impl).
            * khtml/html/html_elementimpl.h:
            * khtml/html/html_elementimpl.cpp:
            (HTMLElementImpl::createContextualFragment): Factored out of setInnerHTML.
    	(HTMLElementImpl::setInnerHTML): Call createContextualFragment to
    	make the fragment.
            * khtml/xml/dom2_rangeimpl.h:
            * khtml/xml/dom2_rangeimpl.cpp:
            (RangeImpl::createContextualFragment): Implemented (calls start
    	container element).
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 36718d0..09c0ba5 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,37 @@
+2002-12-04  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by: David Hyatt
+
+	- fixed 3049601 - support the equivalent of
+	createcontextualfragment(NS6) or insertAdjacentHTML (IE)
+
+	- fixed 3108065 - DHTML at expedia.com doesn't work-- lack of
+	support for createContextualFragment
+
+	- fixed 3114627 - DHTML menus used in Yahoo mail don't work-- lack
+	of support for createContextualFragment
+
+	- improvement towards 3052113 - "site menu" part of .mac home page
+	editing doesn't work
+	
+        * khtml/ecma/kjs_range.h:
+        * khtml/ecma/kjs_range.cpp:
+        (DOMRangeProtoFunc::tryCall): Added suppor for
+	createContextualFragment method.
+        * khtml/ecma/kjs_range.lut.h: Regenerated.
+        * khtml/dom/dom2_range.h:
+        * khtml/dom/dom2_range.cpp:
+        (Range::createContextualFragment): Implemented (calls impl).
+        * khtml/html/html_elementimpl.h:
+        * khtml/html/html_elementimpl.cpp:
+        (HTMLElementImpl::createContextualFragment): Factored out of setInnerHTML.
+	(HTMLElementImpl::setInnerHTML): Call createContextualFragment to
+	make the fragment.
+        * khtml/xml/dom2_rangeimpl.h:
+        * khtml/xml/dom2_rangeimpl.cpp:
+        (RangeImpl::createContextualFragment): Implemented (calls start
+	container element).
+
 2002-12-04  David Hyatt  <hyatt at apple.com>
 
 	Fix assert on compuserve page.  <form> under <table> should not
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 36718d0..09c0ba5 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,37 @@
+2002-12-04  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by: David Hyatt
+
+	- fixed 3049601 - support the equivalent of
+	createcontextualfragment(NS6) or insertAdjacentHTML (IE)
+
+	- fixed 3108065 - DHTML at expedia.com doesn't work-- lack of
+	support for createContextualFragment
+
+	- fixed 3114627 - DHTML menus used in Yahoo mail don't work-- lack
+	of support for createContextualFragment
+
+	- improvement towards 3052113 - "site menu" part of .mac home page
+	editing doesn't work
+	
+        * khtml/ecma/kjs_range.h:
+        * khtml/ecma/kjs_range.cpp:
+        (DOMRangeProtoFunc::tryCall): Added suppor for
+	createContextualFragment method.
+        * khtml/ecma/kjs_range.lut.h: Regenerated.
+        * khtml/dom/dom2_range.h:
+        * khtml/dom/dom2_range.cpp:
+        (Range::createContextualFragment): Implemented (calls impl).
+        * khtml/html/html_elementimpl.h:
+        * khtml/html/html_elementimpl.cpp:
+        (HTMLElementImpl::createContextualFragment): Factored out of setInnerHTML.
+	(HTMLElementImpl::setInnerHTML): Call createContextualFragment to
+	make the fragment.
+        * khtml/xml/dom2_rangeimpl.h:
+        * khtml/xml/dom2_rangeimpl.cpp:
+        (RangeImpl::createContextualFragment): Implemented (calls start
+	container element).
+
 2002-12-04  David Hyatt  <hyatt at apple.com>
 
 	Fix assert on compuserve page.  <form> under <table> should not
diff --git a/WebCore/khtml/dom/dom2_range.cpp b/WebCore/khtml/dom/dom2_range.cpp
index 50b7979..8a28ae9 100644
--- a/WebCore/khtml/dom/dom2_range.cpp
+++ b/WebCore/khtml/dom/dom2_range.cpp
@@ -347,6 +347,18 @@ DOMString Range::toHTML(  )
     return impl->toHTML();
 }
 
+DocumentFragment Range::createContextualFragment( DOMString &html )
+{
+    if (!impl)
+        throw DOMException(DOMException::INVALID_STATE_ERR);
+
+    int exceptioncode = 0;
+    DocumentFragmentImpl *r = impl->createContextualFragment(html, exceptioncode);
+    throwException(exceptioncode);
+    return r;
+}
+
+
 void Range::detach(  )
 {
     if (!impl)
diff --git a/WebCore/khtml/dom/dom2_range.h b/WebCore/khtml/dom/dom2_range.h
index ef4c13f..bb2e526 100644
--- a/WebCore/khtml/dom/dom2_range.h
+++ b/WebCore/khtml/dom/dom2_range.h
@@ -437,6 +437,9 @@ public:
      * @internal Not part of DOM
      */
     DOMString toHTML (  );
+
+    /* Mozilla extension - only works for HTML documents. */
+    DocumentFragment createContextualFragment (DOMString &html);
     
     /**
      * Called to indicate that the range is no longer in use and that
diff --git a/WebCore/khtml/ecma/kjs_range.cpp b/WebCore/khtml/ecma/kjs_range.cpp
index 84e4723..acce15a 100644
--- a/WebCore/khtml/ecma/kjs_range.cpp
+++ b/WebCore/khtml/ecma/kjs_range.cpp
@@ -37,24 +37,25 @@ const ClassInfo DOMRange::info = { "Range", 0, &DOMRangeTable, 0 };
   commonAncestorContainer DOMRange::CommonAncestorContainer	DontDelete|ReadOnly
 @end
 @begin DOMRangeProtoTable 17
-  setStart		DOMRange::SetStart		DontDelete|Function 2
-  setEnd		DOMRange::SetEnd		DontDelete|Function 2
-  setStartBefore	DOMRange::SetStartBefore	DontDelete|Function 1
-  setStartAfter		DOMRange::SetStartAfter		DontDelete|Function 1
-  setEndBefore		DOMRange::SetEndBefore		DontDelete|Function 1
-  setEndAfter		DOMRange::SetEndAfter		DontDelete|Function 1
-  collapse		DOMRange::Collapse		DontDelete|Function 1
-  selectNode		DOMRange::SelectNode		DontDelete|Function 1
-  selectNodeContents	DOMRange::SelectNodeContents	DontDelete|Function 1
-  compareBoundaryPoints	DOMRange::CompareBoundaryPoints	DontDelete|Function 2
-  deleteContents	DOMRange::DeleteContents	DontDelete|Function 0
-  extractContents	DOMRange::ExtractContents	DontDelete|Function 0
-  cloneContents		DOMRange::CloneContents		DontDelete|Function 0
-  insertNode		DOMRange::InsertNode		DontDelete|Function 1
-  surroundContents	DOMRange::SurroundContents	DontDelete|Function 1
-  cloneRange		DOMRange::CloneRange		DontDelete|Function 0
-  toString		DOMRange::ToString		DontDelete|Function 0
-  detach		DOMRange::Detach		DontDelete|Function 0
+setStart		    DOMRange::SetStart			DontDelete|Function 2
+  setEnd		    DOMRange::SetEnd			DontDelete|Function 2
+  setStartBefore	    DOMRange::SetStartBefore		DontDelete|Function 1
+  setStartAfter		    DOMRange::SetStartAfter		DontDelete|Function 1
+  setEndBefore		    DOMRange::SetEndBefore		DontDelete|Function 1
+  setEndAfter		    DOMRange::SetEndAfter		DontDelete|Function 1
+  collapse		    DOMRange::Collapse			DontDelete|Function 1
+  selectNode		    DOMRange::SelectNode		DontDelete|Function 1
+  selectNodeContents	    DOMRange::SelectNodeContents	DontDelete|Function 1
+  compareBoundaryPoints	    DOMRange::CompareBoundaryPoints	DontDelete|Function 2
+  deleteContents	    DOMRange::DeleteContents		DontDelete|Function 0
+  extractContents	    DOMRange::ExtractContents		DontDelete|Function 0
+  cloneContents		    DOMRange::CloneContents		DontDelete|Function 0
+  insertNode		    DOMRange::InsertNode		DontDelete|Function 1
+  surroundContents	    DOMRange::SurroundContents		DontDelete|Function 1
+  cloneRange		    DOMRange::CloneRange		DontDelete|Function 0
+  toString		    DOMRange::ToString			DontDelete|Function 0
+  detach		    DOMRange::Detach			DontDelete|Function 0
+  createContextualFragment  DOMRange::CreateContextualFragment  DontDelete|Function 1
 @end
 */
 DEFINE_PROTOTYPE("DOMRange",DOMRangeProto)
@@ -175,6 +176,11 @@ Value DOMRangeProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &a
       range.detach();
       result = Undefined();
       break;
+    case DOMRange::CreateContextualFragment:
+      Value value = args[0];
+      DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
+      result = getDOMNode(exec, range.createContextualFragment(str));
+      break;
   };
 
   return result;
diff --git a/WebCore/khtml/ecma/kjs_range.h b/WebCore/khtml/ecma/kjs_range.h
index b5a2ac5..4915d57 100644
--- a/WebCore/khtml/ecma/kjs_range.h
+++ b/WebCore/khtml/ecma/kjs_range.h
@@ -41,7 +41,7 @@ namespace KJS {
            SetEndAfter, Collapse, SelectNode, SelectNodeContents,
            CompareBoundaryPoints, DeleteContents, ExtractContents,
            CloneContents, InsertNode, SurroundContents, CloneRange, ToString,
-           Detach };
+           Detach, CreateContextualFragment };
     DOM::Range toRange() const { return range; }
   protected:
     DOM::Range range;
diff --git a/WebCore/khtml/ecma/kjs_range.lut.h b/WebCore/khtml/ecma/kjs_range.lut.h
index b56b437..3db63db 100644
--- a/WebCore/khtml/ecma/kjs_range.lut.h
+++ b/WebCore/khtml/ecma/kjs_range.lut.h
@@ -32,7 +32,7 @@ const struct HashEntry DOMRangeProtoTableEntries[] = {
    { 0, 0, 0, 0, 0 },
    { "selectNode", DOMRange::SelectNode, DontDelete|Function, 1, &DOMRangeProtoTableEntries[21] },
    { "deleteContents", DOMRange::DeleteContents, DontDelete|Function, 0, &DOMRangeProtoTableEntries[20] },
-   { 0, 0, 0, 0, 0 },
+   { "createContextualFragment", DOMRange::CreateContextualFragment, DontDelete|Function, 1, 0 },
    { "setStartAfter", DOMRange::SetStartAfter, DontDelete|Function, 1, 0 },
    { "insertNode", DOMRange::InsertNode, DontDelete|Function, 1, 0 },
    { "cloneContents", DOMRange::CloneContents, DontDelete|Function, 0, 0 },
diff --git a/WebCore/khtml/html/html_elementimpl.cpp b/WebCore/khtml/html/html_elementimpl.cpp
index 410ace0..ba2c54a 100644
--- a/WebCore/khtml/html/html_elementimpl.cpp
+++ b/WebCore/khtml/html/html_elementimpl.cpp
@@ -288,11 +288,11 @@ DOMString HTMLElementImpl::innerText() const
     return text;
 }
 
-bool HTMLElementImpl::setInnerHTML( const DOMString &html )
+DocumentFragmentImpl *HTMLElementImpl::createContextualFragment( const DOMString &html )
 {
     // the following is in accordance with the definition as used by IE
     if( endTag[id()] == FORBIDDEN )
-        return false;
+        return NULL;
     // IE disallows innerHTML on inline elements. I don't see why we should have this restriction, as our
     // dhtml engine can cope with it. Lars
     //if ( isInline() ) return false;
@@ -309,12 +309,12 @@ bool HTMLElementImpl::setInnerHTML( const DOMString &html )
         case ID_THEAD:
         case ID_TITLE:
         case ID_TR:
-            return false;
+            return NULL;
         default:
             break;
     }
     if ( !getDocument()->isHTMLDocument() )
-        return false;
+        return NULL;
 
     DocumentFragmentImpl *fragment = new DocumentFragmentImpl( docPtr() );
     HTMLTokenizer *tok = new HTMLTokenizer( docPtr(), fragment );
@@ -323,6 +323,16 @@ bool HTMLElementImpl::setInnerHTML( const DOMString &html )
     tok->end();
     delete tok;
 
+    return fragment;
+}
+
+bool HTMLElementImpl::setInnerHTML( const DOMString &html )
+{
+    DocumentFragmentImpl *fragment = createContextualFragment( html );
+    if (fragment == NULL) {
+	return false;
+    }
+
     removeChildren();
     int ec = 0;
     appendChild( fragment, ec );
diff --git a/WebCore/khtml/html/html_elementimpl.h b/WebCore/khtml/html/html_elementimpl.h
index b0cde1d..106cee4 100644
--- a/WebCore/khtml/html/html_elementimpl.h
+++ b/WebCore/khtml/html/html_elementimpl.h
@@ -30,6 +30,7 @@ namespace DOM {
 class DOMString;
 class CSSStyleDeclarationImpl;
 class HTMLFormElementImpl;
+ class DocumentFragmentImpl;
 
 class HTMLElementImpl : public ElementImpl
 {
@@ -53,6 +54,7 @@ public:
 
     DOMString innerHTML() const;
     DOMString innerText() const;
+    DocumentFragmentImpl *createContextualFragment( const DOMString &html );
     bool setInnerHTML( const DOMString &html );
     bool setInnerText( const DOMString &text );
 
diff --git a/WebCore/khtml/xml/dom2_rangeimpl.cpp b/WebCore/khtml/xml/dom2_rangeimpl.cpp
index 04ae771..adc79c3 100644
--- a/WebCore/khtml/xml/dom2_rangeimpl.cpp
+++ b/WebCore/khtml/xml/dom2_rangeimpl.cpp
@@ -27,6 +27,7 @@
 #include "dom2_rangeimpl.h"
 #include "dom_textimpl.h"
 #include "dom_xmlimpl.h"
+#include "html/html_elementimpl.h"
 
 using namespace DOM;
 
@@ -845,6 +846,29 @@ DOMString RangeImpl::toHTML(  )
     return DOMString();
 }
 
+DocumentFragmentImpl *RangeImpl::createContextualFragment ( DOMString &html, int &exceptioncode )
+{
+   if (m_detached) {
+        exceptioncode = DOMException::INVALID_STATE_ERR;
+        return NULL;
+    }
+
+    if (! m_startContainer->isHTMLElement()) {
+	exceptioncode = DOMException::NOT_SUPPORTED_ERR;
+	return NULL;
+    }
+
+    HTMLElementImpl *e = static_cast<HTMLElementImpl *>(m_startContainer);
+    DocumentFragmentImpl *fragment = e->createContextualFragment(html);
+    if (!fragment) {
+	exceptioncode = DOMException::NOT_SUPPORTED_ERR;
+	return NULL;
+    }
+
+    return fragment;
+}
+
+
 void RangeImpl::detach( int &exceptioncode )
 {
     if (m_detached) {
diff --git a/WebCore/khtml/xml/dom2_rangeimpl.h b/WebCore/khtml/xml/dom2_rangeimpl.h
index a29b9d5..6387418 100644
--- a/WebCore/khtml/xml/dom2_rangeimpl.h
+++ b/WebCore/khtml/xml/dom2_rangeimpl.h
@@ -63,6 +63,9 @@ public:
     void insertNode( NodeImpl *newNode, int &exceptioncode );
     DOMString toString ( int &exceptioncode );
     DOMString toHTML (  );
+
+    DocumentFragmentImpl *createContextualFragment ( DOMString &html, int &exceptioncode );
+    
     void detach ( int &exceptioncode );
     bool isDetached() const;
     RangeImpl *cloneRange(int &exceptioncode);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list