| 895 | } |
| 896 | |
| 897 | bool Element::IsSelected() { |
| 898 | LOG(TRACE) << "Entering Element::IsSelected"; |
| 899 | |
| 900 | bool selected(false); |
| 901 | // The atom is just the definition of an anonymous |
| 902 | // function: "function() {...}"; Wrap it in another function so we can |
| 903 | // invoke it with our arguments without polluting the current namespace. |
| 904 | std::wstring script_source(L"(function() { return ("); |
| 905 | script_source += atoms::asString(atoms::IS_SELECTED); |
| 906 | script_source += L")})();"; |
| 907 | |
| 908 | CComPtr<IHTMLDocument2> doc; |
| 909 | this->GetContainingDocument(false, &doc); |
| 910 | Script script_wrapper(doc, script_source, 1); |
| 911 | script_wrapper.AddArgument(this->element_); |
| 912 | int status_code = script_wrapper.Execute(); |
| 913 | |
| 914 | if (status_code == WD_SUCCESS && script_wrapper.ResultIsBoolean()) { |
| 915 | selected = script_wrapper.result().boolVal == VARIANT_TRUE; |
| 916 | } else { |
| 917 | LOG(WARN) << "Unable to determine is element selected"; |
| 918 | } |
| 919 | |
| 920 | return selected; |
| 921 | } |
| 922 | |
| 923 | bool Element::IsImageMap(LocationInfo* location) { |
| 924 | CComPtr<IHTMLElement> map_element; |
no test coverage detected