Don't show hints for opacity: 0 elements

Fixes #2347
This commit is contained in:
Florian Bruhin 2017-02-24 09:12:59 +01:00
parent e832105dd5
commit 3feb4211fe
4 changed files with 22 additions and 1 deletions

View File

@ -248,6 +248,7 @@ class WebKitElement(webelem.AbstractWebElement):
hidden_attributes = {
'visibility': 'hidden',
'display': 'none',
'opacity': '0',
}
for k, v in hidden_attributes.items():
if self._elem.styleProperty(k, QWebElement.ComputedStyle) == v:

View File

@ -115,7 +115,8 @@ window._qutebrowser.webelem = (function() {
// See https://github.com/vimperator/vimperator-labs/issues/236
if (elem.nodeName.toLowerCase() !== "area" && (
style.getPropertyValue("visibility") !== "visible" ||
style.getPropertyValue("display") === "none")) {
style.getPropertyValue("display") === "none" ||
style.getPropertyValue("opacity") === "0")) {
return false;
}

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Invisible links</title>
</head>
<body>
<p>None of those invisible links should get a hint.</p>
<a href="/data/hello.txt" style="visibility: hidden">visibility: hidden</a>
<a href="/data/hello.txt" style="display: none">display: none</a>
<a href="/data/hello.txt" style="opacity: 0">opacity: 0</a>
</body>
</html>

View File

@ -183,6 +183,11 @@ Feature: Using hints
# The actual check is already done above
Then no crash should happen
Scenario: Hinting invisible elements
When I open data/hints/invisible.html
And I run :hint
Then the error "No elements found." should be shown
### iframes
@qtwebengine_todo: Hinting in iframes is not implemented yet