summaryrefslogtreecommitdiffstats
path: root/layout/xul
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--layout/xul/nsMenuPopupFrame.cpp33
-rw-r--r--layout/xul/nsSplitterFrame.cpp1
-rw-r--r--layout/xul/nsXULTooltipListener.cpp64
-rw-r--r--layout/xul/reftest/reftest.list2
-rw-r--r--layout/xul/test/browser_bug685470.js4
-rw-r--r--layout/xul/test/browser_bug703210.js4
-rw-r--r--layout/xul/test/browser_bug706743.js4
-rw-r--r--layout/xul/test/chrome.toml1
-rw-r--r--layout/xul/test/test_windowminmaxsize.xhtml62
-rw-r--r--layout/xul/test/titledpanelwindow.xhtml5
10 files changed, 56 insertions, 124 deletions
diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp
index b41a666707..8ebb8b01d5 100644
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -220,21 +220,16 @@ widget::PopupLevel nsMenuPopupFrame::GetPopupLevel(bool aIsNoAutoHide) const {
}
// If the level attribute has been set, use that.
- static Element::AttrValuesArray strings[] = {
- nsGkAtoms::top, nsGkAtoms::parent, nsGkAtoms::floating, nullptr};
+ static Element::AttrValuesArray strings[] = {nsGkAtoms::top,
+ nsGkAtoms::parent, nullptr};
switch (mContent->AsElement()->FindAttrValueIn(
kNameSpaceID_None, nsGkAtoms::level, strings, eCaseMatters)) {
case 0:
return PopupLevel::Top;
case 1:
return PopupLevel::Parent;
- case 2:
- return PopupLevel::Floating;
- }
-
- // Panels with titlebars most likely want to be floating popups.
- if (mContent->AsElement()->HasAttr(nsGkAtoms::titlebar)) {
- return PopupLevel::Floating;
+ default:
+ break;
}
// If this panel is a noautohide panel, the default is the parent level.
@@ -281,20 +276,6 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
}
}
- nsAutoString title;
- if (widgetData.mNoAutoHide &&
- mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::titlebar,
- nsGkAtoms::normal, eCaseMatters)) {
- widgetData.mBorderStyle = widget::BorderStyle::Title;
-
- mContent->AsElement()->GetAttr(nsGkAtoms::label, title);
- if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::close,
- nsGkAtoms::_true, eCaseMatters)) {
- widgetData.mBorderStyle =
- widgetData.mBorderStyle | widget::BorderStyle::Close;
- }
- }
-
bool remote = HasRemoteContent();
const auto mode = nsLayoutUtils::GetFrameTransparency(this, this);
@@ -328,12 +309,6 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
PropagateStyleToWidget();
- // most popups don't have a title so avoid setting the title if there isn't
- // one
- if (!title.IsEmpty()) {
- widget->SetTitle(title);
- }
-
return NS_OK;
}
diff --git a/layout/xul/nsSplitterFrame.cpp b/layout/xul/nsSplitterFrame.cpp
index 89d3ac1c25..47eadf8c28 100644
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -29,7 +29,6 @@
#include "mozilla/ComputedStyle.h"
#include "mozilla/CSSOrderAwareFrameIterator.h"
#include "nsContainerFrame.h"
-#include "nsContentCID.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsContentUtils.h"
diff --git a/layout/xul/nsXULTooltipListener.cpp b/layout/xul/nsXULTooltipListener.cpp
index e8592dfc3a..77dfbb7a30 100644
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -12,6 +12,7 @@
#include "mozilla/dom/Document.h"
#include "nsGkAtoms.h"
#include "nsMenuPopupFrame.h"
+#include "nsIContentInlines.h"
#include "nsIDragService.h"
#include "nsIDragSession.h"
#include "nsITreeView.h"
@@ -79,16 +80,9 @@ void nsXULTooltipListener::MouseOut(Event* aEvent) {
// check to see if the mouse left the targetNode, and if so,
// hide the tooltip
if (currentTooltip) {
- // which node did the mouse leave?
- EventTarget* eventTarget = aEvent->GetComposedTarget();
- nsCOMPtr<nsINode> targetNode = nsINode::FromEventTargetOrNull(eventTarget);
- if (targetNode && targetNode->IsContent() &&
- !targetNode->AsContent()->GetContainingShadow()) {
- eventTarget = aEvent->GetTarget();
- }
-
- nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
- if (pm) {
+ nsCOMPtr<nsINode> targetNode =
+ nsINode::FromEventTargetOrNull(aEvent->GetOriginalTarget());
+ if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
nsCOMPtr<nsINode> tooltipNode =
pm->GetLastTriggerTooltipNode(currentTooltip->GetComposedDoc());
@@ -98,8 +92,7 @@ void nsXULTooltipListener::MouseOut(Event* aEvent) {
// tooltip appears positioned near the mouse.
nsCOMPtr<EventTarget> relatedTarget =
aEvent->AsMouseEvent()->GetRelatedTarget();
- nsIContent* relatedContent =
- nsIContent::FromEventTargetOrNull(relatedTarget);
+ auto* relatedContent = nsIContent::FromEventTargetOrNull(relatedTarget);
if (tooltipNode == targetNode && relatedContent != currentTooltip) {
HideTooltip();
// reset special tree tracking
@@ -133,12 +126,12 @@ void nsXULTooltipListener::MouseMove(Event* aEvent) {
}
nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip);
- nsCOMPtr<EventTarget> eventTarget = aEvent->GetComposedTarget();
- nsIContent* content = nsIContent::FromEventTargetOrNull(eventTarget);
+ auto* const mouseMoveTarget =
+ nsIContent::FromEventTargetOrNull(aEvent->GetOriginalTarget());
bool isSameTarget = true;
nsCOMPtr<nsIContent> tempContent = do_QueryReferent(mPreviousMouseMoveTarget);
- if (tempContent && tempContent != content) {
+ if (tempContent && tempContent != mouseMoveTarget) {
isSameTarget = false;
}
@@ -153,13 +146,15 @@ void nsXULTooltipListener::MouseMove(Event* aEvent) {
return;
}
mMouseScreenPoint = newMouseScreenPoint;
- mPreviousMouseMoveTarget = do_GetWeakReference(content);
+ mPreviousMouseMoveTarget = do_GetWeakReference(mouseMoveTarget);
- nsCOMPtr<nsIContent> sourceContent =
- do_QueryInterface(aEvent->GetCurrentTarget());
+ auto* const sourceContent =
+ nsIContent::FromEventTargetOrNull(aEvent->GetCurrentTarget());
mSourceNode = do_GetWeakReference(sourceContent);
mIsSourceTree = sourceContent->IsXULElement(nsGkAtoms::treechildren);
- if (mIsSourceTree) CheckTreeBodyMove(mouseEvent);
+ if (mIsSourceTree) {
+ CheckTreeBodyMove(mouseEvent);
+ }
// as the mouse moves, we want to make sure we reset the timer to show it,
// so that the delay is from when the mouse stops moving, not when it enters
@@ -184,14 +179,16 @@ void nsXULTooltipListener::MouseMove(Event* aEvent) {
// when hovering over an element inside it. The popupsinherittooltip
// attribute may be used to disable this behaviour, which is useful for
// large menu hierarchies such as bookmarks.
- if (!sourceContent->IsElement() ||
- !sourceContent->AsElement()->AttrValueIs(
- kNameSpaceID_None, nsGkAtoms::popupsinherittooltip,
- nsGkAtoms::_true, eCaseMatters)) {
- for (nsIContent* targetContent =
- nsIContent::FromEventTargetOrNull(eventTarget);
+ const bool allowTooltipCrossingPopup =
+ !sourceContent->GetParent() ||
+ (sourceContent->IsElement() &&
+ sourceContent->AsElement()->AttrValueIs(
+ kNameSpaceID_None, nsGkAtoms::popupsinherittooltip,
+ nsGkAtoms::_true, eCaseMatters));
+ if (!allowTooltipCrossingPopup) {
+ for (auto* targetContent = mouseMoveTarget;
targetContent && targetContent != sourceContent;
- targetContent = targetContent->GetParent()) {
+ targetContent = targetContent->GetFlattenedTreeParent()) {
if (targetContent->IsAnyOfXULElements(
nsGkAtoms::menupopup, nsGkAtoms::panel, nsGkAtoms::tooltip)) {
mSourceNode = nullptr;
@@ -200,13 +197,12 @@ void nsXULTooltipListener::MouseMove(Event* aEvent) {
}
}
- mTargetNode = do_GetWeakReference(eventTarget);
+ mTargetNode = do_GetWeakReference(mouseMoveTarget);
if (mTargetNode) {
nsresult rv = NS_NewTimerWithFuncCallback(
getter_AddRefs(mTooltipTimer), sTooltipCallback, this,
- LookAndFeel::GetInt(LookAndFeel::IntID::TooltipDelay, 500),
- nsITimer::TYPE_ONE_SHOT, "sTooltipCallback",
- GetMainThreadSerialEventTarget());
+ StaticPrefs::ui_tooltip_delay_ms(), nsITimer::TYPE_ONE_SHOT,
+ "sTooltipCallback", GetMainThreadSerialEventTarget());
if (NS_FAILED(rv)) {
mTargetNode = nullptr;
mSourceNode = nullptr;
@@ -215,7 +211,9 @@ void nsXULTooltipListener::MouseMove(Event* aEvent) {
return;
}
- if (mIsSourceTree) return;
+ if (mIsSourceTree) {
+ return;
+ }
// Hide the tooltip if it is currently showing.
if (currentTooltip) {
HideTooltip();
@@ -502,7 +500,9 @@ static void GetImmediateChild(nsIContent* aContent, nsAtom* aTag,
nsresult nsXULTooltipListener::FindTooltip(nsIContent* aTarget,
nsIContent** aTooltip) {
- if (!aTarget) return NS_ERROR_NULL_POINTER;
+ if (!aTarget) {
+ return NS_ERROR_NULL_POINTER;
+ }
// before we go on, make sure that target node still has a window
Document* document = aTarget->GetComposedDoc();
diff --git a/layout/xul/reftest/reftest.list b/layout/xul/reftest/reftest.list
index a2b0b6c6fe..d512addfb1 100644
--- a/layout/xul/reftest/reftest.list
+++ b/layout/xul/reftest/reftest.list
@@ -11,4 +11,4 @@ fails-if(useDrawSnapshot) != chrome://reftest/content/xul/reftest/scrollbar-mark
fails-if(useDrawSnapshot) != chrome://reftest/content/xul/reftest/scrollbar-marks2.html chrome://reftest/content/xul/reftest/scrollbar-marks-ref.html
fails-if(useDrawSnapshot) != chrome://reftest/content/xul/reftest/scrollbar-marks2.html chrome://reftest/content/xul/reftest/scrollbar-marks.html
# This test is fuzzy as the marks cannot be positioned exactly as the real ones are measured in dev pixels.
-fuzzy(0-10,0-170) fuzzy-if(winWidget&&isDebugBuild&&layersGPUAccelerated&&!is64Bit,1-1,74-170) == chrome://reftest/content/xul/reftest/scrollbar-marks-overlay.html chrome://reftest/content/xul/reftest/scrollbar-marks-overlay-ref.html
+fuzzy(0-10,0-170) fuzzy-if(winWidget&&isDebugBuild&&!is64Bit,1-1,74-170) == chrome://reftest/content/xul/reftest/scrollbar-marks-overlay.html chrome://reftest/content/xul/reftest/scrollbar-marks-overlay-ref.html
diff --git a/layout/xul/test/browser_bug685470.js b/layout/xul/test/browser_bug685470.js
index 46997b2e3b..faf013743c 100644
--- a/layout/xul/test/browser_bug685470.js
+++ b/layout/xul/test/browser_bug685470.js
@@ -6,9 +6,7 @@ add_task(async function () {
"data:text/html," + html
);
- await new Promise(resolve => {
- SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
- });
+ await SpecialPowers.pushPrefEnv({ set: [["ui.tooltip.delay_ms", 0]] });
await BrowserTestUtils.synthesizeMouseAtCenter(
"#p1",
diff --git a/layout/xul/test/browser_bug703210.js b/layout/xul/test/browser_bug703210.js
index 5026875310..cf5a0850a3 100644
--- a/layout/xul/test/browser_bug703210.js
+++ b/layout/xul/test/browser_bug703210.js
@@ -10,9 +10,7 @@ add_task(async function () {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
let browser = gBrowser.selectedBrowser;
- await new Promise(resolve => {
- SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
- });
+ await SpecialPowers.pushPrefEnv({ set: [["ui.tooltip.delay_ms", 0]] });
let popupShownPromise = BrowserTestUtils.waitForEvent(
document,
diff --git a/layout/xul/test/browser_bug706743.js b/layout/xul/test/browser_bug706743.js
index c28721e831..af872644b9 100644
--- a/layout/xul/test/browser_bug706743.js
+++ b/layout/xul/test/browser_bug706743.js
@@ -8,9 +8,7 @@ add_task(async function () {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
let browser = gBrowser.selectedBrowser;
- await new Promise(resolve => {
- SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
- });
+ await SpecialPowers.pushPrefEnv({ set: [["ui.tooltip.delay_ms", 0]] });
// Send a mousemove at a known position to start the test.
await BrowserTestUtils.synthesizeMouse(
diff --git a/layout/xul/test/chrome.toml b/layout/xul/test/chrome.toml
index 6588db2ea4..f2262b3086 100644
--- a/layout/xul/test/chrome.toml
+++ b/layout/xul/test/chrome.toml
@@ -11,7 +11,6 @@ support-files = [
"windowminmaxsize8.xhtml",
"windowminmaxsize9.xhtml",
"windowminmaxsize10.xhtml",
- "titledpanelwindow.xhtml",
]
["test_bug159346.xhtml"]
diff --git a/layout/xul/test/test_windowminmaxsize.xhtml b/layout/xul/test/test_windowminmaxsize.xhtml
index 187732dd3d..20f2109c80 100644
--- a/layout/xul/test/test_windowminmaxsize.xhtml
+++ b/layout/xul/test/test_windowminmaxsize.xhtml
@@ -125,59 +125,29 @@ function doPanelTest(panel)
function nextPopupTest(panel)
{
if (++gTestId >= popupTests.length) {
- // Next, check a panel that has a titlebar to ensure that it is accounted for
- // properly in the size.
- var titledPanelWindow = window.browsingContext.topChromeWindow.open("titledpanelwindow.xhtml", "_blank", "chrome,resizable=yes");
- SimpleTest.waitForFocus(titledPanelWindowOpened, titledPanelWindow);
+ SimpleTest.finish();
+ return;
}
- else {
- function setStyle(attr) {
- if (attr in popupTests[gTestId])
- panel.style[attr] = popupTests[gTestId][attr] + "px";
- else
- panel.style[attr] = "";
- }
- setStyle("minWidth");
- setStyle("minHeight");
- setStyle("maxWidth");
- setStyle("maxHeight");
-
- // Prevent event loop starvation as a result of popup events being
- // synchronous. See bug 1131576.
- SimpleTest.executeSoon(() => {
- // Non-chrome shells require focus to open a popup.
- SimpleTest.waitForFocus(() => { panel.openPopup() });
- });
+
+ function setStyle(attr) {
+ if (attr in popupTests[gTestId])
+ panel.style[attr] = popupTests[gTestId][attr] + "px";
+ else
+ panel.style[attr] = "";
}
-}
+ setStyle("minWidth");
+ setStyle("minHeight");
+ setStyle("maxWidth");
+ setStyle("maxHeight");
-function titledPanelWindowOpened(panelwindow)
-{
- info("titledPanelWindowOpened");
- var panel = panelwindow.document.documentElement.firstChild;
- panel.addEventListener("popupshown", () => doTitledPanelTest(panel));
- panel.addEventListener("popuphidden", () => done(panelwindow));
- // See above as for why.
+ // Prevent event loop starvation as a result of popup events being
+ // synchronous. See bug 1131576.
SimpleTest.executeSoon(() => {
- SimpleTest.waitForFocus(() => { panel.openPopup() }, panelwindow);
+ // Non-chrome shells require focus to open a popup.
+ SimpleTest.waitForFocus(() => { panel.openPopup() });
});
}
-function doTitledPanelTest(panel)
-{
- info("doTitledPanelTest");
- var rect = panel.getBoundingClientRect();
- is(rect.width, 120, "panel with titlebar width");
- is(rect.height, 140, "panel with titlebar height");
- panel.hidePopup();
-}
-
-function done(panelwindow)
-{
- panelwindow.close();
- SimpleTest.finish();
-}
-
]]>
</script>
diff --git a/layout/xul/test/titledpanelwindow.xhtml b/layout/xul/test/titledpanelwindow.xhtml
deleted file mode 100644
index 4289f8deab..0000000000
--- a/layout/xul/test/titledpanelwindow.xhtml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
-<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0;'>
- <panel noautohide='true' titlebar='normal' style="background: white; min-width: 120px; min-height: 140px"/>
- <label value='Test'/>
-</window>