Merge branch 'master' of github.com:cmcaine/tridactyl into johnbeard-hintread

This commit is contained in:
Oliver Blanthorn 2017-11-30 11:06:26 +00:00
commit b07180a37e
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 47 additions and 2 deletions

View file

@ -117,6 +117,47 @@ export function isSubstantial (element: Element) {
return true
}
/** This function decides whether the height attribute contained in a
ComputedStyle matters. For example, the height attribute doesn't matter for
elements that have "display: inline" because their height is overriden by
the height of the node they are in. */
export function heightMatters (style: CSSStyleDeclaration) {
switch (style.display) {
case "inline":
case "table-column":
case "table-column-group":
/* These two depend on other factors such as the element's type (span,
div...) or its parent's style. If the previous cases aren't enough to
decide whether the width attribute of the element matters, we should
maybe try to test for them.
case "initial":
case "inherit":*/
return false
}
return true
}
/* See [[heightMatters]] */
export function widthMatters (style: CSSStyleDeclaration) {
switch (style.display) {
case "inline":
case "table-column":
case "table-column-group":
case "table-header-group":
case "table-footer-group":
case "table-row-group":
case "table-cell":
case "table-row":
/* Take a look at [[heightMatters]] in order to understand why these two
cases are commented
case "initial":
case "inherit?:*/
return false
}
return true
}
// Saka-key caches getComputedStyle. Maybe it's a good idea!
/* let cgetComputedStyle = cacheDecorator(getComputedStyle) */
@ -136,8 +177,8 @@ export function isVisible (element: Element) {
case clientRect.top >= innerHeight - 4:
case clientRect.left < 0:
case clientRect.left >= innerWidth - 4:
case clientRect.width < 3:
case clientRect.height < 3:
case widthMatters(computedStyle) && clientRect.width < 3:
case heightMatters(computedStyle) && clientRect.height < 3:
case computedStyle.visibility !== 'visible':
case computedStyle.display === 'none':
return false

View file

@ -66,6 +66,10 @@ input {
overflow: hidden;
}
#completions table tr td {
overflow: hidden;
}
#completions img {
display: inline;
vertical-align: middle;