From: Daniel Carl Date: Mon, 6 Aug 2018 21:38:29 +0000 (+0200) Subject: Fix wrong hint label in case of scrolling. X-Git-Url: https://git.owens.tech/assets/me.png/assets/me.png/git?a=commitdiff_plain;h=491b3a4b6905b512fa5f1c99bf14260a3c75c79d;p=vimb.git Fix wrong hint label in case of scrolling. Also moved style for hintcontainer from user style to hints.js because there is no styling set at the moment the user should change. --- diff --git a/src/scripts/hints.css b/src/scripts/hints.css index 34e5bda..1b51117 100644 --- a/src/scripts/hints.css +++ b/src/scripts/hints.css @@ -1,6 +1,3 @@ -div[vimbhint='container']{ - position:static -} span[vimbhint^='label']{ -webkit-transform:translate(-4px,-4px); background-color:#fff; @@ -25,5 +22,4 @@ span[vimbhint^='label']{ } span[vimbhint='label focus']{ opacity:1; - z-index:225000 } diff --git a/src/scripts/hints.js b/src/scripts/hints.js index 9e245e0..7d7b379 100644 --- a/src/scripts/hints.js +++ b/src/scripts/hints.js @@ -170,8 +170,8 @@ var hints = Object.freeze((function(){ label.setAttribute( "style", [ "display:none;", - "left:", Math.max((rect.left + offsetX), offsetX), "px;", - "top:", Math.max((rect.top + offsetY), offsetY), "px;" + "left:", rect.left, "px;", + "top:", rect.top, "px;" ].join("") ); @@ -220,6 +220,7 @@ var hints = Object.freeze((function(){ /* append the fragment to the document */ var hDiv = doc.createElement("div"); hDiv.setAttribute(attr, "container"); + hDiv.setAttribute("style", "position:fixed;top:0;left:0;z-index:225000;"); hDiv.appendChild(fragment); if (doc.body) { doc.body.appendChild(hDiv); diff --git a/src/setting.c b/src/setting.c index d6c69b6..02f59fb 100644 --- a/src/setting.c +++ b/src/setting.c @@ -700,7 +700,7 @@ static int user_style(Client *c, const char *name, DataType type, void *value, v /* Inject the global styles with author level to allow restyling by user * style sheets. */ style = webkit_user_style_sheet_new(CSS_HINTS, - WEBKIT_USER_CONTENT_INJECT_TOP_FRAME, + WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_AUTHOR, NULL, NULL); webkit_user_content_manager_add_style_sheet(ucm, style); webkit_user_style_sheet_unref(style); diff --git a/tests/manual/hints/label-positioning.html b/tests/manual/hints/label-positioning.html index 04d0a53..6c54a29 100644 --- a/tests/manual/hints/label-positioning.html +++ b/tests/manual/hints/label-positioning.html @@ -18,5 +18,11 @@ one
two

+

+ To test the hints within iFrame + allow-universal-access-from-file-urls must be enabled. + And the page reloaded. + +

diff --git a/tests/manual/hints/wrapped.html b/tests/manual/hints/wrapped.html new file mode 100644 index 0000000..d6176f0 --- /dev/null +++ b/tests/manual/hints/wrapped.html @@ -0,0 +1,13 @@ + + + + Simple Links + + + one +
+ + two + + +