Hints are influenced by page stylesheet if it uses * #925

Closed
The-Compiler opened this Issue Sep 5, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@The-Compiler
Collaborator

The-Compiler commented Sep 5, 2015

e.g. with this test case using * { padding: 10px; }:

<head>
    <style type="text/css">
        * {
            padding: 10px;
        }
    </style>
</head>

<body>
    <p>
    This hint should look normal:
    <a href="http://www.qutebrowser.org/">test</a>
    </p>
</body>

We get this:
qutebug1

One possibility would be to set padding to 0 with !important for the hints:

diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
index fdc2014..c7ccf18 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -342,6 +342,8 @@ class HintManager(QObject):
             ('font', config.get('fonts', 'hints') + ' !important'),
             ('border', config.get('hints', 'border') + ' !important'),
             ('opacity', str(config.get('hints', 'opacity')) + ' !important'),
+            ('padding', '0 !important'),
+            ('margin', '0 !important'),
         ]

         # Make text uppercase if set in config

(we might also want to set more - see CSS reset)

but that renders the hint at the wrong position:

qutebug2

@9man

This comment has been minimized.

Show comment
Hide comment
@9man

9man Nov 10, 2015

Here is an example I found in the wild of this. On this university journal website, the hints all have a width that extends to the right edge of the page. They have three style sheets linked for that main page (1, 2, 3). The second one has a rule of:

body > * {
    padding: 0 2.5%;
    width: 95%;
}

9man commented Nov 10, 2015

Here is an example I found in the wild of this. On this university journal website, the hints all have a width that extends to the right edge of the page. They have three style sheets linked for that main page (1, 2, 3). The second one has a rule of:

body > * {
    padding: 0 2.5%;
    width: 95%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment