From 6964513dde70ad179d40f137cc154ed187ff6612 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 14 Jun 2021 17:17:29 +0300 Subject: [PATCH] Fix form detection from style attribute --- keepassxc-browser/content/keepassxc-browser.js | 2 +- keepassxc-browser/content/ui.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 72a11a9..f8e13f7 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -1976,7 +1976,7 @@ kpxcObserverHelper.initObserver = async function() { } else if (mut.removedNodes.length > 0) { kpxcObserverHelper.handleObserverRemove(mut.removedNodes[0]); } - } else if (mut.type === 'attributes' && mut.attributeName === 'class') { + } else if (mut.type === 'attributes' && (mut.attributeName === 'class' || mut.attributeName === 'style')) { // Only accept targets with forms const forms = mut.target.nodeName === 'FORM' ? mut.target : mut.target.getElementsByTagName('form'); if (forms.length === 0 && !kpxcSites.exceptionFound(mut.target.classList)) { diff --git a/keepassxc-browser/content/ui.js b/keepassxc-browser/content/ui.js index b8018d2..f93266f 100644 --- a/keepassxc-browser/content/ui.js +++ b/keepassxc-browser/content/ui.js @@ -125,10 +125,12 @@ kpxcUI.setIconPosition = function(icon, field, rtl = false, segmented = false) { left += size + 10; } - icon.style.top = Pixels(top + document.scrollingElement.scrollTop + offset + 1); + const scrollTop = document.scrollingElement ? document.scrollingElement.scrollTop : 0; + const scrollLeft = document.scrollingElement ? document.scrollingElement.scrollLeft : 0; + icon.style.top = Pixels(top + scrollTop + offset + 1); icon.style.left = rtl - ? Pixels((left + document.scrollingElement.scrollLeft) + offset) - : Pixels(left + document.scrollingElement.scrollLeft + field.offsetWidth - size - offset); + ? Pixels((left + scrollLeft) + offset) + : Pixels(left + scrollLeft + field.offsetWidth - size - offset); }; kpxcUI.deleteHiddenIcons = function(iconList, attr) {