mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
Bug 1519952, add screenX and screenY properties to XULElement in order to replace places that currently get the screen coordinates of an element via the box object, r=bz
This commit is contained in:
parent
a65713e112
commit
65399694b4
@ -60,6 +60,10 @@ interface XULElement : Element {
|
||||
[SetterThrows]
|
||||
attribute DOMString top;
|
||||
|
||||
// Return the screen coordinates of the element.
|
||||
readonly attribute long screenX;
|
||||
readonly attribute long screenY;
|
||||
|
||||
// Tooltip
|
||||
[SetterThrows]
|
||||
attribute DOMString tooltipText;
|
||||
|
@ -472,6 +472,16 @@ bool nsXULElement::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) {
|
||||
return shouldFocus;
|
||||
}
|
||||
|
||||
int32_t nsXULElement::ScreenX() {
|
||||
nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
|
||||
return frame ? frame->GetScreenRect().x: 0;
|
||||
}
|
||||
|
||||
int32_t nsXULElement::ScreenY() {
|
||||
nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
|
||||
return frame ? frame->GetScreenRect().y : 0;
|
||||
}
|
||||
|
||||
bool nsXULElement::HasMenu() {
|
||||
nsMenuFrame* menu = do_QueryFrame(GetPrimaryFrame());
|
||||
return menu != nullptr;
|
||||
|
@ -337,6 +337,9 @@ class nsXULElement : public nsStyledElement {
|
||||
bool aDumpAll) const override {}
|
||||
#endif
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT int32_t ScreenX();
|
||||
MOZ_CAN_RUN_SCRIPT int32_t ScreenY();
|
||||
|
||||
bool HasMenu();
|
||||
MOZ_CAN_RUN_SCRIPT void OpenMenu(bool aOpenFlag);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user