| 346 | } |
| 347 | |
| 348 | bool DocumentHost::GetDocumentDimensions(IHTMLDocument2* doc, LocationInfo* info) { |
| 349 | LOG(TRACE) << "Entering DocumentHost::GetDocumentDimensions"; |
| 350 | CComVariant document_height; |
| 351 | CComVariant document_width; |
| 352 | |
| 353 | // In non-standards-compliant mode, the BODY element represents the canvas. |
| 354 | // In standards-compliant mode, the HTML element represents the canvas. |
| 355 | CComPtr<IHTMLElement> canvas_element; |
| 356 | if (!IsStandardsMode(doc)) { |
| 357 | doc->get_body(&canvas_element); |
| 358 | if (!canvas_element) { |
| 359 | LOG(WARN) << "Unable to get canvas element from document in compatibility mode"; |
| 360 | return false; |
| 361 | } |
| 362 | } else { |
| 363 | CComPtr<IHTMLDocument3> document_element_doc; |
| 364 | doc->QueryInterface<IHTMLDocument3>(&document_element_doc); |
| 365 | if (!document_element_doc) { |
| 366 | LOG(WARN) << "Unable to get IHTMLDocument3 handle from document."; |
| 367 | return false; |
| 368 | } |
| 369 | |
| 370 | // The root node should be the HTML element. |
| 371 | document_element_doc->get_documentElement(&canvas_element); |
| 372 | if (!canvas_element) { |
| 373 | LOG(WARN) << "Could not retrieve document element."; |
| 374 | return false; |
| 375 | } |
| 376 | |
| 377 | CComPtr<IHTMLHtmlElement> html_element; |
| 378 | canvas_element->QueryInterface<IHTMLHtmlElement>(&html_element); |
| 379 | if (!html_element) { |
| 380 | LOG(WARN) << "Document element is not the HTML element."; |
| 381 | return false; |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | canvas_element->getAttribute(CComBSTR("scrollHeight"), 0, &document_height); |
| 386 | canvas_element->getAttribute(CComBSTR("scrollWidth"), 0, &document_width); |
| 387 | info->height = document_height.lVal; |
| 388 | info->width = document_width.lVal; |
| 389 | return true; |
| 390 | } |
| 391 | |
| 392 | bool DocumentHost::IsCrossZoneUrl(std::string url) { |
| 393 | LOG(TRACE) << "Entering Browser::IsCrossZoneUrl"; |
nothing calls this directly
no test coverage detected