MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / IsStandardsMode

Method IsStandardsMode

cpp/iedriver/DocumentHost.cpp:327–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327bool DocumentHost::IsStandardsMode(IHTMLDocument2* doc) {
328 LOG(TRACE) << "Entering DocumentHost::IsStandardsMode";
329 CComPtr<IHTMLDocument5> compatibility_mode_doc;
330 doc->QueryInterface<IHTMLDocument5>(&compatibility_mode_doc);
331 if (!compatibility_mode_doc) {
332 LOG(WARN) << "Unable to cast document to IHTMLDocument5. IE6 or greater is required.";
333 return false;
334 }
335
336 CComBSTR compatibility_mode;
337 HRESULT hr = compatibility_mode_doc->get_compatMode(&compatibility_mode);
338 if (FAILED(hr)) {
339 LOGHR(WARN, hr) << "Failed calling get_compatMode.";
340 return false;
341 }
342 // Compatibility mode should be "BackCompat" for quirks mode, and
343 // "CSS1Compat" for standards mode. Check for "BackCompat" because
344 // that's less likely to change.
345 return compatibility_mode != L"BackCompat";
346}
347
348bool DocumentHost::GetDocumentDimensions(IHTMLDocument2* doc, LocationInfo* info) {
349 LOG(TRACE) << "Entering DocumentHost::GetDocumentDimensions";

Callers

nothing calls this directly

Calls 1

LOGClass · 0.50

Tested by

no test coverage detected