WebKit/win/DOMHTMLClasses.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
       
     3  *
       
     4  * Redistribution and use in source and binary forms, with or without
       
     5  * modification, are permitted provided that the following conditions
       
     6  * are met:
       
     7  * 1. Redistributions of source code must retain the above copyright
       
     8  *    notice, this list of conditions and the following disclaimer.
       
     9  * 2. Redistributions in binary form must reproduce the above copyright
       
    10  *    notice, this list of conditions and the following disclaimer in the
       
    11  *    documentation and/or other materials provided with the distribution.
       
    12  *
       
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
       
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
       
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
       
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
       
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
       
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
       
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
       
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
       
    24  */
       
    25 
       
    26 #include "config.h"
       
    27 #include "WebKitDLL.h"
       
    28 #include "DOMHTMLClasses.h"
       
    29 #include "COMPtr.h"
       
    30 #include "WebFrame.h"
       
    31 
       
    32 #pragma warning(push, 0)
       
    33 #include <WebCore/BString.h>
       
    34 #include <WebCore/Document.h>
       
    35 #include <WebCore/Element.h>
       
    36 #include <WebCore/FrameView.h>
       
    37 #include <WebCore/HTMLCollection.h>
       
    38 #include <WebCore/HTMLDocument.h>
       
    39 #include <WebCore/HTMLFormElement.h>
       
    40 #include <WebCore/HTMLIFrameElement.h>
       
    41 #include <WebCore/HTMLInputElement.h>
       
    42 #include <WebCore/HTMLNames.h>
       
    43 #include <WebCore/HTMLOptionElement.h>
       
    44 #include <WebCore/HTMLOptionsCollection.h>
       
    45 #include <WebCore/HTMLSelectElement.h>
       
    46 #include <WebCore/HTMLTextAreaElement.h>
       
    47 #include <WebCore/IntRect.h>
       
    48 #include <WebCore/RenderObject.h>
       
    49 #include <WebCore/RenderTextControl.h>
       
    50 #pragma warning(pop)
       
    51 
       
    52 using namespace WebCore;
       
    53 using namespace HTMLNames;
       
    54 
       
    55 // DOMHTMLCollection
       
    56 
       
    57 DOMHTMLCollection::DOMHTMLCollection(WebCore::HTMLCollection* c)
       
    58 : m_collection(c)
       
    59 {
       
    60 }
       
    61 
       
    62 IDOMHTMLCollection* DOMHTMLCollection::createInstance(WebCore::HTMLCollection* c)
       
    63 {
       
    64     if (!c)
       
    65         return 0;
       
    66 
       
    67     IDOMHTMLCollection* htmlCollection = 0;
       
    68     DOMHTMLCollection* newCollection = new DOMHTMLCollection(c);
       
    69     if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLCollection, (void**)&htmlCollection))) {
       
    70         delete newCollection;
       
    71         return 0;
       
    72     }
       
    73 
       
    74     return htmlCollection;
       
    75 }
       
    76 
       
    77 // DOMHTMLCollection - IUnknown -----------------------------------------------
       
    78 
       
    79 HRESULT STDMETHODCALLTYPE DOMHTMLCollection::QueryInterface(REFIID riid, void** ppvObject)
       
    80 {
       
    81     *ppvObject = 0;
       
    82     if (IsEqualGUID(riid, IID_IDOMHTMLCollection))
       
    83         *ppvObject = static_cast<IDOMHTMLCollection*>(this);
       
    84     else
       
    85         return DOMObject::QueryInterface(riid, ppvObject);
       
    86 
       
    87     AddRef();
       
    88     return S_OK;
       
    89 }
       
    90 
       
    91 // DOMHTMLCollection ----------------------------------------------------------
       
    92 
       
    93 HRESULT STDMETHODCALLTYPE DOMHTMLCollection::length( 
       
    94     /* [retval][out] */ UINT* result)
       
    95 {
       
    96     *result = 0;
       
    97     if (!m_collection)
       
    98         return E_POINTER;
       
    99 
       
   100     *result = m_collection->length();
       
   101     return S_OK;
       
   102 }
       
   103 
       
   104 HRESULT STDMETHODCALLTYPE DOMHTMLCollection::item( 
       
   105     /* [in] */ UINT index,
       
   106     /* [retval][out] */ IDOMNode** node)
       
   107 {
       
   108     *node = 0;
       
   109     if (!m_collection)
       
   110         return E_POINTER;
       
   111 
       
   112     *node = DOMNode::createInstance(m_collection->item(index));
       
   113     return *node ? S_OK : E_FAIL;
       
   114 }
       
   115 
       
   116 HRESULT STDMETHODCALLTYPE DOMHTMLCollection::namedItem( 
       
   117     /* [in] */ BSTR /*name*/,
       
   118     /* [retval][out] */ IDOMNode** /*node*/)
       
   119 {
       
   120     ASSERT_NOT_REACHED();
       
   121     return E_NOTIMPL;
       
   122 }
       
   123 
       
   124 // DOMHTMLOptionsCollection - IUnknown ----------------------------------------
       
   125 
       
   126 HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::QueryInterface(REFIID riid, void** ppvObject)
       
   127 {
       
   128     *ppvObject = 0;
       
   129     if (IsEqualGUID(riid, IID_IDOMHTMLOptionsCollection))
       
   130         *ppvObject = static_cast<IDOMHTMLOptionsCollection*>(this);
       
   131     else
       
   132         return DOMObject::QueryInterface(riid, ppvObject);
       
   133 
       
   134     AddRef();
       
   135     return S_OK;
       
   136 }
       
   137 
       
   138 // DOMHTMLOptionsCollection ---------------------------------------------------
       
   139 
       
   140 DOMHTMLOptionsCollection::DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection* collection)
       
   141     : m_collection(collection)
       
   142 {
       
   143 }
       
   144 
       
   145 IDOMHTMLOptionsCollection* DOMHTMLOptionsCollection::createInstance(WebCore::HTMLOptionsCollection* collection)
       
   146 {
       
   147     if (!collection)
       
   148         return 0;
       
   149 
       
   150     IDOMHTMLOptionsCollection* optionsCollection = 0;
       
   151     DOMHTMLOptionsCollection* newCollection = new DOMHTMLOptionsCollection(collection);
       
   152     if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLOptionsCollection, (void**)&optionsCollection))) {
       
   153         delete newCollection;
       
   154         return 0;
       
   155     }
       
   156 
       
   157     return optionsCollection;
       
   158 }
       
   159 
       
   160 HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::length( 
       
   161     /* [retval][out] */ unsigned int* result)
       
   162 {
       
   163     if (!result)
       
   164         return E_POINTER;
       
   165 
       
   166     *result = m_collection->length();
       
   167     return S_OK;
       
   168 }
       
   169 
       
   170 HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength( 
       
   171     /* [in] */ unsigned int /*length*/)
       
   172 {
       
   173     ASSERT_NOT_REACHED();
       
   174     return E_NOTIMPL;
       
   175 }
       
   176 
       
   177 HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::item( 
       
   178     /* [in] */ unsigned int index,
       
   179     /* [retval][out] */ IDOMNode** result)
       
   180 {
       
   181     if (!result)
       
   182         return E_POINTER;
       
   183 
       
   184     *result = DOMNode::createInstance(m_collection->item(index));
       
   185 
       
   186     return *result ? S_OK : E_FAIL;
       
   187 }
       
   188 
       
   189 HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::namedItem( 
       
   190     /* [in] */ BSTR /*name*/,
       
   191     /* [retval][out] */ IDOMNode** /*result*/)
       
   192 {
       
   193     ASSERT_NOT_REACHED();
       
   194     return E_NOTIMPL;
       
   195 }
       
   196 
       
   197 // DOMHTMLDocument - IUnknown -------------------------------------------------
       
   198 
       
   199 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::QueryInterface(REFIID riid, void** ppvObject)
       
   200 {
       
   201     *ppvObject = 0;
       
   202     if (IsEqualGUID(riid, IID_IDOMHTMLDocument))
       
   203         *ppvObject = static_cast<IDOMHTMLDocument*>(this);
       
   204     else
       
   205         return DOMDocument::QueryInterface(riid, ppvObject);
       
   206 
       
   207     AddRef();
       
   208     return S_OK;
       
   209 }
       
   210 
       
   211 // DOMHTMLDocument ------------------------------------------------------------
       
   212 
       
   213 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::title( 
       
   214         /* [retval][out] */ BSTR* result)
       
   215 {
       
   216     if (!result)
       
   217         return E_POINTER;
       
   218 
       
   219     *result = 0;
       
   220 
       
   221     if (!m_document || !m_document->isHTMLDocument())
       
   222         return E_FAIL;
       
   223 
       
   224     *result = BString(m_document->title()).release();
       
   225     return S_OK;
       
   226 }
       
   227     
       
   228 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setTitle( 
       
   229         /* [in] */ BSTR /*title*/)
       
   230 {
       
   231     ASSERT_NOT_REACHED();
       
   232     return E_NOTIMPL;
       
   233 }
       
   234     
       
   235 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::referrer( 
       
   236         /* [retval][out] */ BSTR* /*result*/)
       
   237 {
       
   238     ASSERT_NOT_REACHED();
       
   239     return E_NOTIMPL;
       
   240 }
       
   241     
       
   242 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::domain( 
       
   243         /* [retval][out] */ BSTR* /*result*/)
       
   244 {
       
   245     ASSERT_NOT_REACHED();
       
   246     return E_NOTIMPL;
       
   247 }
       
   248     
       
   249 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::URL( 
       
   250         /* [retval][out] */ BSTR* result)
       
   251 {
       
   252     if (!result)
       
   253         return E_POINTER;
       
   254 
       
   255     *result = BString(static_cast<HTMLDocument*>(m_document)->url()).release();
       
   256     return S_OK;
       
   257 }
       
   258     
       
   259 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::body( 
       
   260         /* [retval][out] */ IDOMHTMLElement** bodyElement)
       
   261 {
       
   262     *bodyElement = 0;
       
   263     if (!m_document || !m_document->isHTMLDocument())
       
   264         return E_FAIL;
       
   265 
       
   266     HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);
       
   267     COMPtr<IDOMElement> domElement;
       
   268     domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc->body()));
       
   269     if (domElement)
       
   270         return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) bodyElement);
       
   271     return E_FAIL;
       
   272 }
       
   273     
       
   274 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setBody( 
       
   275         /* [in] */ IDOMHTMLElement* /*body*/)
       
   276 {
       
   277     ASSERT_NOT_REACHED();
       
   278     return E_NOTIMPL;
       
   279 }
       
   280     
       
   281 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::images( 
       
   282         /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
       
   283 {
       
   284     ASSERT_NOT_REACHED();
       
   285     return E_NOTIMPL;
       
   286 }
       
   287     
       
   288 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::applets( 
       
   289         /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
       
   290 {
       
   291     ASSERT_NOT_REACHED();
       
   292     return E_NOTIMPL;
       
   293 }
       
   294     
       
   295 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::links( 
       
   296         /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
       
   297 {
       
   298     ASSERT_NOT_REACHED();
       
   299     return E_NOTIMPL;
       
   300 }
       
   301     
       
   302 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::forms( 
       
   303         /* [retval][out] */ IDOMHTMLCollection** collection)
       
   304 {
       
   305     *collection = 0;
       
   306     if (!m_document || !m_document->isHTMLDocument())
       
   307         return E_FAIL;
       
   308 
       
   309     HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);
       
   310     *collection = DOMHTMLCollection::createInstance(htmlDoc->forms().get());
       
   311     return S_OK;
       
   312 }
       
   313     
       
   314 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::anchors( 
       
   315         /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
       
   316 {
       
   317     ASSERT_NOT_REACHED();
       
   318     return E_NOTIMPL;
       
   319 }
       
   320     
       
   321 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::cookie( 
       
   322         /* [retval][out] */ BSTR* /*result*/)
       
   323 {
       
   324     ASSERT_NOT_REACHED();
       
   325     return E_NOTIMPL;
       
   326 }
       
   327     
       
   328 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setCookie( 
       
   329         /* [in] */ BSTR /*cookie*/)
       
   330 {
       
   331     ASSERT_NOT_REACHED();
       
   332     return E_NOTIMPL;
       
   333 }
       
   334     
       
   335 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::open( void)
       
   336 {
       
   337     ASSERT_NOT_REACHED();
       
   338     return E_NOTIMPL;
       
   339 }
       
   340     
       
   341 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::close( void)
       
   342 {
       
   343     ASSERT_NOT_REACHED();
       
   344     return E_NOTIMPL;
       
   345 }
       
   346     
       
   347 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::write( 
       
   348         /* [in] */ BSTR /*text*/)
       
   349 {
       
   350     ASSERT_NOT_REACHED();
       
   351     return E_NOTIMPL;
       
   352 }
       
   353     
       
   354 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::writeln( 
       
   355         /* [in] */ BSTR /*text*/)
       
   356 {
       
   357     ASSERT_NOT_REACHED();
       
   358     return E_NOTIMPL;
       
   359 }
       
   360     
       
   361 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::getElementById_( 
       
   362         /* [in] */ BSTR /*elementId*/,
       
   363         /* [retval][out] */ IDOMElement** /*element*/)
       
   364 {
       
   365     ASSERT_NOT_REACHED();
       
   366     return E_NOTIMPL;
       
   367 }
       
   368     
       
   369 HRESULT STDMETHODCALLTYPE DOMHTMLDocument::getElementsByName( 
       
   370         /* [in] */ BSTR /*elementName*/,
       
   371         /* [retval][out] */ IDOMNodeList** /*nodeList*/)
       
   372 {
       
   373     ASSERT_NOT_REACHED();
       
   374     return E_NOTIMPL;
       
   375 }
       
   376 
       
   377 // DOMHTMLElement - IUnknown --------------------------------------------------
       
   378 
       
   379 HRESULT STDMETHODCALLTYPE DOMHTMLElement::QueryInterface(REFIID riid, void** ppvObject)
       
   380 {
       
   381     *ppvObject = 0;
       
   382     if (IsEqualGUID(riid, IID_IDOMHTMLElement))
       
   383         *ppvObject = static_cast<IDOMHTMLElement*>(this);
       
   384     else
       
   385         return DOMElement::QueryInterface(riid, ppvObject);
       
   386 
       
   387     AddRef();
       
   388     return S_OK;
       
   389 }
       
   390 
       
   391 // DOMHTMLElement -------------------------------------------------------------
       
   392 
       
   393 HRESULT STDMETHODCALLTYPE DOMHTMLElement::idName( 
       
   394         /* [retval][out] */ BSTR* result)
       
   395 {
       
   396     if (!result)
       
   397         return E_POINTER;
       
   398 
       
   399     ASSERT(m_element && m_element->isHTMLElement());
       
   400     String idString = static_cast<HTMLElement*>(m_element)->getAttribute(idAttr);
       
   401     *result = BString(idString).release();
       
   402     return S_OK;
       
   403 }
       
   404     
       
   405 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setIdName( 
       
   406         /* [in] */ BSTR /*idName*/)
       
   407 {
       
   408     ASSERT_NOT_REACHED();
       
   409     return E_NOTIMPL;
       
   410 }
       
   411     
       
   412 HRESULT STDMETHODCALLTYPE DOMHTMLElement::title( 
       
   413         /* [retval][out] */ BSTR* /*result*/)
       
   414 {
       
   415     ASSERT_NOT_REACHED();
       
   416     return E_NOTIMPL;
       
   417 }
       
   418     
       
   419 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setTitle( 
       
   420         /* [in] */ BSTR /*title*/)
       
   421 {
       
   422     ASSERT_NOT_REACHED();
       
   423     return E_NOTIMPL;
       
   424 }
       
   425     
       
   426 HRESULT STDMETHODCALLTYPE DOMHTMLElement::lang( 
       
   427         /* [retval][out] */ BSTR* /*result*/)
       
   428 {
       
   429     ASSERT_NOT_REACHED();
       
   430     return E_NOTIMPL;
       
   431 }
       
   432     
       
   433 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setLang( 
       
   434         /* [in] */ BSTR /*lang*/)
       
   435 {
       
   436     ASSERT_NOT_REACHED();
       
   437     return E_NOTIMPL;
       
   438 }
       
   439     
       
   440 HRESULT STDMETHODCALLTYPE DOMHTMLElement::dir( 
       
   441         /* [retval][out] */ BSTR* /*result*/)
       
   442 {
       
   443     ASSERT_NOT_REACHED();
       
   444     return E_NOTIMPL;
       
   445 }
       
   446     
       
   447 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setDir( 
       
   448         /* [in] */ BSTR /*dir*/)
       
   449 {
       
   450     ASSERT_NOT_REACHED();
       
   451     return E_NOTIMPL;
       
   452 }
       
   453     
       
   454 HRESULT STDMETHODCALLTYPE DOMHTMLElement::className( 
       
   455         /* [retval][out] */ BSTR* /*result*/)
       
   456 {
       
   457     ASSERT_NOT_REACHED();
       
   458     return E_NOTIMPL;
       
   459 }
       
   460     
       
   461 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setClassName( 
       
   462         /* [in] */ BSTR /*className*/)
       
   463 {
       
   464     ASSERT_NOT_REACHED();
       
   465     return E_NOTIMPL;
       
   466 }
       
   467 
       
   468 HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerHTML( 
       
   469         /* [retval][out] */ BSTR* /*result*/)
       
   470 {
       
   471     ASSERT_NOT_REACHED();
       
   472     return E_NOTIMPL;
       
   473 }
       
   474         
       
   475 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setInnerHTML( 
       
   476         /* [in] */ BSTR /*html*/)
       
   477 {
       
   478     ASSERT_NOT_REACHED();
       
   479     return E_NOTIMPL;
       
   480 }
       
   481         
       
   482 HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerText( 
       
   483         /* [retval][out] */ BSTR* result)
       
   484 {
       
   485     ASSERT(m_element && m_element->isHTMLElement());
       
   486     WebCore::String innerTextString = static_cast<HTMLElement*>(m_element)->innerText();
       
   487     *result = BString(innerTextString.characters(), innerTextString.length()).release();
       
   488     return S_OK;
       
   489 }
       
   490         
       
   491 HRESULT STDMETHODCALLTYPE DOMHTMLElement::setInnerText( 
       
   492         /* [in] */ BSTR text)
       
   493 {
       
   494     ASSERT(m_element && m_element->isHTMLElement());
       
   495     HTMLElement* htmlEle = static_cast<HTMLElement*>(m_element);
       
   496     WebCore::String textString(text, SysStringLen(text));
       
   497     WebCore::ExceptionCode ec = 0;
       
   498     htmlEle->setInnerText(textString, ec);
       
   499     return S_OK;
       
   500 }
       
   501 
       
   502 // DOMHTMLFormElement - IUnknown ----------------------------------------------
       
   503 
       
   504 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::QueryInterface(REFIID riid, void** ppvObject)
       
   505 {
       
   506     *ppvObject = 0;
       
   507     if (IsEqualGUID(riid, IID_IDOMHTMLFormElement))
       
   508         *ppvObject = static_cast<IDOMHTMLFormElement*>(this);
       
   509     else
       
   510         return DOMHTMLElement::QueryInterface(riid, ppvObject);
       
   511 
       
   512     AddRef();
       
   513     return S_OK;
       
   514 }
       
   515 
       
   516 // DOMHTMLFormElement ---------------------------------------------------------
       
   517 
       
   518 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::elements( 
       
   519         /* [retval][out] */ IDOMHTMLCollection** /*result*/)
       
   520 {
       
   521     ASSERT_NOT_REACHED();
       
   522     return E_NOTIMPL;
       
   523 }
       
   524     
       
   525 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::length( 
       
   526         /* [retval][out] */ int* /*result*/)
       
   527 {
       
   528     ASSERT_NOT_REACHED();
       
   529     return E_NOTIMPL;
       
   530 }
       
   531     
       
   532 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::name( 
       
   533         /* [retval][out] */ BSTR* /*result*/)
       
   534 {
       
   535     ASSERT_NOT_REACHED();
       
   536     return E_NOTIMPL;
       
   537 }
       
   538     
       
   539 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setName( 
       
   540         /* [in] */ BSTR /*name*/)
       
   541 {
       
   542     ASSERT_NOT_REACHED();
       
   543     return E_NOTIMPL;
       
   544 }
       
   545     
       
   546 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::acceptCharset( 
       
   547         /* [retval][out] */ BSTR* /*result*/)
       
   548 {
       
   549     ASSERT_NOT_REACHED();
       
   550     return E_NOTIMPL;
       
   551 }
       
   552     
       
   553 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setAcceptCharset( 
       
   554         /* [in] */ BSTR /*acceptCharset*/)
       
   555 {
       
   556     ASSERT_NOT_REACHED();
       
   557     return E_NOTIMPL;
       
   558 }
       
   559     
       
   560 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::action( 
       
   561         /* [retval][out] */ BSTR* result)
       
   562 {
       
   563     ASSERT(m_element && m_element->hasTagName(formTag));
       
   564     WebCore::String actionString = static_cast<HTMLFormElement*>(m_element)->action();
       
   565     *result = BString(actionString.characters(), actionString.length()).release();
       
   566     return S_OK;
       
   567 }
       
   568     
       
   569 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setAction( 
       
   570         /* [in] */ BSTR /*action*/)
       
   571 {
       
   572     ASSERT_NOT_REACHED();
       
   573     return E_NOTIMPL;
       
   574 }
       
   575     
       
   576 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::encType( 
       
   577         /* [retval][out] */ BSTR* /*result*/)
       
   578 {
       
   579     ASSERT_NOT_REACHED();
       
   580     return E_NOTIMPL;
       
   581 }
       
   582     
       
   583 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setEnctype( 
       
   584         /* [retval][out] */ BSTR* /*encType*/)
       
   585 {
       
   586     ASSERT_NOT_REACHED();
       
   587     return E_NOTIMPL;
       
   588 }
       
   589     
       
   590 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method( 
       
   591         /* [retval][out] */ BSTR* result)
       
   592 {
       
   593     ASSERT(m_element && m_element->hasTagName(formTag));
       
   594     WebCore::String methodString = static_cast<HTMLFormElement*>(m_element)->method();
       
   595     *result = BString(methodString.characters(), methodString.length()).release();
       
   596     return S_OK;
       
   597 }
       
   598     
       
   599 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setMethod( 
       
   600         /* [in] */ BSTR /*method*/)
       
   601 {
       
   602     ASSERT_NOT_REACHED();
       
   603     return E_NOTIMPL;
       
   604 }
       
   605     
       
   606 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::target( 
       
   607         /* [retval][out] */ BSTR* /*result*/)
       
   608 {
       
   609     ASSERT_NOT_REACHED();
       
   610     return E_NOTIMPL;
       
   611 }
       
   612     
       
   613 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setTarget( 
       
   614         /* [in] */ BSTR /*target*/)
       
   615 {
       
   616     ASSERT_NOT_REACHED();
       
   617     return E_NOTIMPL;
       
   618 }
       
   619     
       
   620 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::submit( void)
       
   621 {
       
   622     ASSERT_NOT_REACHED();
       
   623     return E_NOTIMPL;
       
   624 }
       
   625     
       
   626 HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::reset( void)
       
   627 {
       
   628     ASSERT_NOT_REACHED();
       
   629     return E_NOTIMPL;
       
   630 }
       
   631 
       
   632 // DOMHTMLSelectElement - IUnknown ----------------------------------------------
       
   633 
       
   634 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::QueryInterface(REFIID riid, void** ppvObject)
       
   635 {
       
   636     *ppvObject = 0;
       
   637     if (IsEqualGUID(riid, IID_IDOMHTMLSelectElement))
       
   638         *ppvObject = static_cast<IDOMHTMLSelectElement*>(this);
       
   639     else if (IsEqualGUID(riid, IID_IFormsAutoFillTransitionSelect))
       
   640         *ppvObject = static_cast<IFormsAutoFillTransitionSelect*>(this);
       
   641     else
       
   642         return DOMHTMLElement::QueryInterface(riid, ppvObject);
       
   643 
       
   644     AddRef();
       
   645     return S_OK;
       
   646 }
       
   647 
       
   648 // DOMHTMLSelectElement -------------------------------------------------------
       
   649 
       
   650 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::type( 
       
   651         /* [retval][out] */ BSTR* /*result*/)
       
   652 {
       
   653     ASSERT_NOT_REACHED();
       
   654     return E_NOTIMPL;
       
   655 }
       
   656     
       
   657 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::selectedIndex( 
       
   658         /* [retval][out] */ int* /*result*/)
       
   659 {
       
   660     ASSERT_NOT_REACHED();
       
   661     return E_NOTIMPL;
       
   662 }
       
   663     
       
   664 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setSelectedIndx( 
       
   665         /* [in] */ int /*selectedIndex*/)
       
   666 {
       
   667     ASSERT_NOT_REACHED();
       
   668     return E_NOTIMPL;
       
   669 }
       
   670     
       
   671 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::value( 
       
   672         /* [retval][out] */ BSTR* /*result*/)
       
   673 {
       
   674     ASSERT_NOT_REACHED();
       
   675     return E_NOTIMPL;
       
   676 }
       
   677     
       
   678 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setValue( 
       
   679         /* [in] */ BSTR /*value*/)
       
   680 {
       
   681     ASSERT_NOT_REACHED();
       
   682     return E_NOTIMPL;
       
   683 }
       
   684     
       
   685 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::length( 
       
   686         /* [retval][out] */ int* /*result*/)
       
   687 {
       
   688     ASSERT_NOT_REACHED();
       
   689     return E_NOTIMPL;
       
   690 }
       
   691     
       
   692 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::form( 
       
   693         /* [retval][out] */ IDOMHTMLFormElement** /*result*/)
       
   694 {
       
   695     ASSERT_NOT_REACHED();
       
   696     return E_NOTIMPL;
       
   697 }
       
   698     
       
   699 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options( 
       
   700         /* [retval][out] */ IDOMHTMLOptionsCollection** result)
       
   701 {
       
   702     if (!result)
       
   703         return E_POINTER;
       
   704 
       
   705     *result = 0;
       
   706 
       
   707     ASSERT(m_element);
       
   708     ASSERT(m_element->hasTagName(selectTag));
       
   709     HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);
       
   710 
       
   711     if (!selectElement->options())
       
   712         return E_FAIL;
       
   713 
       
   714     *result = DOMHTMLOptionsCollection::createInstance(selectElement->options().get());
       
   715     return S_OK;
       
   716 }
       
   717     
       
   718 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::disabled( 
       
   719         /* [retval][out] */ BOOL* /*result*/)
       
   720 {
       
   721     ASSERT_NOT_REACHED();
       
   722     return E_NOTIMPL;
       
   723 }
       
   724     
       
   725 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setDisabled( 
       
   726         /* [in] */ BOOL /*disabled*/)
       
   727 {
       
   728     ASSERT_NOT_REACHED();
       
   729     return E_NOTIMPL;
       
   730 }
       
   731     
       
   732 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::multiple( 
       
   733         /* [retval][out] */ BOOL* /*result*/)
       
   734 {
       
   735     ASSERT_NOT_REACHED();
       
   736     return E_NOTIMPL;
       
   737 }
       
   738     
       
   739 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setMultiple( 
       
   740         /* [in] */ BOOL /*multiple*/)
       
   741 {
       
   742     ASSERT_NOT_REACHED();
       
   743     return E_NOTIMPL;
       
   744 }
       
   745     
       
   746 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::name( 
       
   747         /* [retval][out] */ BSTR* /*result*/)
       
   748 {
       
   749     ASSERT_NOT_REACHED();
       
   750     return E_NOTIMPL;
       
   751 }
       
   752     
       
   753 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setName( 
       
   754         /* [in] */ BSTR /*name*/)
       
   755 {
       
   756     ASSERT_NOT_REACHED();
       
   757     return E_NOTIMPL;
       
   758 }
       
   759     
       
   760 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::size( 
       
   761         /* [retval][out] */ int* /*size*/)
       
   762 {
       
   763     ASSERT_NOT_REACHED();
       
   764     return E_NOTIMPL;
       
   765 }
       
   766     
       
   767 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setSize( 
       
   768         /* [in] */ int /*size*/)
       
   769 {
       
   770     ASSERT_NOT_REACHED();
       
   771     return E_NOTIMPL;
       
   772 }
       
   773     
       
   774 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::tabIndex( 
       
   775         /* [retval][out] */ int* /*result*/)
       
   776 {
       
   777     ASSERT_NOT_REACHED();
       
   778     return E_NOTIMPL;
       
   779 }
       
   780     
       
   781 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setTabIndex( 
       
   782         /* [in] */ int /*tabIndex*/)
       
   783 {
       
   784     ASSERT_NOT_REACHED();
       
   785     return E_NOTIMPL;
       
   786 }
       
   787     
       
   788 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::add( 
       
   789         /* [in] */ IDOMHTMLElement* /*element*/,
       
   790         /* [in] */ IDOMHTMLElement* /*before*/)
       
   791 {
       
   792     ASSERT_NOT_REACHED();
       
   793     return E_NOTIMPL;
       
   794 }
       
   795     
       
   796 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::remove( 
       
   797         /* [in] */ int /*index*/)
       
   798 {
       
   799     ASSERT_NOT_REACHED();
       
   800     return E_NOTIMPL;
       
   801 }
       
   802     
       
   803 // DOMHTMLSelectElement - IFormsAutoFillTransitionSelect ----------------------
       
   804 
       
   805 HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::activateItemAtIndex( 
       
   806     /* [in] */ int index)
       
   807 {
       
   808     ASSERT(m_element);
       
   809     ASSERT(m_element->hasTagName(selectTag));
       
   810     HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);
       
   811 
       
   812     if (index >= selectElement->length())
       
   813         return E_FAIL;
       
   814 
       
   815     selectElement->setSelectedIndex(index);
       
   816     return S_OK;
       
   817 }
       
   818 
       
   819 // DOMHTMLOptionElement - IUnknown --------------------------------------------
       
   820 
       
   821 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::QueryInterface(REFIID riid, void** ppvObject)
       
   822 {
       
   823     *ppvObject = 0;
       
   824     if (IsEqualGUID(riid, IID_IDOMHTMLOptionElement))
       
   825         *ppvObject = static_cast<IDOMHTMLOptionElement*>(this);
       
   826     else
       
   827         return DOMHTMLElement::QueryInterface(riid, ppvObject);
       
   828 
       
   829     AddRef();
       
   830     return S_OK;
       
   831 }
       
   832 
       
   833 // DOMHTMLOptionElement -------------------------------------------------------
       
   834 
       
   835 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::form( 
       
   836         /* [retval][out] */ IDOMHTMLFormElement** /*result*/)
       
   837 {
       
   838     ASSERT_NOT_REACHED();
       
   839     return E_NOTIMPL;
       
   840 }
       
   841     
       
   842 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::defaultSelected( 
       
   843         /* [retval][out] */ BOOL* /*result*/)
       
   844 {
       
   845     ASSERT_NOT_REACHED();
       
   846     return E_NOTIMPL;
       
   847 }
       
   848     
       
   849 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDefaultSelected( 
       
   850         /* [in] */ BOOL /*defaultSelected*/)
       
   851 {
       
   852     ASSERT_NOT_REACHED();
       
   853     return E_NOTIMPL;
       
   854 }
       
   855     
       
   856 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::text( 
       
   857         /* [retval][out] */ BSTR* result)
       
   858 {
       
   859     if (!result)
       
   860         return E_POINTER;
       
   861 
       
   862     *result = 0;
       
   863 
       
   864     ASSERT(m_element);
       
   865     ASSERT(m_element->hasTagName(optionTag));
       
   866     HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(m_element);
       
   867 
       
   868     *result = BString(optionElement->text()).release();
       
   869     return S_OK;
       
   870 }
       
   871     
       
   872 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::index( 
       
   873         /* [retval][out] */ int* /*result*/)
       
   874 {
       
   875     ASSERT_NOT_REACHED();
       
   876     return E_NOTIMPL;
       
   877 }
       
   878     
       
   879 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::disabled( 
       
   880         /* [retval][out] */ BOOL* /*result*/)
       
   881 {
       
   882     ASSERT_NOT_REACHED();
       
   883     return E_NOTIMPL;
       
   884 }
       
   885     
       
   886 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDisabled( 
       
   887         /* [in] */ BOOL /*disabled*/)
       
   888 {
       
   889     ASSERT_NOT_REACHED();
       
   890     return E_NOTIMPL;
       
   891 }
       
   892     
       
   893 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::label( 
       
   894         /* [retval][out] */ BSTR* result)
       
   895 {
       
   896     if (!result)
       
   897         return E_POINTER;
       
   898 
       
   899     *result = 0;
       
   900 
       
   901     ASSERT(m_element);
       
   902     ASSERT(m_element->hasTagName(optionTag));
       
   903     HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(m_element);
       
   904 
       
   905     *result = BString(optionElement->label()).release();
       
   906     return S_OK;
       
   907 }
       
   908     
       
   909 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setLabel( 
       
   910         /* [in] */ BSTR /*label*/)
       
   911 {
       
   912     ASSERT_NOT_REACHED();
       
   913     return E_NOTIMPL;
       
   914 }
       
   915     
       
   916 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::selected( 
       
   917         /* [retval][out] */ BOOL* /*result*/)
       
   918 {
       
   919     ASSERT_NOT_REACHED();
       
   920     return E_NOTIMPL;
       
   921 }
       
   922     
       
   923 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setSelected( 
       
   924         /* [in] */ BOOL /*selected*/)
       
   925 {
       
   926     ASSERT_NOT_REACHED();
       
   927     return E_NOTIMPL;
       
   928 }
       
   929     
       
   930 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::value( 
       
   931         /* [retval][out] */ BSTR* /*result*/)
       
   932 {
       
   933     ASSERT_NOT_REACHED();
       
   934     return E_NOTIMPL;
       
   935 }
       
   936     
       
   937 HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setValue( 
       
   938         /* [in] */ BSTR /*value*/)
       
   939 {
       
   940     ASSERT_NOT_REACHED();
       
   941     return E_NOTIMPL;
       
   942 }
       
   943 
       
   944 // DOMHTMLInputElement - IUnknown ----------------------------------------------
       
   945 
       
   946 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::QueryInterface(REFIID riid, void** ppvObject)
       
   947 {
       
   948     *ppvObject = 0;
       
   949     if (IsEqualGUID(riid, IID_IDOMHTMLInputElement))
       
   950         *ppvObject = static_cast<IDOMHTMLInputElement*>(this);
       
   951     else if (IsEqualGUID(riid, IID_IFormsAutoFillTransition))
       
   952         *ppvObject = static_cast<IFormsAutoFillTransition*>(this);
       
   953     else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
       
   954         *ppvObject = static_cast<IFormPromptAdditions*>(this);    
       
   955     else
       
   956         return DOMHTMLElement::QueryInterface(riid, ppvObject);
       
   957 
       
   958     AddRef();
       
   959     return S_OK;
       
   960 }
       
   961 
       
   962 // DOMHTMLInputElement --------------------------------------------------------
       
   963 
       
   964 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::defaultValue( 
       
   965         /* [retval][out] */ BSTR* /*result*/)
       
   966 {
       
   967     ASSERT_NOT_REACHED();
       
   968     return E_NOTIMPL;
       
   969 }
       
   970     
       
   971 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDefaultValue( 
       
   972         /* [in] */ BSTR /*val*/)
       
   973 {
       
   974     ASSERT_NOT_REACHED();
       
   975     return E_NOTIMPL;
       
   976 }
       
   977     
       
   978 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::defaultChecked( 
       
   979         /* [retval][out] */ BOOL* /*result*/)
       
   980 {
       
   981     ASSERT_NOT_REACHED();
       
   982     return E_NOTIMPL;
       
   983 }
       
   984     
       
   985 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDefaultChecked( 
       
   986         /* [in] */ BSTR /*checked*/)
       
   987 {
       
   988     ASSERT_NOT_REACHED();
       
   989     return E_NOTIMPL;
       
   990 }
       
   991     
       
   992 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::form( 
       
   993         /* [retval][out] */ IDOMHTMLElement** result)
       
   994 {
       
   995     if (!result)
       
   996         return E_POINTER;
       
   997     *result = 0;
       
   998     ASSERT(m_element && m_element->hasTagName(inputTag));
       
   999     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1000     COMPtr<IDOMElement> domElement;
       
  1001     domElement.adoptRef(DOMHTMLElement::createInstance(inputElement->form()));
       
  1002     if (domElement)
       
  1003         return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) result);
       
  1004     return E_FAIL;
       
  1005 }
       
  1006     
       
  1007 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::accept( 
       
  1008         /* [retval][out] */ BSTR* /*result*/)
       
  1009 {
       
  1010     ASSERT_NOT_REACHED();
       
  1011     return E_NOTIMPL;
       
  1012 }
       
  1013     
       
  1014 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAccept( 
       
  1015         /* [in] */ BSTR /*accept*/)
       
  1016 {
       
  1017     ASSERT_NOT_REACHED();
       
  1018     return E_NOTIMPL;
       
  1019 }
       
  1020     
       
  1021 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::accessKey( 
       
  1022         /* [retval][out] */ BSTR* /*result*/)
       
  1023 {
       
  1024     ASSERT_NOT_REACHED();
       
  1025     return E_NOTIMPL;
       
  1026 }
       
  1027     
       
  1028 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAccessKey( 
       
  1029         /* [in] */ BSTR /*key*/)
       
  1030 {
       
  1031     ASSERT_NOT_REACHED();
       
  1032     return E_NOTIMPL;
       
  1033 }
       
  1034     
       
  1035 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::align( 
       
  1036         /* [retval][out] */ BSTR* /*result*/)
       
  1037 {
       
  1038     ASSERT_NOT_REACHED();
       
  1039     return E_NOTIMPL;
       
  1040 }
       
  1041     
       
  1042 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAlign( 
       
  1043         /* [in] */ BSTR /*align*/)
       
  1044 {
       
  1045     ASSERT_NOT_REACHED();
       
  1046     return E_NOTIMPL;
       
  1047 }
       
  1048     
       
  1049 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::alt( 
       
  1050         /* [retval][out] */ BSTR* /*result*/)
       
  1051 {
       
  1052     ASSERT_NOT_REACHED();
       
  1053     return E_NOTIMPL;
       
  1054 }
       
  1055     
       
  1056 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAlt( 
       
  1057         /* [in] */ BSTR /*alt*/)
       
  1058 {
       
  1059     ASSERT_NOT_REACHED();
       
  1060     return E_NOTIMPL;
       
  1061 }
       
  1062     
       
  1063 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::checked( 
       
  1064         /* [retval][out] */ BOOL* /*result*/)
       
  1065 {
       
  1066     ASSERT_NOT_REACHED();
       
  1067     return E_NOTIMPL;
       
  1068 }
       
  1069     
       
  1070 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setChecked( 
       
  1071         /* [in] */ BOOL /*checked*/)
       
  1072 {
       
  1073     ASSERT_NOT_REACHED();
       
  1074     return E_NOTIMPL;
       
  1075 }
       
  1076     
       
  1077 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::disabled( 
       
  1078         /* [retval][out] */ BOOL* result)
       
  1079 {
       
  1080     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1081     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1082     *result = inputElement->disabled() ? TRUE : FALSE;
       
  1083     return S_OK;
       
  1084 }
       
  1085     
       
  1086 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDisabled( 
       
  1087         /* [in] */ BOOL /*disabled*/)
       
  1088 {
       
  1089     ASSERT_NOT_REACHED();
       
  1090     return E_NOTIMPL;
       
  1091 }
       
  1092     
       
  1093 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::maxLength( 
       
  1094         /* [retval][out] */ int* /*result*/)
       
  1095 {
       
  1096     ASSERT_NOT_REACHED();
       
  1097     return E_NOTIMPL;
       
  1098 }
       
  1099     
       
  1100 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setMaxLength( 
       
  1101         /* [in] */ int /*maxLength*/)
       
  1102 {
       
  1103     ASSERT_NOT_REACHED();
       
  1104     return E_NOTIMPL;
       
  1105 }
       
  1106     
       
  1107 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::name( 
       
  1108         /* [retval][out] */ BSTR* /*name*/)
       
  1109 {
       
  1110     ASSERT_NOT_REACHED();
       
  1111     return E_NOTIMPL;
       
  1112 }
       
  1113     
       
  1114 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setName( 
       
  1115         /* [in] */ BSTR /*name*/)
       
  1116 {
       
  1117     ASSERT_NOT_REACHED();
       
  1118     return E_NOTIMPL;
       
  1119 }
       
  1120     
       
  1121 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::readOnly( 
       
  1122         /* [retval][out] */ BOOL* result)
       
  1123 {
       
  1124     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1125     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1126     *result = inputElement->readOnly() ? TRUE : FALSE;
       
  1127     return S_OK;
       
  1128 }
       
  1129     
       
  1130 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setReadOnly( 
       
  1131         /* [in] */ BOOL /*readOnly*/)
       
  1132 {
       
  1133     ASSERT_NOT_REACHED();
       
  1134     return E_NOTIMPL;
       
  1135 }
       
  1136     
       
  1137 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::size( 
       
  1138         /* [retval][out] */ unsigned int* /*result*/)
       
  1139 {
       
  1140     ASSERT_NOT_REACHED();
       
  1141     return E_NOTIMPL;
       
  1142 }
       
  1143     
       
  1144 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSize( 
       
  1145         /* [in] */ unsigned int /*size*/)
       
  1146 {
       
  1147     ASSERT_NOT_REACHED();
       
  1148     return E_NOTIMPL;
       
  1149 }
       
  1150     
       
  1151 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::src( 
       
  1152         /* [retval][out] */ BSTR* /*result*/)
       
  1153 {
       
  1154     ASSERT_NOT_REACHED();
       
  1155     return E_NOTIMPL;
       
  1156 }
       
  1157     
       
  1158 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSrc( 
       
  1159         /* [in] */ BSTR /*src*/)
       
  1160 {
       
  1161     ASSERT_NOT_REACHED();
       
  1162     return E_NOTIMPL;
       
  1163 }
       
  1164     
       
  1165 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::tabIndex( 
       
  1166         /* [retval][out] */ int* /*result*/)
       
  1167 {
       
  1168     ASSERT_NOT_REACHED();
       
  1169     return E_NOTIMPL;
       
  1170 }
       
  1171     
       
  1172 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setTabIndex( 
       
  1173         /* [in] */ int /*tabIndex*/)
       
  1174 {
       
  1175     ASSERT_NOT_REACHED();
       
  1176     return E_NOTIMPL;
       
  1177 }
       
  1178     
       
  1179 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::type( 
       
  1180         /* [retval][out] */ BSTR* /*result*/)
       
  1181 {
       
  1182     ASSERT_NOT_REACHED();
       
  1183     return E_NOTIMPL;
       
  1184 }
       
  1185     
       
  1186 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setType( 
       
  1187         /* [in] */ BSTR type)
       
  1188 {
       
  1189     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1190     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1191     WebCore::String typeString(type, SysStringLen(type));
       
  1192     inputElement->setType(typeString);
       
  1193     return S_OK;
       
  1194 }
       
  1195     
       
  1196 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::useMap( 
       
  1197         /* [retval][out] */ BSTR* /*result*/)
       
  1198 {
       
  1199     ASSERT_NOT_REACHED();
       
  1200     return E_NOTIMPL;
       
  1201 }
       
  1202     
       
  1203 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setUseMap( 
       
  1204         /* [in] */ BSTR /*useMap*/)
       
  1205 {
       
  1206     ASSERT_NOT_REACHED();
       
  1207     return E_NOTIMPL;
       
  1208 }
       
  1209     
       
  1210 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value( 
       
  1211         /* [retval][out] */ BSTR* result)
       
  1212 {
       
  1213     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1214     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1215     WebCore::String valueString = inputElement->value();
       
  1216     *result = BString(valueString.characters(), valueString.length()).release();
       
  1217     if (valueString.length() && !*result)
       
  1218         return E_OUTOFMEMORY;
       
  1219     return S_OK;
       
  1220 }
       
  1221     
       
  1222 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValue( 
       
  1223         /* [in] */ BSTR value)
       
  1224 {
       
  1225     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1226     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1227     inputElement->setValue(String((UChar*) value, SysStringLen(value)));
       
  1228     return S_OK;
       
  1229 }
       
  1230 
       
  1231 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValueForUser(
       
  1232         /* [in] */ BSTR value)
       
  1233 {
       
  1234     ASSERT(m_element);
       
  1235     ASSERT(m_element->hasTagName(inputTag));
       
  1236     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1237     inputElement->setValueForUser(String(static_cast<UChar*>(value), SysStringLen(value)));
       
  1238     return S_OK;
       
  1239 }
       
  1240 
       
  1241 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::select( void)
       
  1242 {
       
  1243     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1244     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1245     inputElement->select();
       
  1246     return S_OK;
       
  1247 }
       
  1248     
       
  1249 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::click( void)
       
  1250 {
       
  1251     ASSERT_NOT_REACHED();
       
  1252     return E_NOTIMPL;
       
  1253 }
       
  1254 
       
  1255 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionStart( 
       
  1256     /* [in] */ long start)
       
  1257 {
       
  1258     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1259     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1260     inputElement->setSelectionStart(start);
       
  1261     return S_OK;
       
  1262 }
       
  1263 
       
  1264 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionStart( 
       
  1265     /* [retval][out] */ long *start)
       
  1266 {
       
  1267     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1268     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1269     *start = inputElement->selectionStart();
       
  1270     return S_OK;
       
  1271 }
       
  1272 
       
  1273 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionEnd( 
       
  1274     /* [in] */ long end)
       
  1275 {
       
  1276     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1277     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1278     inputElement->setSelectionEnd(end);
       
  1279     return S_OK;
       
  1280 }
       
  1281 
       
  1282 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionEnd( 
       
  1283     /* [retval][out] */ long *end)
       
  1284 {
       
  1285     ASSERT(m_element && m_element->hasTagName(inputTag));
       
  1286     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1287     *end = inputElement->selectionEnd();
       
  1288     return S_OK;
       
  1289 }
       
  1290 
       
  1291 // DOMHTMLInputElement -- IFormsAutoFillTransition ----------------------------
       
  1292 
       
  1293 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isTextField(
       
  1294     /* [retval][out] */ BOOL* result)
       
  1295 {
       
  1296     ASSERT(m_element);
       
  1297     ASSERT(m_element->hasTagName(inputTag));
       
  1298     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1299     *result = inputElement->isTextField() ? TRUE : FALSE;
       
  1300     return S_OK;
       
  1301 }
       
  1302 
       
  1303 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::rectOnScreen( 
       
  1304     /* [retval][out] */ LPRECT rect)
       
  1305 {
       
  1306     ASSERT(m_element);
       
  1307     ASSERT(m_element->hasTagName(inputTag));
       
  1308     rect->left = rect->top = rect->right = rect->bottom = 0;
       
  1309     RenderObject* renderer = m_element->renderer();
       
  1310     FrameView* view = m_element->document()->view();
       
  1311     if (!renderer || !view)
       
  1312         return E_FAIL;
       
  1313 
       
  1314     IntRect coreRect = view->contentsToScreen(renderer->absoluteBoundingBoxRect());
       
  1315     rect->left = coreRect.x();
       
  1316     rect->top = coreRect.y();
       
  1317     rect->right = coreRect.right();
       
  1318     rect->bottom = coreRect.bottom();
       
  1319 
       
  1320     return S_OK;
       
  1321 }
       
  1322 
       
  1323 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::replaceCharactersInRange( 
       
  1324     /* [in] */ int startTarget,
       
  1325     /* [in] */ int endTarget,
       
  1326     /* [in] */ BSTR replacementString,
       
  1327     /* [in] */ int index)
       
  1328 {
       
  1329     if (!replacementString)
       
  1330         return E_POINTER;
       
  1331 
       
  1332     ASSERT(m_element);
       
  1333     ASSERT(m_element->hasTagName(inputTag));
       
  1334     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1335 
       
  1336     String newValue = inputElement->value();
       
  1337     String webCoreReplacementString(static_cast<UChar*>(replacementString), SysStringLen(replacementString));
       
  1338     newValue.replace(startTarget, endTarget - startTarget, webCoreReplacementString);
       
  1339     inputElement->setValue(newValue);
       
  1340     inputElement->setSelectionRange(index, newValue.length());
       
  1341 
       
  1342     return S_OK;
       
  1343 }
       
  1344 
       
  1345 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange( 
       
  1346     /* [out] */ int* start,
       
  1347     /* [out] */ int* end)
       
  1348 {
       
  1349     ASSERT(m_element);
       
  1350     ASSERT(m_element->hasTagName(inputTag));
       
  1351     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1352     *start = inputElement->selectionStart();
       
  1353     *end = inputElement->selectionEnd();
       
  1354     return S_OK;
       
  1355 }
       
  1356 
       
  1357 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAutofilled( 
       
  1358     /* [in] */ BOOL filled)
       
  1359 {
       
  1360     ASSERT(m_element);
       
  1361     ASSERT(m_element->hasTagName(inputTag));
       
  1362     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1363     inputElement->setAutofilled(!!filled);
       
  1364     return S_OK;
       
  1365 }
       
  1366 
       
  1367 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isAutofilled(
       
  1368     /* [retval][out] */ BOOL* result)
       
  1369 {
       
  1370     ASSERT(m_element);
       
  1371     ASSERT(m_element->hasTagName(inputTag));
       
  1372     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
       
  1373     *result = inputElement->isAutofilled() ? TRUE : FALSE;
       
  1374     return S_OK;
       
  1375 }
       
  1376 
       
  1377 // DOMHTMLInputElement -- IFormPromptAdditions ------------------------------------
       
  1378 
       
  1379 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited( 
       
  1380     /* [retval][out] */ BOOL *result)
       
  1381 {
       
  1382     if (!result)
       
  1383         return E_POINTER;
       
  1384 
       
  1385     *result = FALSE;
       
  1386     ASSERT(m_element);
       
  1387     BOOL textField = FALSE;
       
  1388     if (FAILED(isTextField(&textField)) || !textField)
       
  1389         return S_OK;
       
  1390     RenderObject* renderer = m_element->renderer();
       
  1391     if (renderer && toRenderTextControl(renderer)->lastChangeWasUserEdit())
       
  1392         *result = TRUE;
       
  1393     return S_OK;
       
  1394 }
       
  1395 
       
  1396 // DOMHTMLTextAreaElement - IUnknown ----------------------------------------------
       
  1397 
       
  1398 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::QueryInterface(REFIID riid, void** ppvObject)
       
  1399 {
       
  1400     *ppvObject = 0;
       
  1401     if (IsEqualGUID(riid, IID_IDOMHTMLTextAreaElement))
       
  1402         *ppvObject = static_cast<IDOMHTMLTextAreaElement*>(this);
       
  1403     else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
       
  1404         *ppvObject = static_cast<IFormPromptAdditions*>(this);    
       
  1405     else
       
  1406         return DOMHTMLElement::QueryInterface(riid, ppvObject);
       
  1407 
       
  1408     AddRef();
       
  1409     return S_OK;
       
  1410 }
       
  1411 
       
  1412 // DOMHTMLTextAreaElement -----------------------------------------------------
       
  1413 
       
  1414 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::defaultValue( 
       
  1415         /* [retval][out] */ BSTR* /*result*/)
       
  1416 {
       
  1417     ASSERT_NOT_REACHED();
       
  1418     return E_NOTIMPL;
       
  1419 }
       
  1420     
       
  1421 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setDefaultValue( 
       
  1422         /* [in] */ BSTR /*val*/)
       
  1423 {
       
  1424     ASSERT_NOT_REACHED();
       
  1425     return E_NOTIMPL;
       
  1426 }
       
  1427     
       
  1428 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::form( 
       
  1429         /* [retval][out] */ IDOMHTMLElement** result)
       
  1430 {
       
  1431     if (!result)
       
  1432         return E_POINTER;
       
  1433     *result = 0;
       
  1434     ASSERT(m_element && m_element->hasTagName(textareaTag));
       
  1435     HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
       
  1436     COMPtr<IDOMElement> domElement;
       
  1437     domElement.adoptRef(DOMHTMLElement::createInstance(textareaElement->form()));
       
  1438     if (domElement)
       
  1439         return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) result);
       
  1440     return E_FAIL;
       
  1441 }
       
  1442     
       
  1443 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::accessKey( 
       
  1444         /* [retval][out] */ BSTR* /*result*/)
       
  1445 {
       
  1446     ASSERT_NOT_REACHED();
       
  1447     return E_NOTIMPL;
       
  1448 }
       
  1449     
       
  1450 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setAccessKey( 
       
  1451         /* [in] */ BSTR /*key*/)
       
  1452 {
       
  1453     ASSERT_NOT_REACHED();
       
  1454     return E_NOTIMPL;
       
  1455 }
       
  1456     
       
  1457 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::cols( 
       
  1458         /* [retval][out] */ int* /*result*/)
       
  1459 {
       
  1460     ASSERT_NOT_REACHED();
       
  1461     return E_NOTIMPL;
       
  1462 }
       
  1463     
       
  1464 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setCols( 
       
  1465         /* [in] */ int /*cols*/)
       
  1466 {
       
  1467     ASSERT_NOT_REACHED();
       
  1468     return E_NOTIMPL;
       
  1469 }
       
  1470     
       
  1471 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::disabled( 
       
  1472         /* [retval][out] */ BOOL* /*result*/)
       
  1473 {
       
  1474     ASSERT_NOT_REACHED();
       
  1475     return E_NOTIMPL;
       
  1476 }
       
  1477     
       
  1478 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setDisabled( 
       
  1479         /* [in] */ BOOL /*disabled*/)
       
  1480 {
       
  1481     ASSERT_NOT_REACHED();
       
  1482     return E_NOTIMPL;
       
  1483 }
       
  1484     
       
  1485 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::name( 
       
  1486         /* [retval][out] */ BSTR* /*name*/)
       
  1487 {
       
  1488     ASSERT_NOT_REACHED();
       
  1489     return E_NOTIMPL;
       
  1490 }
       
  1491     
       
  1492 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setName( 
       
  1493         /* [in] */ BSTR /*name*/)
       
  1494 {
       
  1495     ASSERT_NOT_REACHED();
       
  1496     return E_NOTIMPL;
       
  1497 }
       
  1498     
       
  1499 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::readOnly( 
       
  1500         /* [retval][out] */ BOOL* /*result*/)
       
  1501 {
       
  1502     ASSERT_NOT_REACHED();
       
  1503     return E_NOTIMPL;
       
  1504 }
       
  1505     
       
  1506 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setReadOnly( 
       
  1507         /* [in] */ BOOL /*readOnly*/)
       
  1508 {
       
  1509     ASSERT_NOT_REACHED();
       
  1510     return E_NOTIMPL;
       
  1511 }
       
  1512     
       
  1513 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::rows( 
       
  1514         /* [retval][out] */ int* /*result*/)
       
  1515 {
       
  1516     ASSERT_NOT_REACHED();
       
  1517     return E_NOTIMPL;
       
  1518 }
       
  1519     
       
  1520 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setRows( 
       
  1521         /* [in] */ int /*rows*/)
       
  1522 {
       
  1523     ASSERT_NOT_REACHED();
       
  1524     return E_NOTIMPL;
       
  1525 }
       
  1526     
       
  1527 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::tabIndex( 
       
  1528         /* [retval][out] */ int* /*result*/)
       
  1529 {
       
  1530     ASSERT_NOT_REACHED();
       
  1531     return E_NOTIMPL;
       
  1532 }
       
  1533     
       
  1534 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setTabIndex( 
       
  1535         /* [in] */ int /*tabIndex*/)
       
  1536 {
       
  1537     ASSERT_NOT_REACHED();
       
  1538     return E_NOTIMPL;
       
  1539 }
       
  1540     
       
  1541 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::type( 
       
  1542         /* [retval][out] */ BSTR* /*result*/)
       
  1543 {
       
  1544     ASSERT_NOT_REACHED();
       
  1545     return E_NOTIMPL;
       
  1546 }
       
  1547     
       
  1548 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value( 
       
  1549         /* [retval][out] */ BSTR* result)
       
  1550 {
       
  1551     ASSERT(m_element && m_element->hasTagName(textareaTag));
       
  1552     HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
       
  1553     WebCore::String valueString = textareaElement->value();
       
  1554     *result = BString(valueString.characters(), valueString.length()).release();
       
  1555     if (valueString.length() && !*result)
       
  1556         return E_OUTOFMEMORY;
       
  1557     return S_OK;
       
  1558 }
       
  1559     
       
  1560 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setValue( 
       
  1561         /* [in] */ BSTR value)
       
  1562 {
       
  1563     ASSERT(m_element && m_element->hasTagName(textareaTag));
       
  1564     HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
       
  1565     textareaElement->setValue(String((UChar*) value, SysStringLen(value)));
       
  1566     return S_OK;
       
  1567 }
       
  1568     
       
  1569 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::select( void)
       
  1570 {
       
  1571     ASSERT(m_element && m_element->hasTagName(textareaTag));
       
  1572     HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
       
  1573     textareaElement->select();
       
  1574     return S_OK;
       
  1575 }
       
  1576 
       
  1577 // DOMHTMLTextAreaElement -- IFormPromptAdditions ------------------------------------
       
  1578 
       
  1579 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited( 
       
  1580     /* [retval][out] */ BOOL *result)
       
  1581 {
       
  1582     if (!result)
       
  1583         return E_POINTER;
       
  1584 
       
  1585     *result = FALSE;
       
  1586     ASSERT(m_element);
       
  1587     RenderObject* renderer = m_element->renderer();
       
  1588     if (renderer && toRenderTextControl(renderer)->lastChangeWasUserEdit())
       
  1589         *result = TRUE;
       
  1590     return S_OK;
       
  1591 }
       
  1592 
       
  1593 // DOMHTMLIFrameElement - IUnknown --------------------------------------------------
       
  1594 
       
  1595 HRESULT STDMETHODCALLTYPE DOMHTMLIFrameElement::QueryInterface(REFIID riid, void** ppvObject)
       
  1596 {
       
  1597     *ppvObject = 0;
       
  1598     if (IsEqualGUID(riid, IID_IDOMHTMLIFrameElement))
       
  1599         *ppvObject = static_cast<IDOMHTMLIFrameElement*>(this);
       
  1600     else
       
  1601         return DOMHTMLElement::QueryInterface(riid, ppvObject);
       
  1602 
       
  1603     AddRef();
       
  1604     return S_OK;
       
  1605 }
       
  1606 
       
  1607 // DOMHTMLIFrameElement -------------------------------------------------------------
       
  1608 
       
  1609 HRESULT STDMETHODCALLTYPE DOMHTMLIFrameElement::contentFrame( 
       
  1610     /* [retval][out] */ IWebFrame **result)
       
  1611 {
       
  1612     if (!result)
       
  1613         return E_POINTER;
       
  1614     *result = 0;
       
  1615     ASSERT(m_element && m_element->hasTagName(iframeTag));
       
  1616     HTMLIFrameElement* iFrameElement = static_cast<HTMLIFrameElement*>(m_element);
       
  1617     COMPtr<IWebFrame> webFrame = kit(iFrameElement->contentFrame());
       
  1618     if (!webFrame)
       
  1619         return E_FAIL;
       
  1620     return webFrame.copyRefTo(result);
       
  1621 }