From 778e1a64e49e0326283203da642d53dd7173e267 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Wed, 2 Dec 2015 16:27:37 +0100 Subject: [PATCH 1/2] Improve text enlargement in the help dialog There is never supposed to be a scroll bar. However, there could be sometimes before. The new check is simpler and better. --- extension/lib/help.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extension/lib/help.coffee b/extension/lib/help.coffee index 88461666..92de62f6 100644 --- a/extension/lib/help.coffee +++ b/extension/lib/help.coffee @@ -60,8 +60,7 @@ injectHelp = (window, vimfx) -> computedStyle = window.getComputedStyle(container) fontSize = originalFontSize = parseFloat(computedStyle.getPropertyValue('font-size')) - while wrapper.clientHeight < container.clientHeight and - fontSize <= MAX_FONT_SIZE + while container.scrollTopMax == 0 and fontSize <= MAX_FONT_SIZE fontSize++ container.style.fontSize = "#{fontSize}px" container.style.fontSize = "#{Math.max(fontSize - 1, originalFontSize)}px" From 1dde48c6b29becb3268e7fdbcf27e87ff0290b13 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Wed, 2 Dec 2015 17:34:25 +0100 Subject: [PATCH 2/2] Always set `wrapper.href` if `wrapper.type == 'link'` --- extension/lib/commands-frame.coffee | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index ef61e8aa..1fbe9a27 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -94,23 +94,25 @@ helper_follow = ({id, combine = true}, matcher, {vim}) -> length = vim.state.markerElements.push(element) wrapper = {type, semantic, shape, elementIndex: length - 1} - # Combine links with the same href. - if combine and wrapper.type == 'link' and - # If the element has an 'onclick' attribute we cannot be sure that all - # links with this href actually do the same thing. On some pages, such as - # startpage.com, actual proper links have the 'onclick' attribute, so we - # can’t exclude such links in `utils.isProperLink`. - not element.hasAttribute('onclick') + if wrapper.type == 'link' {href} = element wrapper.href = href - if href of hrefs - parent = hrefs[href] - wrapper.parentIndex = parent.elementIndex - parent.shape.area += wrapper.shape.area - parent.numChildren++ - else - wrapper.numChildren = 0 - hrefs[href] = wrapper + + # Combine links with the same href. + if combine and wrapper.type == 'link' and + # If the element has an 'onclick' attribute we cannot be sure that all + # links with this href actually do the same thing. On some pages, such + # as startpage.com, actual proper links have the 'onclick' attribute, + # so we can’t exclude such links in `utils.isProperLink`. + not element.hasAttribute('onclick') + if href of hrefs + parent = hrefs[href] + wrapper.parentIndex = parent.elementIndex + parent.shape.area += wrapper.shape.area + parent.numChildren++ + else + wrapper.numChildren = 0 + hrefs[href] = wrapper return wrapper