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

Side by Side Diff: src/shared/MsHTMLUtils.cpp

Issue 6505394822184960: Issue 1109 - Support notifications (Closed)
Patch Set: fix naming Created July 29, 2015, 11:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include "MsHTMLUtils.h"
2
3 GetHtmlElementAttributeResult GetHtmlElementAttribute(IHTMLElement& htmlElement,
4 const ATL::CComBSTR& attributeName)
5 {
6 GetHtmlElementAttributeResult retValue;
7 ATL::CComVariant vAttr;
8 ATL::CComPtr<IHTMLElement4> htmlElement4;
9 if (FAILED(htmlElement.QueryInterface(&htmlElement4)) || !htmlElement4)
10 {
11 return retValue;
12 }
13 ATL::CComPtr<IHTMLDOMAttribute> attributeNode;
14 if (FAILED(htmlElement4->getAttributeNode(attributeName, &attributeNode)) || ! attributeNode)
15 {
16 return retValue;
17 }
18 // we set that attribute found but it's not necessary that we can retrieve its value
19 retValue.isAttributeFound = true;
20 if (FAILED(attributeNode->get_nodeValue(&vAttr)))
21 {
22 return retValue;
23 }
24 if (vAttr.vt == VT_BSTR && vAttr.bstrVal)
25 {
26 retValue.attributeValue = vAttr.bstrVal;
27 }
28 else if (vAttr.vt == VT_I4)
29 {
30 retValue.attributeValue = std::to_wstring(vAttr.iVal);
31 }
32 return retValue;
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld