Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/MsHTMLUtils.cpp

Issue 6505394822184960: Issue 1109 - Support notifications (Closed)
Patch Set: improve ReplaceMulti and change loading of html template Created June 29, 2015, 11:09 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/shared/MsHTMLUtils.h ('k') | src/shared/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/MsHTMLUtils.cpp
diff --git a/src/shared/MsHTMLUtils.cpp b/src/shared/MsHTMLUtils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ae604d61af434a9c1a4ee63fc622a735f53863b8
--- /dev/null
+++ b/src/shared/MsHTMLUtils.cpp
@@ -0,0 +1,33 @@
+#include "MsHTMLUtils.h"
+
+GetHtmlElementAttributeResult GetHtmlElementAttribute(IHTMLElement& htmlElement,
+ const ATL::CComBSTR& attributeName)
+{
+ GetHtmlElementAttributeResult retValue;
+ ATL::CComVariant vAttr;
+ ATL::CComPtr<IHTMLElement4> htmlElement4;
+ if (FAILED(htmlElement.QueryInterface(&htmlElement4)) || !htmlElement4)
+ {
+ return retValue;
+ }
+ ATL::CComPtr<IHTMLDOMAttribute> attributeNode;
+ if (FAILED(htmlElement4->getAttributeNode(attributeName, &attributeNode)) || !attributeNode)
+ {
+ return retValue;
+ }
+ // we set that attribute found but it's not necessary that we can retrieve its value
+ retValue.isAttributeFound = true;
+ if (FAILED(attributeNode->get_nodeValue(&vAttr)))
+ {
+ return retValue;
+ }
+ if (vAttr.vt == VT_BSTR && vAttr.bstrVal)
+ {
+ retValue.attributeValue = vAttr.bstrVal;
+ }
+ else if (vAttr.vt == VT_I4)
+ {
+ retValue.attributeValue = std::to_wstring(vAttr.iVal);
+ }
+ return retValue;
+}
« no previous file with comments | « src/shared/MsHTMLUtils.h ('k') | src/shared/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld