Skip to content

Commit

Permalink
Showing 2 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions content/dom_ui.ts
Original file line number Diff line number Diff line change
@@ -503,23 +503,23 @@ export const evalIfOK = (url: Pick<BgReq[kBgReq.eval], "u"> | string): boolean =
}

export const checkHidden = (cmd?: FgCmdAcrossFrames, count?: number, options?: OptionsWithForce): BOOL => {
if (wndSize_() < 3 || wndSize_(1) < 3) { return 1 }
if (isTop) { return 0 }
// here should not use the cache frameElement, because `getComputedStyle(frameElement).***` might break
const curFrameElement_ = !(Build.BTypes & ~BrowserType.Firefox) || Build.BTypes & BrowserType.Firefox
&& VOther === BrowserType.Firefox ? !isTop && frameElement : !isTop && frameElement_(),
el = !isTop && (curFrameElement_ || docEl_unsafe_());
if (!el) { return 0; }
let box = padClientRect_(getBoundingClientRect_(el)),
const curFrameElement = !(Build.BTypes & ~BrowserType.Firefox) || Build.BTypes & BrowserType.Firefox
&& VOther === BrowserType.Firefox ? frameElement : frameElement_(),
el = curFrameElement || docEl_unsafe_();
if (!el && wndSize_() > 3 && wndSize_(1) > 3) { return 0; }
let box = el && padClientRect_(getBoundingClientRect_(el)),
parEvents: ReturnType<typeof getParentVApi> | undefined,
result: boolean | BOOL = box.b <= box.t && box.r <= box.l || !isStyleVisible_(el)
result: boolean | BOOL = !box || box.b <= box.t && box.r <= box.l || !isStyleVisible_(el!)
if (cmd) {
// if in a forced cross-origin env (by setting doc.domain),
// then par.self.innerHeight works, but this behavior is undocumented,
// so here only use `parApi.innerHeight_()` in case
if ((Build.BTypes & BrowserType.Firefox ? (parEvents = getParentVApi()) : curFrameElement_)
&& (result || box.b <= 0
if ((Build.BTypes & BrowserType.Firefox ? curFrameElement && (parEvents = getParentVApi()) : curFrameElement)
&& (result || box!.b <= 0
|| (Build.BTypes & BrowserType.Firefox && parEvents !== parent
? box.t > parEvents!.i!() : box.t > (parent as Window).innerHeight))) {
? box!.t > parEvents!.i!() : box!.t > (parent as Window).innerHeight))) {
Build.BTypes & BrowserType.Firefox || (parEvents = getParentVApi());
if (parEvents
&& !parEvents.a(keydownEvents_)) {
16 changes: 8 additions & 8 deletions content/link_hints.ts
Original file line number Diff line number Diff line change
@@ -149,10 +149,10 @@ export function set_isClickListened_ (_newIsClickListened: boolean): void { isCl
export const activate = (options: HintsNS.ContentOptions, count: number, force?: 1 | TimerType.fake): void => {
if (isActive && !force || !isEnabled_) { return; }
if (checkHidden(kFgCmd.linkHints, count, options)) {
return clear()
return clear(1)
}
if (doc.body === null) {
clear()
manager_ || clear()
if (!_timer && readyState_ > "l") {
_timer = timeout_(activate.bind(0 as never, options, count), 300)
return pushHandler_(SuppressMost_, coreHints)
@@ -630,22 +630,22 @@ const resetHints = (): void => {
}
}

export const clear = (keepHudOrEvent?: 0 | 1 | Event, suppressTimeout?: number): void => {
export const clear = (onlySelfOrEvent?: 0 | 1 | Event, suppressTimeout?: number): void => {
if (!isAlive_) { return; }
if (keepHudOrEvent === 1 || keepHudOrEvent
if (onlySelfOrEvent === 1 || onlySelfOrEvent
&& (Build.BTypes & BrowserType.Chrome && Build.MinCVer < BrowserVer.Min$Event$$IsTrusted
? keepHudOrEvent.isTrusted !== !1 : keepHudOrEvent.isTrusted)
&& keepHudOrEvent.target === doc) {
? onlySelfOrEvent.isTrusted !== !1 : onlySelfOrEvent.isTrusted)
&& onlySelfOrEvent.target === doc) {
coreHints.p && manager_!.u(coreHints);
manager_ = null
if (keepHudOrEvent !== 1) {
if (onlySelfOrEvent !== 1) {
return;
}
}
const manager = coreHints.p as HintManager | null;
isActive = _timer = 0
manager_ = coreHints.p = null;
manager && manager.c(keepHudOrEvent, suppressTimeout);
manager && manager.c(onlySelfOrEvent, suppressTimeout);
frameList_.forEach((frameInfo: FrameHintsInfo): void => { try {
let frame = frameInfo.s, hasManager = frame.p
frame.p = null

0 comments on commit ad87e66

Please sign in to comment.