aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/document.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2019-12-03 18:30:22 -0800
committerAlex Yatskov <alex@foosoft.net>2019-12-03 18:30:22 -0800
commitf9ea6206550ceee625ea93215a6e08d45a750086 (patch)
tree803fe11a788a631076b3fb11a98e50bb8b454396 /ext/fg/js/document.js
parent08ad2779678cd447bd747c2b155ef9b5135fdf5d (diff)
parent3975aabf4dc283d49ec46d0ed7ead982b9fa7441 (diff)
Merge branch 'master' into testing
Diffstat (limited to 'ext/fg/js/document.js')
-rw-r--r--ext/fg/js/document.js23
1 files changed, 4 insertions, 19 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index a168705e..10dea7df 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -17,7 +17,7 @@
*/
-const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^\)]*,\s*0(?:\.0+)?\s*\)/;
+const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^)]*,\s*0(?:\.0+)?\s*\)/;
function docSetImposterStyle(style, propertyName, value) {
style.setProperty(propertyName, value, 'important');
@@ -223,7 +223,7 @@ function isPointInRange(x, y, range) {
const {node, offset, content} = TextSourceRange.seekForward(range.endContainer, range.endOffset, 1);
range.setEnd(node, offset);
- if (!isWhitespace(content) && isPointInAnyRect(x, y, range.getClientRects())) {
+ if (!isWhitespace(content) && DOM.isPointInAnyRect(x, y, range.getClientRects())) {
return true;
}
} finally {
@@ -234,7 +234,7 @@ function isPointInRange(x, y, range) {
const {node, offset, content} = TextSourceRange.seekBackward(range.startContainer, range.startOffset, 1);
range.setStart(node, offset);
- if (!isWhitespace(content) && isPointInAnyRect(x, y, range.getClientRects())) {
+ if (!isWhitespace(content) && DOM.isPointInAnyRect(x, y, range.getClientRects())) {
// This purposefully leaves the starting offset as modified and sets the range length to 0.
range.setEnd(node, offset);
return true;
@@ -248,21 +248,6 @@ function isWhitespace(string) {
return string.trim().length === 0;
}
-function isPointInAnyRect(x, y, rects) {
- for (const rect of rects) {
- if (isPointInRect(x, y, rect)) {
- return true;
- }
- }
- return false;
-}
-
-function isPointInRect(x, y, rect) {
- return (
- x >= rect.left && x < rect.right &&
- y >= rect.top && y < rect.bottom);
-}
-
const caretRangeFromPoint = (() => {
if (typeof document.caretRangeFromPoint === 'function') {
// Chrome, Edge
@@ -359,7 +344,7 @@ function isElementTransparent(element) {
}
const style = window.getComputedStyle(element);
return (
- parseFloat(style.opacity) < 0 ||
+ parseFloat(style.opacity) <= 0 ||
style.visibility === 'hidden' ||
(style.backgroundImage === 'none' && isColorTransparent(style.backgroundColor))
);