@@ -246,11 +246,36 @@ bool Element::IsObscured(LocationInfo* click_location,
246
246
return false ;
247
247
}
248
248
249
- bool is_obscured = false ;
250
249
251
250
CComPtr<IHTMLDocument2> doc;
252
251
this ->GetContainingDocument (false , &doc);
253
252
253
+ // If an element has a style value where pointer-events is set to 'none',
254
+ // the element is "obscured" by definition.
255
+ CComPtr<IHTMLWindow2> window;
256
+ hr = doc->get_parentWindow (&window);
257
+ if (SUCCEEDED (hr) && window) {
258
+ CComPtr<IHTMLWindow7> window7;
259
+ hr = window->QueryInterface <IHTMLWindow7>(&window7);
260
+ if (SUCCEEDED (hr) && window7) {
261
+ CComPtr<IHTMLDOMNode> node;
262
+ hr = this ->element_ ->QueryInterface <IHTMLDOMNode>(&node);
263
+ if (SUCCEEDED (hr) && node) {
264
+ CComPtr<IHTMLCSSStyleDeclaration> computed_style;
265
+ hr = window7->getComputedStyle (node, L" " , &computed_style);
266
+ if (SUCCEEDED (hr) && computed_style) {
267
+ CComBSTR pointer_events_value = L" " ;
268
+ hr = computed_style->get_pointerEvents (&pointer_events_value);
269
+ if (SUCCEEDED (hr) && pointer_events_value == L" none" ) {
270
+ return true ;
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
276
+
277
+ bool is_obscured = false ;
278
+
254
279
std::vector<LocationInfo> frame_locations;
255
280
LocationInfo element_location = {};
256
281
int status_code = this ->GetLocation (&element_location, &frame_locations);
@@ -588,7 +613,7 @@ int Element::GetLocationOnceScrolledIntoView(const ElementScrollBehavior scroll,
588
613
bool Element::IsHiddenByOverflow () {
589
614
LOG (TRACE) << " Entering Element::IsHiddenByOverflow" ;
590
615
591
- bool isOverflow = false ;
616
+ bool is_overflow = false ;
592
617
593
618
std::wstring script_source (L" (function() { return (" );
594
619
script_source += atoms::asString (atoms::IS_IN_PARENT_OVERFLOW);
@@ -602,12 +627,12 @@ bool Element::IsHiddenByOverflow() {
602
627
if (status_code == WD_SUCCESS) {
603
628
std::wstring raw_overflow_state (script_wrapper.result ().bstrVal );
604
629
std::string overflow_state = StringUtilities::ToString (raw_overflow_state);
605
- isOverflow = (overflow_state == " scroll" );
630
+ is_overflow = (overflow_state == " scroll" );
606
631
} else {
607
632
LOG (WARN) << " Unable to determine is element hidden by overflow" ;
608
633
}
609
634
610
- return isOverflow ;
635
+ return is_overflow ;
611
636
}
612
637
613
638
bool Element::IsLocationVisibleInFrames (const LocationInfo location,
0 commit comments