mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 17:47:34 +09:00
ported from mozilla:
- Bug 148624 - only show tooltip when document has focus. r=emilio (8ae372dc88d1) - Bug 1857513 - Use window activeness rather than document.hasFocus() to display chrome-only tooltips. r=smaug (4cbf370b4e16)
This commit is contained in:
parent
e90473bdda
commit
f3deac5f5f
1 changed files with 42 additions and 39 deletions
|
|
@ -390,9 +390,13 @@ nsXULTooltipListener::ShowTooltip()
|
||||||
return NS_ERROR_FAILURE; // the target node doesn't need a tooltip
|
return NS_ERROR_FAILURE; // the target node doesn't need a tooltip
|
||||||
|
|
||||||
// set the node in the document that triggered the tooltip and show it
|
// set the node in the document that triggered the tooltip and show it
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
// Make sure the document still has focus.
|
||||||
do_QueryInterface(tooltipNode->GetComposedDoc());
|
nsIDocument* doc = tooltipNode->GetComposedDoc();
|
||||||
if (xulDoc) {
|
if (!doc || !nsContentUtils::IsChromeDoc(doc) ||
|
||||||
|
doc->GetDocumentState().HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure the target node is still attached to some document.
|
// Make sure the target node is still attached to some document.
|
||||||
// It might have been deleted.
|
// It might have been deleted.
|
||||||
if (sourceNode->IsInComposedDoc()) {
|
if (sourceNode->IsInComposedDoc()) {
|
||||||
|
|
@ -417,7 +421,7 @@ nsXULTooltipListener::ShowTooltip()
|
||||||
this, false, false);
|
this, false, false);
|
||||||
|
|
||||||
// listen for mousedown, mouseup, keydown, and DOMMouseScroll events at document level
|
// listen for mousedown, mouseup, keydown, and DOMMouseScroll events at document level
|
||||||
nsIDocument* doc = sourceNode->GetComposedDoc();
|
doc = sourceNode->GetComposedDoc();
|
||||||
if (doc) {
|
if (doc) {
|
||||||
// Probably, we should listen to untrusted events for hiding tooltips
|
// Probably, we should listen to untrusted events for hiding tooltips
|
||||||
// on content since tooltips might disturb something of web
|
// on content since tooltips might disturb something of web
|
||||||
|
|
@ -435,7 +439,6 @@ nsXULTooltipListener::ShowTooltip()
|
||||||
}
|
}
|
||||||
mSourceNode = nullptr;
|
mSourceNode = nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue