webengine/osswebengine/DerivedSources/WebCore/JSRange.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2     This file is part of the WebKit open source project.
       
     3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #include "config.h"
       
    22 
       
    23 #include "JSRange.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "DocumentFragment.h"
       
    28 #include "ExceptionCode.h"
       
    29 #include "JSDocumentFragment.h"
       
    30 #include "JSNode.h"
       
    31 #include "JSRange.h"
       
    32 #include "Node.h"
       
    33 #include "PlatformString.h"
       
    34 #include "Range.h"
       
    35 
       
    36 using namespace KJS;
       
    37 
       
    38 namespace WebCore {
       
    39 
       
    40 /* Hash table */
       
    41 
       
    42 static const HashEntry JSRangeTableEntries[] =
       
    43 {
       
    44     { "endOffset", JSRange::EndOffsetAttrNum, DontDelete|ReadOnly, 0, &JSRangeTableEntries[7] },
       
    45     { "startOffset", JSRange::StartOffsetAttrNum, DontDelete|ReadOnly, 0, &JSRangeTableEntries[8] },
       
    46     { "endContainer", JSRange::EndContainerAttrNum, DontDelete|ReadOnly, 0, &JSRangeTableEntries[9] },
       
    47     { 0, 0, 0, 0, 0 },
       
    48     { 0, 0, 0, 0, 0 },
       
    49     { "startContainer", JSRange::StartContainerAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    50     { 0, 0, 0, 0, 0 },
       
    51     { "collapsed", JSRange::CollapsedAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    52     { "commonAncestorContainer", JSRange::CommonAncestorContainerAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    53     { "constructor", JSRange::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    54 };
       
    55 
       
    56 static const HashTable JSRangeTable = 
       
    57 {
       
    58     2, 10, JSRangeTableEntries, 7
       
    59 };
       
    60 
       
    61 /* Hash table for constructor */
       
    62 
       
    63 static const HashEntry JSRangeConstructorTableEntries[] =
       
    64 {
       
    65     { "START_TO_START", Range::START_TO_START, DontDelete|ReadOnly, 0, 0 },
       
    66     { "NODE_AFTER", Range::NODE_AFTER, DontDelete|ReadOnly, 0, 0 },
       
    67     { 0, 0, 0, 0, 0 },
       
    68     { 0, 0, 0, 0, 0 },
       
    69     { 0, 0, 0, 0, 0 },
       
    70     { "NODE_BEFORE", Range::NODE_BEFORE, DontDelete|ReadOnly, 0, 0 },
       
    71     { "START_TO_END", Range::START_TO_END, DontDelete|ReadOnly, 0, &JSRangeConstructorTableEntries[9] },
       
    72     { "END_TO_END", Range::END_TO_END, DontDelete|ReadOnly, 0, &JSRangeConstructorTableEntries[8] },
       
    73     { "END_TO_START", Range::END_TO_START, DontDelete|ReadOnly, 0, 0 },
       
    74     { "NODE_BEFORE_AND_AFTER", Range::NODE_BEFORE_AND_AFTER, DontDelete|ReadOnly, 0, &JSRangeConstructorTableEntries[10] },
       
    75     { "NODE_INSIDE", Range::NODE_INSIDE, DontDelete|ReadOnly, 0, 0 }
       
    76 };
       
    77 
       
    78 static const HashTable JSRangeConstructorTable = 
       
    79 {
       
    80     2, 11, JSRangeConstructorTableEntries, 8
       
    81 };
       
    82 
       
    83 class JSRangeConstructor : public DOMObject {
       
    84 public:
       
    85     JSRangeConstructor(ExecState* exec)
       
    86     {
       
    87         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    88         putDirect(exec->propertyNames().prototype, JSRangePrototype::self(exec), None);
       
    89     }
       
    90     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    91     JSValue* getValueProperty(ExecState*, int token) const;
       
    92     virtual const ClassInfo* classInfo() const { return &info; }
       
    93     static const ClassInfo info;
       
    94 
       
    95     virtual bool implementsHasInstance() const { return true; }
       
    96 };
       
    97 
       
    98 const ClassInfo JSRangeConstructor::info = { "RangeConstructor", 0, &JSRangeConstructorTable, 0 };
       
    99 
       
   100 bool JSRangeConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   101 {
       
   102     return getStaticValueSlot<JSRangeConstructor, DOMObject>(exec, &JSRangeConstructorTable, this, propertyName, slot);
       
   103 }
       
   104 
       
   105 JSValue* JSRangeConstructor::getValueProperty(ExecState*, int token) const
       
   106 {
       
   107     // The token is the numeric value of its associated constant
       
   108     return jsNumber(token);
       
   109 }
       
   110 
       
   111 /* Hash table for prototype */
       
   112 
       
   113 static const HashEntry JSRangePrototypeTableEntries[] =
       
   114 {
       
   115     { "START_TO_START", Range::START_TO_START, DontDelete|ReadOnly, 0, 0 },
       
   116     { "setEnd", JSRange::SetEndFuncNum, DontDelete|Function, 2, &JSRangePrototypeTableEntries[38] },
       
   117     { "selectNode", JSRange::SelectNodeFuncNum, DontDelete|Function, 1, 0 },
       
   118     { "setStartAfter", JSRange::SetStartAfterFuncNum, DontDelete|Function, 1, 0 },
       
   119     { "START_TO_END", Range::START_TO_END, DontDelete|ReadOnly, 0, 0 },
       
   120     { "cloneContents", JSRange::CloneContentsFuncNum, DontDelete|Function, 0, &JSRangePrototypeTableEntries[39] },
       
   121     { "NODE_BEFORE", Range::NODE_BEFORE, DontDelete|ReadOnly, 0, &JSRangePrototypeTableEntries[31] },
       
   122     { "setEndAfter", JSRange::SetEndAfterFuncNum, DontDelete|Function, 1, 0 },
       
   123     { "NODE_INSIDE", Range::NODE_INSIDE, DontDelete|ReadOnly, 0, 0 },
       
   124     { 0, 0, 0, 0, 0 },
       
   125     { 0, 0, 0, 0, 0 },
       
   126     { "surroundContents", JSRange::SurroundContentsFuncNum, DontDelete|Function, 1, 0 },
       
   127     { "insertNode", JSRange::InsertNodeFuncNum, DontDelete|Function, 1, &JSRangePrototypeTableEntries[35] },
       
   128     { "END_TO_END", Range::END_TO_END, DontDelete|ReadOnly, 0, 0 },
       
   129     { "setStartBefore", JSRange::SetStartBeforeFuncNum, DontDelete|Function, 1, &JSRangePrototypeTableEntries[40] },
       
   130     { 0, 0, 0, 0, 0 },
       
   131     { 0, 0, 0, 0, 0 },
       
   132     { "cloneRange", JSRange::CloneRangeFuncNum, DontDelete|Function, 0, 0 },
       
   133     { 0, 0, 0, 0, 0 },
       
   134     { "NODE_BEFORE_AND_AFTER", Range::NODE_BEFORE_AND_AFTER, DontDelete|ReadOnly, 0, 0 },
       
   135     { "selectNodeContents", JSRange::SelectNodeContentsFuncNum, DontDelete|Function, 1, &JSRangePrototypeTableEntries[33] },
       
   136     { 0, 0, 0, 0, 0 },
       
   137     { "detach", JSRange::DetachFuncNum, DontDelete|Function, 0, 0 },
       
   138     { "setStart", JSRange::SetStartFuncNum, DontDelete|Function, 2, &JSRangePrototypeTableEntries[36] },
       
   139     { "NODE_AFTER", Range::NODE_AFTER, DontDelete|ReadOnly, 0, &JSRangePrototypeTableEntries[34] },
       
   140     { "compareBoundaryPoints", JSRange::CompareBoundaryPointsFuncNum, DontDelete|Function, 2, 0 },
       
   141     { "END_TO_START", Range::END_TO_START, DontDelete|ReadOnly, 0, &JSRangePrototypeTableEntries[32] },
       
   142     { 0, 0, 0, 0, 0 },
       
   143     { 0, 0, 0, 0, 0 },
       
   144     { 0, 0, 0, 0, 0 },
       
   145     { 0, 0, 0, 0, 0 },
       
   146     { "setEndBefore", JSRange::SetEndBeforeFuncNum, DontDelete|Function, 1, 0 },
       
   147     { "collapse", JSRange::CollapseFuncNum, DontDelete|Function, 1, 0 },
       
   148     { "deleteContents", JSRange::DeleteContentsFuncNum, DontDelete|Function, 0, &JSRangePrototypeTableEntries[37] },
       
   149     { "extractContents", JSRange::ExtractContentsFuncNum, DontDelete|Function, 0, 0 },
       
   150     { "toString", JSRange::ToStringFuncNum, DontDelete|Function, 0, 0 },
       
   151     { "createContextualFragment", JSRange::CreateContextualFragmentFuncNum, DontDelete|Function, 1, 0 },
       
   152     { "intersectsNode", JSRange::IntersectsNodeFuncNum, DontDelete|Function, 1, 0 },
       
   153     { "compareNode", JSRange::CompareNodeFuncNum, DontDelete|Function, 1, 0 },
       
   154     { "comparePoint", JSRange::ComparePointFuncNum, DontDelete|Function, 2, 0 },
       
   155     { "isPointInRange", JSRange::IsPointInRangeFuncNum, DontDelete|Function, 2, 0 }
       
   156 };
       
   157 
       
   158 static const HashTable JSRangePrototypeTable = 
       
   159 {
       
   160     2, 41, JSRangePrototypeTableEntries, 31
       
   161 };
       
   162 
       
   163 const ClassInfo JSRangePrototype::info = { "RangePrototype", 0, &JSRangePrototypeTable, 0 };
       
   164 
       
   165 JSObject* JSRangePrototype::self(ExecState* exec)
       
   166 {
       
   167     return KJS::cacheGlobalObject<JSRangePrototype>(exec, "[[JSRange.prototype]]");
       
   168 }
       
   169 
       
   170 bool JSRangePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   171 {
       
   172     return getStaticPropertySlot<JSRangePrototypeFunction, JSRangePrototype, JSObject>(exec, &JSRangePrototypeTable, this, propertyName, slot);
       
   173 }
       
   174 
       
   175 JSValue* JSRangePrototype::getValueProperty(ExecState*, int token) const
       
   176 {
       
   177     // The token is the numeric value of its associated constant
       
   178     return jsNumber(token);
       
   179 }
       
   180 
       
   181 const ClassInfo JSRange::info = { "Range", 0, &JSRangeTable, 0 };
       
   182 
       
   183 JSRange::JSRange(ExecState* exec, Range* impl)
       
   184     : m_impl(impl)
       
   185 {
       
   186     setPrototype(JSRangePrototype::self(exec));
       
   187 }
       
   188 
       
   189 JSRange::~JSRange()
       
   190 {
       
   191     ScriptInterpreter::forgetDOMObject(m_impl.get());
       
   192 }
       
   193 
       
   194 bool JSRange::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   195 {
       
   196     return getStaticValueSlot<JSRange, KJS::DOMObject>(exec, &JSRangeTable, this, propertyName, slot);
       
   197 }
       
   198 
       
   199 JSValue* JSRange::getValueProperty(ExecState* exec, int token) const
       
   200 {
       
   201     switch (token) {
       
   202     case StartContainerAttrNum: {
       
   203         ExceptionCode ec = 0;
       
   204         Range* imp = static_cast<Range*>(impl());
       
   205 
       
   206         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->startContainer(ec)));
       
   207         setDOMException(exec, ec);
       
   208         return result;
       
   209     }
       
   210     case StartOffsetAttrNum: {
       
   211         ExceptionCode ec = 0;
       
   212         Range* imp = static_cast<Range*>(impl());
       
   213 
       
   214         KJS::JSValue* result = jsNumber(imp->startOffset(ec));
       
   215         setDOMException(exec, ec);
       
   216         return result;
       
   217     }
       
   218     case EndContainerAttrNum: {
       
   219         ExceptionCode ec = 0;
       
   220         Range* imp = static_cast<Range*>(impl());
       
   221 
       
   222         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->endContainer(ec)));
       
   223         setDOMException(exec, ec);
       
   224         return result;
       
   225     }
       
   226     case EndOffsetAttrNum: {
       
   227         ExceptionCode ec = 0;
       
   228         Range* imp = static_cast<Range*>(impl());
       
   229 
       
   230         KJS::JSValue* result = jsNumber(imp->endOffset(ec));
       
   231         setDOMException(exec, ec);
       
   232         return result;
       
   233     }
       
   234     case CollapsedAttrNum: {
       
   235         ExceptionCode ec = 0;
       
   236         Range* imp = static_cast<Range*>(impl());
       
   237 
       
   238         KJS::JSValue* result = jsBoolean(imp->collapsed(ec));
       
   239         setDOMException(exec, ec);
       
   240         return result;
       
   241     }
       
   242     case CommonAncestorContainerAttrNum: {
       
   243         ExceptionCode ec = 0;
       
   244         Range* imp = static_cast<Range*>(impl());
       
   245 
       
   246         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->commonAncestorContainer(ec)));
       
   247         setDOMException(exec, ec);
       
   248         return result;
       
   249     }
       
   250     case ConstructorAttrNum:
       
   251         return getConstructor(exec);
       
   252     }
       
   253     return 0;
       
   254 }
       
   255 
       
   256 JSValue* JSRange::getConstructor(ExecState* exec)
       
   257 {
       
   258     return KJS::cacheGlobalObject<JSRangeConstructor>(exec, "[[Range.constructor]]");
       
   259 }
       
   260 JSValue* JSRangePrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   261 {
       
   262     if (!thisObj->inherits(&JSRange::info))
       
   263       return throwError(exec, TypeError);
       
   264 
       
   265     Range* imp = static_cast<Range*>(static_cast<JSRange*>(thisObj)->impl());
       
   266 
       
   267     switch (id) {
       
   268     case JSRange::SetStartFuncNum: {
       
   269         ExceptionCode ec = 0;
       
   270         Node* refNode = toNode(args[0]);
       
   271         bool offsetOk;
       
   272         int offset = args[1]->toInt32(exec, offsetOk);
       
   273         if (!offsetOk) {
       
   274             setDOMException(exec, TYPE_MISMATCH_ERR);
       
   275             return jsUndefined();
       
   276         }
       
   277 
       
   278         imp->setStart(refNode, offset, ec);
       
   279         setDOMException(exec, ec);
       
   280         return jsUndefined();
       
   281     }
       
   282     case JSRange::SetEndFuncNum: {
       
   283         ExceptionCode ec = 0;
       
   284         Node* refNode = toNode(args[0]);
       
   285         bool offsetOk;
       
   286         int offset = args[1]->toInt32(exec, offsetOk);
       
   287         if (!offsetOk) {
       
   288             setDOMException(exec, TYPE_MISMATCH_ERR);
       
   289             return jsUndefined();
       
   290         }
       
   291 
       
   292         imp->setEnd(refNode, offset, ec);
       
   293         setDOMException(exec, ec);
       
   294         return jsUndefined();
       
   295     }
       
   296     case JSRange::SetStartBeforeFuncNum: {
       
   297         ExceptionCode ec = 0;
       
   298         Node* refNode = toNode(args[0]);
       
   299 
       
   300         imp->setStartBefore(refNode, ec);
       
   301         setDOMException(exec, ec);
       
   302         return jsUndefined();
       
   303     }
       
   304     case JSRange::SetStartAfterFuncNum: {
       
   305         ExceptionCode ec = 0;
       
   306         Node* refNode = toNode(args[0]);
       
   307 
       
   308         imp->setStartAfter(refNode, ec);
       
   309         setDOMException(exec, ec);
       
   310         return jsUndefined();
       
   311     }
       
   312     case JSRange::SetEndBeforeFuncNum: {
       
   313         ExceptionCode ec = 0;
       
   314         Node* refNode = toNode(args[0]);
       
   315 
       
   316         imp->setEndBefore(refNode, ec);
       
   317         setDOMException(exec, ec);
       
   318         return jsUndefined();
       
   319     }
       
   320     case JSRange::SetEndAfterFuncNum: {
       
   321         ExceptionCode ec = 0;
       
   322         Node* refNode = toNode(args[0]);
       
   323 
       
   324         imp->setEndAfter(refNode, ec);
       
   325         setDOMException(exec, ec);
       
   326         return jsUndefined();
       
   327     }
       
   328     case JSRange::CollapseFuncNum: {
       
   329         ExceptionCode ec = 0;
       
   330         bool toStart = args[0]->toBoolean(exec);
       
   331 
       
   332         imp->collapse(toStart, ec);
       
   333         setDOMException(exec, ec);
       
   334         return jsUndefined();
       
   335     }
       
   336     case JSRange::SelectNodeFuncNum: {
       
   337         ExceptionCode ec = 0;
       
   338         Node* refNode = toNode(args[0]);
       
   339 
       
   340         imp->selectNode(refNode, ec);
       
   341         setDOMException(exec, ec);
       
   342         return jsUndefined();
       
   343     }
       
   344     case JSRange::SelectNodeContentsFuncNum: {
       
   345         ExceptionCode ec = 0;
       
   346         Node* refNode = toNode(args[0]);
       
   347 
       
   348         imp->selectNodeContents(refNode, ec);
       
   349         setDOMException(exec, ec);
       
   350         return jsUndefined();
       
   351     }
       
   352     case JSRange::CompareBoundaryPointsFuncNum: {
       
   353         ExceptionCode ec = 0;
       
   354         Range::CompareHow how = static_cast<Range::CompareHow>(args[0]->toInt32(exec));
       
   355         Range* sourceRange = toRange(args[1]);
       
   356 
       
   357 
       
   358         KJS::JSValue* result = jsNumber(imp->compareBoundaryPoints(how, sourceRange, ec));
       
   359         setDOMException(exec, ec);
       
   360         return result;
       
   361     }
       
   362     case JSRange::DeleteContentsFuncNum: {
       
   363         ExceptionCode ec = 0;
       
   364 
       
   365         imp->deleteContents(ec);
       
   366         setDOMException(exec, ec);
       
   367         return jsUndefined();
       
   368     }
       
   369     case JSRange::ExtractContentsFuncNum: {
       
   370         ExceptionCode ec = 0;
       
   371 
       
   372 
       
   373         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->extractContents(ec)));
       
   374         setDOMException(exec, ec);
       
   375         return result;
       
   376     }
       
   377     case JSRange::CloneContentsFuncNum: {
       
   378         ExceptionCode ec = 0;
       
   379 
       
   380 
       
   381         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->cloneContents(ec)));
       
   382         setDOMException(exec, ec);
       
   383         return result;
       
   384     }
       
   385     case JSRange::InsertNodeFuncNum: {
       
   386         ExceptionCode ec = 0;
       
   387         Node* newNode = toNode(args[0]);
       
   388 
       
   389         imp->insertNode(newNode, ec);
       
   390         setDOMException(exec, ec);
       
   391         return jsUndefined();
       
   392     }
       
   393     case JSRange::SurroundContentsFuncNum: {
       
   394         ExceptionCode ec = 0;
       
   395         Node* newParent = toNode(args[0]);
       
   396 
       
   397         imp->surroundContents(newParent, ec);
       
   398         setDOMException(exec, ec);
       
   399         return jsUndefined();
       
   400     }
       
   401     case JSRange::CloneRangeFuncNum: {
       
   402         ExceptionCode ec = 0;
       
   403 
       
   404 
       
   405         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->cloneRange(ec)));
       
   406         setDOMException(exec, ec);
       
   407         return result;
       
   408     }
       
   409     case JSRange::ToStringFuncNum: {
       
   410         ExceptionCode ec = 0;
       
   411 
       
   412 
       
   413         KJS::JSValue* result = jsString(imp->toString(ec));
       
   414         setDOMException(exec, ec);
       
   415         return result;
       
   416     }
       
   417     case JSRange::DetachFuncNum: {
       
   418         ExceptionCode ec = 0;
       
   419 
       
   420         imp->detach(ec);
       
   421         setDOMException(exec, ec);
       
   422         return jsUndefined();
       
   423     }
       
   424     case JSRange::CreateContextualFragmentFuncNum: {
       
   425         ExceptionCode ec = 0;
       
   426         String html = args[0]->toString(exec);
       
   427 
       
   428 
       
   429         KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->createContextualFragment(html, ec)));
       
   430         setDOMException(exec, ec);
       
   431         return result;
       
   432     }
       
   433     case JSRange::IntersectsNodeFuncNum: {
       
   434         ExceptionCode ec = 0;
       
   435         Node* refNode = toNode(args[0]);
       
   436 
       
   437 
       
   438         KJS::JSValue* result = jsBoolean(imp->intersectsNode(refNode, ec));
       
   439         setDOMException(exec, ec);
       
   440         return result;
       
   441     }
       
   442     case JSRange::CompareNodeFuncNum: {
       
   443         ExceptionCode ec = 0;
       
   444         Node* refNode = toNode(args[0]);
       
   445 
       
   446 
       
   447         KJS::JSValue* result = jsNumber(imp->compareNode(refNode, ec));
       
   448         setDOMException(exec, ec);
       
   449         return result;
       
   450     }
       
   451     case JSRange::ComparePointFuncNum: {
       
   452         ExceptionCode ec = 0;
       
   453         Node* refNode = toNode(args[0]);
       
   454         bool offsetOk;
       
   455         int offset = args[1]->toInt32(exec, offsetOk);
       
   456         if (!offsetOk) {
       
   457             setDOMException(exec, TYPE_MISMATCH_ERR);
       
   458             return jsUndefined();
       
   459         }
       
   460 
       
   461 
       
   462         KJS::JSValue* result = jsNumber(imp->comparePoint(refNode, offset, ec));
       
   463         setDOMException(exec, ec);
       
   464         return result;
       
   465     }
       
   466     case JSRange::IsPointInRangeFuncNum: {
       
   467         ExceptionCode ec = 0;
       
   468         Node* refNode = toNode(args[0]);
       
   469         bool offsetOk;
       
   470         int offset = args[1]->toInt32(exec, offsetOk);
       
   471         if (!offsetOk) {
       
   472             setDOMException(exec, TYPE_MISMATCH_ERR);
       
   473             return jsUndefined();
       
   474         }
       
   475 
       
   476 
       
   477         KJS::JSValue* result = jsBoolean(imp->isPointInRange(refNode, offset, ec));
       
   478         setDOMException(exec, ec);
       
   479         return result;
       
   480     }
       
   481     }
       
   482     return 0;
       
   483 }
       
   484 KJS::JSValue* toJS(KJS::ExecState* exec, Range* obj)
       
   485 {
       
   486     return KJS::cacheDOMObject<Range, JSRange>(exec, obj);
       
   487 }
       
   488 Range* toRange(KJS::JSValue* val)
       
   489 {
       
   490     return val->isObject(&JSRange::info) ? static_cast<JSRange*>(val)->impl() : 0;
       
   491 }
       
   492 
       
   493 }