2007-07-27 Ada Chan <adachan@apple.com>
[WebKit-https.git] / WebKit / win / DOMHTMLClasses.cpp
index f7a0d2b125b724d5a95d412500e76d2216e9953c..063023feaa98c311eac35b61b375733677be7ce2 100644 (file)
@@ -42,6 +42,7 @@
 #include <WebCore/HTMLTextAreaElement.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/RenderObject.h>
+#include <WebCore/RenderTextControl.h>
 #pragma warning(pop)
 
 using namespace WebCore;
@@ -865,6 +866,8 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::QueryInterface(REFIID riid, void*
         *ppvObject = static_cast<IDOMHTMLInputElement*>(this);
     else if (IsEqualGUID(riid, IID_IFormsAutoFillTransition))
         *ppvObject = static_cast<IFormsAutoFillTransition*>(this);
+    else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
+        *ppvObject = static_cast<IFormPromptAdditions*>(this);    
     else
         return DOMHTMLElement::QueryInterface(riid, ppvObject);
 
@@ -1250,6 +1253,25 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAutofilled(
     return S_OK;
 }
 
+// DOMHTMLInputElement -- IFormPromptAdditions ------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited( 
+    /* [retval][out] */ BOOL *result)
+{
+    if (!result)
+        return E_POINTER;
+
+    *result = FALSE;
+    ASSERT(m_element);
+    BOOL textField = FALSE;
+    if (FAILED(isTextField(&textField)) || !textField)
+        return S_OK;
+    RenderObject* renderer = m_element->renderer();
+    if (renderer && static_cast<WebCore::RenderTextControl*>(renderer)->isUserEdited())
+        *result = TRUE;
+    return S_OK;
+}
+
 // DOMHTMLTextAreaElement - IUnknown ----------------------------------------------
 
 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::QueryInterface(REFIID riid, void** ppvObject)
@@ -1257,6 +1279,8 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::QueryInterface(REFIID riid, vo
     *ppvObject = 0;
     if (IsEqualGUID(riid, IID_IDOMHTMLTextAreaElement))
         *ppvObject = static_cast<IDOMHTMLTextAreaElement*>(this);
+    else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
+        *ppvObject = static_cast<IFormPromptAdditions*>(this);    
     else
         return DOMHTMLElement::QueryInterface(riid, ppvObject);
 
@@ -1428,3 +1452,19 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::select( void)
     textareaElement->select();
     return S_OK;
 }
+
+// DOMHTMLTextAreaElement -- IFormPromptAdditions ------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited( 
+    /* [retval][out] */ BOOL *result)
+{
+    if (!result)
+        return E_POINTER;
+
+    *result = FALSE;
+    ASSERT(m_element);
+    RenderObject* renderer = m_element->renderer();
+    if (renderer && static_cast<WebCore::RenderTextControl*>(renderer)->isUserEdited())
+        *result = TRUE;
+    return S_OK;
+}