[Win] Implement methods to get and set inner html.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Nov 2015 08:37:31 +0000 (08:37 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Nov 2015 08:37:31 +0000 (08:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151569

Reviewed by Alex Christensen.

* DOMHTMLClasses.cpp:
(DOMHTMLElement::innerHTML):
(DOMHTMLElement::setInnerHTML):
(DOMHTMLElement::innerText):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192762 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/win/ChangeLog
Source/WebKit/win/DOMHTMLClasses.cpp

index 3b99f48..0b3033c 100644 (file)
@@ -1 +1,13 @@
+2015-11-24  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] Implement methods to get and set inner html.
+        https://bugs.webkit.org/show_bug.cgi?id=151569
+
+        Reviewed by Alex Christensen.
+
+        * DOMHTMLClasses.cpp:
+        (DOMHTMLElement::innerHTML):
+        (DOMHTMLElement::setInnerHTML):
+        (DOMHTMLElement::innerText):
+
 == Rolled over to ChangeLog-2015-11-21 ==
index ab6a869..e481d0d 100644 (file)
@@ -502,17 +502,21 @@ HRESULT DOMHTMLElement::setClassName(_In_ BSTR /*className*/)
 
 HRESULT DOMHTMLElement::innerHTML(__deref_opt_out BSTR* result)
 {
-    ASSERT_NOT_REACHED();
     if (!result)
         return E_POINTER;
-    *result = nullptr;
-    return E_NOTIMPL;
+    String innerHtmlString = downcast<HTMLElement>(m_element)->innerHTML();
+    *result = BString(innerHtmlString).release();
+    return S_OK;
 }
         
-HRESULT DOMHTMLElement::setInnerHTML(_In_ BSTR /*html*/)
+HRESULT DOMHTMLElement::setInnerHTML(_In_ BSTR html)
 {
-    ASSERT_NOT_REACHED();
-    return E_NOTIMPL;
+    ASSERT(is<HTMLElement>(m_element));
+    HTMLElement* htmlElement = downcast<HTMLElement>(m_element);
+    String htmlString(html, SysStringLen(html));
+    ExceptionCode ec = 0;
+    htmlElement->setInnerHTML(htmlString, ec);
+    return S_OK;
 }
         
 HRESULT DOMHTMLElement::innerText(__deref_opt_out BSTR* result)
@@ -528,10 +532,10 @@ HRESULT DOMHTMLElement::innerText(__deref_opt_out BSTR* result)
 HRESULT DOMHTMLElement::setInnerText(_In_ BSTR text)
 {
     ASSERT(is<HTMLElement>(m_element));
-    HTMLElement* htmlEle = downcast<HTMLElement>(m_element);
+    HTMLElement* htmlElement = downcast<HTMLElement>(m_element);
     WTF::String textString(text, SysStringLen(text));
     WebCore::ExceptionCode ec = 0;
-    htmlEle->setInnerText(textString, ec);
+    htmlElement->setInnerText(textString, ec);
     return S_OK;
 }