mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1222226 - Don't return eRestyleResult_StopWithStyleChange if the old style context is shared. r=dbaron (ad682c717e)
- Bug 1222745 - Restore eRestyleResult_StopWithStyleChange optimization for shared style contexts by comparing rule nodes for inherited style data changes. r=dbaron (766bb79aac)
- Bug 1032613 part 1: Promote FrameMaintainsOverflow to be a public nsIFrame method, & implement it using HasAllStateBits. r=dbaron (b3c44e7ba6)
- Bug 1032613 part 2: Make RestyleManager::AddSubtreeToOverflowTracker skip frames that don't maintain overflow areas. r=dbaron (7519ac2937)
- Bug 1165918 - Qt widget port does not compile anymore. r=rojkov (583700d86a)
- Bug 1224403 (part 12) - Remove WidgetToScreenOffsetUntyped(). r=kats. (742aa54a28)
- Bug 1224482 (part 1) - Tweak typed/untyped versions of Get{,Client,Screen}Bounds(). r=kats. (65e7bf71fa)
- Bug 1224482 (part 2) - Replace GetNaturalBoundsUntyped() with GetNaturalBounds(). r=kats. (21159528de)
- Bug 1224482 (part 3) - Replace GetClientOffsetUntyped() with GetClientOffset(). r=kats. (fa06021002)
- Bug 1224482 (part 4) - Make GetClientSize() return a LayoutDeviceIntSize. r=kats. (f10d7bce64)
- Bug 1224482 (part 5) - Avoid excessive mozilla:: prefixes in nsIWidget and its subclasses. r=kats. (1d05c2e783)
- Bug 1170061 - ClearOnShutdown for hwcomposer, r=sotaro (5acab07299)
- Bug 1194034 - Remove unused GonkDisplayJB::StopBootAnim() in GonkDisplayJB. r=mwu (50d2cb93d6)
- Bug 1221446 - Add virtual display support to GonkDisplayJB r=mwu (d1c64f5c62)
- Bug 1224482 (part 6) - Change nsScreenGonk::m{Virtual,Natural}Bounds to LayoutDevcieIntRect. r=kats. (8e44f87785)
- Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats. (76de754cae)
- Bug 1224790 - Use SetFakeModal instead of SetModal for non-modal window opened by modal window. r=smaug, mstange (051fe46311)
This commit is contained in:
+1
-1
@@ -4257,7 +4257,7 @@ then
|
||||
if test "$NS_PRINTING"; then
|
||||
PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
|
||||
[
|
||||
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
|
||||
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt5 printsupport development package])
|
||||
])
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
|
||||
|
||||
@@ -184,6 +184,14 @@ nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsMappedAttributes::MightMapInheritedStyleData()
|
||||
{
|
||||
// Just assume that we do, rather than adding checks to all of the different
|
||||
// kinds of attribute mapping functions we have.
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::List(FILE* out, int32_t aIndent) const
|
||||
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
|
||||
// nsIStyleRule
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
|
||||
@@ -168,6 +168,12 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
BodyRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
BodyRule::List(FILE* out, int32_t aIndent) const
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
|
||||
@@ -10,4 +10,6 @@ class QtHapticFeedback : public nsIHapticFeedback
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIHAPTICFEEDBACK
|
||||
protected:
|
||||
virtual ~QtHapticFeedback() {}
|
||||
};
|
||||
|
||||
@@ -17,10 +17,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=406375
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(1);
|
||||
}
|
||||
|
||||
/** Test for Bug 406375 **/
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ support-files =
|
||||
file_bug799299.xul
|
||||
file_bug800817.xul
|
||||
file_bug830858.xul
|
||||
file_bug1224790-1_modal.xul
|
||||
file_bug1224790-1_nonmodal.xul
|
||||
file_bug1224790-2_modal.xul
|
||||
file_bug1224790-2_nonmodal.xul
|
||||
file_subscript_bindings.js
|
||||
focus_frameset.html
|
||||
focus_window2.xul
|
||||
@@ -32,6 +36,10 @@ support-files =
|
||||
[test_bug800817.xul]
|
||||
[test_bug830396.xul]
|
||||
[test_bug830858.xul]
|
||||
[test_bug1224790-1.xul]
|
||||
skip-if = os != 'cocoa'
|
||||
[test_bug1224790-2.xul]
|
||||
skip-if = os != 'cocoa'
|
||||
[test_callback_wrapping.xul]
|
||||
[test_clonewrapper.xul]
|
||||
[test_cyclecollector.xul]
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||
-->
|
||||
<dialog title="Mozilla Bug 1224790"
|
||||
buttons="accept"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 1224790 **/
|
||||
|
||||
function runTests() {
|
||||
window.openDialog('file_bug1224790-1_nonmodal.xul', '', 'dialog=no');
|
||||
}
|
||||
|
||||
function nonModalClosed() {
|
||||
window.close();
|
||||
opener.wrappedJSObject.modalClosed();
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
]]>
|
||||
</script>
|
||||
</dialog>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||
-->
|
||||
<window title="Mozilla Bug 1224790"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 1224790 **/
|
||||
|
||||
function runTests() {
|
||||
window.close();
|
||||
opener.wrappedJSObject.nonModalClosed();
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||
-->
|
||||
<dialog title="Mozilla Bug 1224790"
|
||||
buttons="accept"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 1224790 **/
|
||||
|
||||
var nonModal = null;
|
||||
|
||||
function runTests() {
|
||||
nonModal = window.openDialog('file_bug1224790-2_nonmodal.xul', '', 'dialog=no');
|
||||
}
|
||||
|
||||
function nonModalOpened() {
|
||||
window.close();
|
||||
nonModal.wrappedJSObject.modalClosed(opener);
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
]]>
|
||||
</script>
|
||||
</dialog>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||
-->
|
||||
<window title="Mozilla Bug 1224790"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 1224790 **/
|
||||
|
||||
function runTests() {
|
||||
opener.wrappedJSObject.nonModalOpened()
|
||||
}
|
||||
|
||||
function modalClosed(grandparent) {
|
||||
// Request cycle collection to trigger destructor for parent modal window,
|
||||
// that mutates mAncestorLink of this window.
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
var windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
Services.obs.notifyObservers(null, "child-cc-request", null);
|
||||
windowUtils.cycleCollect();
|
||||
|
||||
// Wait for a while.
|
||||
setTimeout(function() {
|
||||
window.close();
|
||||
grandparent.wrappedJSObject.nonModalClosed();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||
-->
|
||||
<window title="Mozilla Bug 1224790"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 1224790 **/
|
||||
/*
|
||||
* 1. Opens modal dialog
|
||||
* 2. Open non-modal window from modal dialog
|
||||
* 3. Close non-modal window
|
||||
* 4. Close modal dialog
|
||||
* 5. Click button to ensure mouse event is working
|
||||
*/
|
||||
|
||||
function startTest() {
|
||||
window.openDialog('file_bug1224790-1_modal.xul', '', 'modal');
|
||||
}
|
||||
|
||||
function modalClosed() {
|
||||
SimpleTest.waitForFocus(gotFocus);
|
||||
}
|
||||
|
||||
function gotFocus() {
|
||||
var button = document.getElementById('button');
|
||||
synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
|
||||
// The bug is not reproducible with synthesizeMouseAtCenter.
|
||||
// Need to emulate native mouse event.
|
||||
synthesizeNativeOSXClick(button.boxObject.screenX + button.boxObject.width / 2,
|
||||
button.boxObject.screenY + button.boxObject.height / 2);
|
||||
}
|
||||
|
||||
function onClick() {
|
||||
ok(true, "Click event should be fired");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(startTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1224790"
|
||||
target="_blank">Mozilla Bug 1224790</a>
|
||||
</body>
|
||||
<button id="button" label="button" oncommand="onClick()" />
|
||||
</window>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||
-->
|
||||
<window title="Mozilla Bug 1224790"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 1224790 **/
|
||||
/*
|
||||
* 1. Opens modal dialog
|
||||
* 2. Open non-modal window from modal dialog
|
||||
* 3. Close modal dialog
|
||||
* 4. Wait for a while for destructor for modal dialog
|
||||
* 5. Close non-modal window
|
||||
* 6. Click button to ensure mouse event is working
|
||||
*/
|
||||
|
||||
function startTest() {
|
||||
window.openDialog('file_bug1224790-2_modal.xul', '', 'modal');
|
||||
}
|
||||
|
||||
function nonModalClosed() {
|
||||
SimpleTest.waitForFocus(gotFocus);
|
||||
}
|
||||
|
||||
function gotFocus() {
|
||||
var button = document.getElementById('button');
|
||||
synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
|
||||
// The bug is not reproducible with synthesizeMouseAtCenter.
|
||||
// Need to emulate native mouse event.
|
||||
synthesizeNativeOSXClick(button.boxObject.screenX + button.boxObject.width / 2,
|
||||
button.boxObject.screenY + button.boxObject.height / 2);
|
||||
}
|
||||
|
||||
function onClick() {
|
||||
ok(true, "Click event should be fired");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(startTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1224790"
|
||||
target="_blank">Mozilla Bug 1224790</a>
|
||||
</body>
|
||||
<button id="button" label="button" oncommand="onClick()" />
|
||||
</window>
|
||||
@@ -1055,7 +1055,7 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow* aParent,
|
||||
nsCOMPtr<nsIWidget> parentWidget;
|
||||
parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
|
||||
if (parentWidget) {
|
||||
parentWidget->SetModal(true);
|
||||
parentWidget->SetFakeModal(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -506,7 +506,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
gfx::Rect *aClipRectOut /* = nullptr */,
|
||||
gfx::Rect *aRenderBoundsOut /* = nullptr */)
|
||||
{
|
||||
mWidgetSize = mWidget->GetClientSize();
|
||||
mWidgetSize = mWidget->GetClientSize().ToUnknownSize();
|
||||
IntRect intRect = gfx::IntRect(IntPoint(), mWidgetSize);
|
||||
Rect rect = Rect(0, 0, intRect.width, intRect.height);
|
||||
|
||||
|
||||
@@ -203,9 +203,10 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
hal::GetCurrentScreenConfiguration(¤tConfig);
|
||||
orientation = currentConfig.orientation();
|
||||
}
|
||||
IntRect targetBounds = mWidget->GetNaturalBoundsUntyped();
|
||||
LayoutDeviceIntRect targetBounds = mWidget->GetNaturalBounds();
|
||||
targetBounds.x = targetBounds.y = 0;
|
||||
mForwarder->BeginTransaction(targetBounds, mTargetRotation, orientation);
|
||||
mForwarder->BeginTransaction(targetBounds.ToUnknownRect(), mTargetRotation,
|
||||
orientation);
|
||||
|
||||
// If we're drawing on behalf of a context with async pan/zoom
|
||||
// enabled, then the entire buffer of painted layers might be
|
||||
|
||||
@@ -33,12 +33,12 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD GetClientBoundsUntyped(IntRect &aRect) override {
|
||||
aRect = IntRect(0, 0, gCompWidth, gCompHeight);
|
||||
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override {
|
||||
aRect = LayoutDeviceIntRect(0, 0, gCompWidth, gCompHeight);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetBoundsUntyped(IntRect &aRect) override {
|
||||
return GetClientBoundsUntyped(aRect);
|
||||
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override {
|
||||
return GetClientBounds(aRect);
|
||||
}
|
||||
|
||||
void* GetNativeData(uint32_t aDataType) override {
|
||||
|
||||
@@ -5146,7 +5146,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||
nsIWidget* widget = aContainerFrame->GetNearestWidget();
|
||||
nsSize displaySize;
|
||||
if (widget) {
|
||||
IntSize widgetSize = widget->GetClientSize();
|
||||
LayoutDeviceIntSize widgetSize = widget->GetClientSize();
|
||||
int32_t p2a = presContext->AppUnitsPerDevPixel();
|
||||
displaySize.width = NSIntPixelsToAppUnits(widgetSize.width, p2a);
|
||||
displaySize.height = NSIntPixelsToAppUnits(widgetSize.height, p2a);
|
||||
|
||||
@@ -630,9 +630,10 @@ RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint)
|
||||
void
|
||||
RestyleManager::AddSubtreeToOverflowTracker(nsIFrame* aFrame)
|
||||
{
|
||||
mOverflowChangedTracker.AddFrame(
|
||||
aFrame,
|
||||
OverflowChangedTracker::CHILDREN_CHANGED);
|
||||
if (aFrame->FrameMaintainsOverflow()) {
|
||||
mOverflowChangedTracker.AddFrame(aFrame,
|
||||
OverflowChangedTracker::CHILDREN_CHANGED);
|
||||
}
|
||||
nsIFrame::ChildListIterator lists(aFrame);
|
||||
for (; !lists.IsDone(); lists.Next()) {
|
||||
for (nsIFrame* child : lists.CurrentList()) {
|
||||
@@ -818,8 +819,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||
} else {
|
||||
NS_ASSERTION(frame, "This shouldn't happen");
|
||||
|
||||
if ((frame->GetStateBits() & NS_FRAME_SVG_LAYOUT) &&
|
||||
(frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
|
||||
if (!frame->FrameMaintainsOverflow()) {
|
||||
// frame does not maintain overflow rects, so avoid calling
|
||||
// FinishAndStoreOverflow on it:
|
||||
hint = NS_SubtractHint(hint,
|
||||
@@ -3694,6 +3694,89 @@ ElementRestyler::CanReparentStyleContext(nsRestyleHint aRestyleHint)
|
||||
!mPresContext->StyleSet()->IsInRuleTreeReconstruct();
|
||||
}
|
||||
|
||||
// Returns true iff any rule node that is an ancestor-or-self of the
|
||||
// two specified rule nodes, but which is not an ancestor of both,
|
||||
// has any inherited style data. If false is returned, then we know
|
||||
// that a change from one rule node to the other must not result in
|
||||
// any change in inherited style data.
|
||||
static bool
|
||||
CommonInheritedStyleData(nsRuleNode* aRuleNode1, nsRuleNode* aRuleNode2)
|
||||
{
|
||||
if (aRuleNode1 == aRuleNode2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsRuleNode* n1 = aRuleNode1->GetParent();
|
||||
nsRuleNode* n2 = aRuleNode2->GetParent();
|
||||
|
||||
if (n1 == n2) {
|
||||
// aRuleNode1 and aRuleNode2 sharing a parent is a common case, e.g.
|
||||
// when modifying a style="" attribute. (We must null check GetRule()'s
|
||||
// result since although we know the two parents are the same, it might
|
||||
// be null, as in the case of the two rule nodes being roots of two
|
||||
// different rule trees.)
|
||||
if (aRuleNode1->GetRule() &&
|
||||
aRuleNode1->GetRule()->MightMapInheritedStyleData()) {
|
||||
return false;
|
||||
}
|
||||
if (aRuleNode2->GetRule() &&
|
||||
aRuleNode2->GetRule()->MightMapInheritedStyleData()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Compute the depths of aRuleNode1 and aRuleNode2.
|
||||
int d1 = 0, d2 = 0;
|
||||
while (n1) {
|
||||
++d1;
|
||||
n1 = n1->GetParent();
|
||||
}
|
||||
while (n2) {
|
||||
++d2;
|
||||
n2 = n2->GetParent();
|
||||
}
|
||||
|
||||
// Make aRuleNode1 be the deeper node.
|
||||
if (d2 > d1) {
|
||||
std::swap(d1, d2);
|
||||
std::swap(aRuleNode1, aRuleNode2);
|
||||
}
|
||||
|
||||
// Check all of the rule nodes in the deeper branch until we reach
|
||||
// the same depth as the shallower branch.
|
||||
n1 = aRuleNode1;
|
||||
n2 = aRuleNode2;
|
||||
while (d1 > d2) {
|
||||
nsIStyleRule* rule = n1->GetRule();
|
||||
MOZ_ASSERT(rule, "non-root rule node should have a rule");
|
||||
if (rule->MightMapInheritedStyleData()) {
|
||||
return false;
|
||||
}
|
||||
n1 = n1->GetParent();
|
||||
--d1;
|
||||
}
|
||||
|
||||
// Check both branches simultaneously until we reach a common ancestor.
|
||||
while (n1 != n2) {
|
||||
MOZ_ASSERT(n1);
|
||||
MOZ_ASSERT(n2);
|
||||
// As above, we must null check GetRule()'s result since we won't find
|
||||
// a common ancestor if the two rule nodes come from different rule trees,
|
||||
// and thus we might reach the root (which has a null rule).
|
||||
if (n1->GetRule() && n1->GetRule()->MightMapInheritedStyleData()) {
|
||||
return false;
|
||||
}
|
||||
if (n2->GetRule() && n2->GetRule()->MightMapInheritedStyleData()) {
|
||||
return false;
|
||||
}
|
||||
n1 = n1->GetParent();
|
||||
n2 = n2->GetParent();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ElementRestyler::RestyleResult
|
||||
ElementRestyler::RestyleSelf(nsIFrame* aSelf,
|
||||
nsRestyleHint aRestyleHint,
|
||||
@@ -3956,6 +4039,25 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
|
||||
// for the other frames sharing the style context.
|
||||
LOG_RESTYLE_CONTINUE("the old style context is shared");
|
||||
result = eRestyleResult_Continue;
|
||||
|
||||
// It is not safe to return eRestyleResult_StopWithStyleChange
|
||||
// when oldContext is shared and newContext has different
|
||||
// inherited style data, regardless of whether the oldContext has
|
||||
// that inherited style data cached. We can't simply rely on the
|
||||
// samePointerStructs check later on, as the descendent style
|
||||
// contexts just might not have had their inherited style data
|
||||
// requested yet (which is possible for example if we flush style
|
||||
// between resolving an initial style context for a frame and
|
||||
// building its display list items). Therefore we must compare
|
||||
// the rule nodes of oldContext and newContext to see if the
|
||||
// restyle results in new inherited style data. If not, then
|
||||
// we can continue assuming that eRestyleResult_StopWithStyleChange
|
||||
// is safe. Without this check, we could end up with style contexts
|
||||
// shared between elements which should have different styles.
|
||||
if (!CommonInheritedStyleData(oldContext->RuleNode(),
|
||||
newContext->RuleNode())) {
|
||||
canStopWithStyleChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Look at some details of the new style context to see if it would
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" onload="tweak()">
|
||||
<pattern>
|
||||
<rect id="r" />
|
||||
</pattern>
|
||||
<script>
|
||||
function tweak() {
|
||||
document.getElementById("r").style.textDecoration = "underline";
|
||||
}
|
||||
</script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 251 B |
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script>
|
||||
function tweak() {
|
||||
document.getElementById("c").style.textShadow = "3px 3px gray";
|
||||
}
|
||||
</script>
|
||||
<body onload="tweak()">
|
||||
<div id="c">hello
|
||||
<svg height="0">
|
||||
<clipPath>
|
||||
<path d=""/>
|
||||
</clipPath>
|
||||
</svg>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -571,6 +571,8 @@ asserts(0-300) load 1015844.html # bug 574889
|
||||
load outline-on-frameset.xhtml
|
||||
load summary-position-out-of-flow.html
|
||||
pref(font.size.inflation.minTwips,200) load 1032450.html
|
||||
load 1032613-1.svg
|
||||
load 1032613-2.html
|
||||
load 1037903.html
|
||||
load 1039454-1.html
|
||||
load 1042489.html
|
||||
|
||||
@@ -5622,18 +5622,10 @@ nsIFrame::GetPreEffectsVisualOverflowRect() const
|
||||
return r ? *r : GetVisualOverflowRectRelativeToSelf();
|
||||
}
|
||||
|
||||
inline static bool
|
||||
FrameMaintainsOverflow(nsIFrame* aFrame)
|
||||
{
|
||||
return (aFrame->GetStateBits() &
|
||||
(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY)) !=
|
||||
(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsFrame::UpdateOverflow()
|
||||
{
|
||||
MOZ_ASSERT(FrameMaintainsOverflow(this),
|
||||
MOZ_ASSERT(FrameMaintainsOverflow(),
|
||||
"Non-display SVG do not maintain visual overflow rects");
|
||||
|
||||
nsRect rect(nsPoint(0, 0), GetSize());
|
||||
@@ -7652,7 +7644,7 @@ bool
|
||||
nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
nsSize aNewSize, nsSize* aOldSize)
|
||||
{
|
||||
NS_ASSERTION(FrameMaintainsOverflow(this),
|
||||
NS_ASSERTION(FrameMaintainsOverflow(),
|
||||
"Don't call - overflow rects not maintained on these SVG frames");
|
||||
|
||||
nsRect bounds(nsPoint(0, 0), aNewSize);
|
||||
@@ -7810,7 +7802,7 @@ nsIFrame::RecomputePerspectiveChildrenOverflow(const nsIFrame* aStartFrame, cons
|
||||
nsFrameList::Enumerator childFrames(lists.CurrentList());
|
||||
for (; !childFrames.AtEnd(); childFrames.Next()) {
|
||||
nsIFrame* child = childFrames.get();
|
||||
if (!FrameMaintainsOverflow(child)) {
|
||||
if (!child->FrameMaintainsOverflow()) {
|
||||
continue; // frame does not maintain overflow rects
|
||||
}
|
||||
if (child->HasPerspective()) {
|
||||
@@ -7858,7 +7850,7 @@ RecomputePreserve3DChildrenOverflow(nsIFrame* aFrame, const nsRect* aBounds)
|
||||
nsFrameList::Enumerator childFrames(lists.CurrentList());
|
||||
for (; !childFrames.AtEnd(); childFrames.Next()) {
|
||||
nsIFrame* child = childFrames.get();
|
||||
if (!FrameMaintainsOverflow(child)) {
|
||||
if (!child->FrameMaintainsOverflow()) {
|
||||
continue; // frame does not maintain overflow rects
|
||||
}
|
||||
if (child->Extend3DContext()) {
|
||||
|
||||
@@ -3061,6 +3061,15 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
|
||||
return GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this frame keeps track of overflow areas. (Frames for
|
||||
* non-display SVG elements -- e.g. <clipPath> -- do not maintain overflow
|
||||
* areas, because they're never painted.)
|
||||
*/
|
||||
bool FrameMaintainsOverflow() const {
|
||||
return !HasAllStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content node within the anonymous content that this frame
|
||||
* generated and which corresponds to the specified pseudo-element type,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
.red { color: red; }
|
||||
</style>
|
||||
<div>
|
||||
<span id="s1">test</span><br />
|
||||
<span id="s2" class=red>test</span><br />
|
||||
<span id="s3" class=red>test</span><br />
|
||||
<span id="s4">test</span><br />
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
.red { color: red; }
|
||||
</style>
|
||||
<script>
|
||||
document.onreadystatechange = function() {
|
||||
if (document.readyState == "complete") {
|
||||
var arr = ["s2","s3"];
|
||||
arr.forEach(function(n) {
|
||||
document.getElementById(n).className = "red";
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<div>
|
||||
<span id="s1">test</span><br />
|
||||
<span id="s2">test</span><br />
|
||||
<span id="s3">test</span><br />
|
||||
<span id="s4">test</span><br />
|
||||
</div>
|
||||
@@ -1935,3 +1935,4 @@ fuzzy(1,74) fuzzy-if(gtkWidget,6,79) == 1174332-1.html 1174332-1-ref.html
|
||||
== 1190635-1.html 1190635-1-ref.html
|
||||
!= 1207326-1.html about:blank
|
||||
== 1209603-1.html 1209603-1-ref.html
|
||||
== 1222226-1.html 1222226-1-ref.html
|
||||
|
||||
@@ -397,6 +397,12 @@ AnimValuesStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
AnimValuesStyleRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return mStyleBits & NS_STYLE_INHERITED_STRUCT_MASK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
AnimValuesStyleRule::List(FILE* out, int32_t aIndent) const
|
||||
|
||||
@@ -158,11 +158,15 @@ protected:
|
||||
class AnimValuesStyleRule final : public nsIStyleRule
|
||||
{
|
||||
public:
|
||||
AnimValuesStyleRule()
|
||||
: mStyleBits(0) {}
|
||||
|
||||
// nsISupports implementation
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRule implementation
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -171,6 +175,8 @@ public:
|
||||
{
|
||||
PropertyValuePair v = { aProperty, aStartValue };
|
||||
mPropertyValuePairs.AppendElement(v);
|
||||
mStyleBits |=
|
||||
nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
|
||||
}
|
||||
|
||||
// Caller must fill in returned value.
|
||||
@@ -178,6 +184,8 @@ public:
|
||||
{
|
||||
PropertyValuePair *p = mPropertyValuePairs.AppendElement();
|
||||
p->mProperty = aProperty;
|
||||
mStyleBits |=
|
||||
nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
|
||||
return &p->mValue;
|
||||
}
|
||||
|
||||
@@ -198,6 +206,7 @@ private:
|
||||
~AnimValuesStyleRule() {}
|
||||
|
||||
InfallibleTArray<PropertyValuePair> mPropertyValuePairs;
|
||||
uint32_t mStyleBits;
|
||||
};
|
||||
|
||||
typedef InfallibleTArray<RefPtr<dom::Animation>> AnimationPtrArray;
|
||||
|
||||
@@ -29,6 +29,12 @@ ImportantStyleData::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
Declaration()->MapImportantRuleInfoInto(aRuleData);
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
ImportantStyleData::MightMapInheritedStyleData()
|
||||
{
|
||||
return Declaration()->MapsImportantInheritedStyleData();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
ImportantStyleData::List(FILE* out, int32_t aIndent) const
|
||||
@@ -88,13 +94,35 @@ NS_IMPL_RELEASE(Declaration)
|
||||
/* virtual */ void
|
||||
Declaration::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
MOZ_ASSERT(mData, "called while expanded");
|
||||
MOZ_ASSERT(mData, "must call only while compressed");
|
||||
mData->MapRuleInfoInto(aRuleData);
|
||||
if (mVariables) {
|
||||
mVariables->MapRuleInfoInto(aRuleData);
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
Declaration::MightMapInheritedStyleData()
|
||||
{
|
||||
MOZ_ASSERT(mData, "must call only while compressed");
|
||||
if (mVariables && mVariables->Count() != 0) {
|
||||
return true;
|
||||
}
|
||||
return mData->HasInheritedStyleData();
|
||||
}
|
||||
|
||||
bool
|
||||
Declaration::MapsImportantInheritedStyleData() const
|
||||
{
|
||||
MOZ_ASSERT(mData, "must call only while compressed");
|
||||
MOZ_ASSERT(HasImportantData(), "must only be called for Declarations with "
|
||||
"important data");
|
||||
if (mImportantVariables && mImportantVariables->Count() != 0) {
|
||||
return true;
|
||||
}
|
||||
return mImportantData ? mImportantData->HasInheritedStyleData() : false;
|
||||
}
|
||||
|
||||
void
|
||||
Declaration::ValueAppended(nsCSSProperty aProperty)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -101,6 +102,7 @@ public:
|
||||
|
||||
// nsIStyleRule implementation
|
||||
virtual void MapRuleInfoInto(nsRuleData *aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -232,6 +234,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool MapsImportantInheritedStyleData() const;
|
||||
|
||||
/**
|
||||
* Attempt to replace the value for |aProperty| stored in this
|
||||
* declaration with the matching value from |aFromBlock|.
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSPropertySet.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "imgRequestProxy.h"
|
||||
|
||||
struct nsRuleData;
|
||||
@@ -92,6 +93,11 @@ public:
|
||||
bool HasDefaultBorderImageOutset() const;
|
||||
bool HasDefaultBorderImageRepeat() const;
|
||||
|
||||
bool HasInheritedStyleData() const
|
||||
{
|
||||
return mStyleBits & NS_STYLE_INHERITED_STRUCT_MASK;
|
||||
}
|
||||
|
||||
private:
|
||||
void* operator new(size_t aBaseSize, uint32_t aNumProps) {
|
||||
MOZ_ASSERT(aBaseSize == sizeof(nsCSSCompressedDataBlock),
|
||||
|
||||
@@ -51,6 +51,12 @@ nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsHTMLStyleSheet::HTMLColorRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, int32_t aIndent) const
|
||||
@@ -90,6 +96,12 @@ nsHTMLStyleSheet::TableTHRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsHTMLStyleSheet::TableTHRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsHTMLStyleSheet::TableQuirkColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
@@ -103,6 +115,12 @@ nsHTMLStyleSheet::TableQuirkColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsHTMLStyleSheet::TableQuirkColorRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsHTMLStyleSheet::LangRule, nsIStyleRule)
|
||||
|
||||
@@ -117,6 +135,12 @@ nsHTMLStyleSheet::LangRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsHTMLStyleSheet::LangRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsHTMLStyleSheet::LangRule::List(FILE* out, int32_t aIndent) const
|
||||
|
||||
@@ -84,6 +84,7 @@ private:
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -106,6 +107,7 @@ private:
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override = 0;
|
||||
virtual bool MightMapInheritedStyleData() override = 0;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -119,6 +121,7 @@ private:
|
||||
TableTHRule() {}
|
||||
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
};
|
||||
|
||||
// Rule to handle quirk table colors
|
||||
@@ -127,6 +130,7 @@ private:
|
||||
TableQuirkColorRule() {}
|
||||
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
};
|
||||
|
||||
public: // for mLangRuleTable structures only
|
||||
@@ -145,6 +149,7 @@ public: // for mLangRuleTable structures only
|
||||
|
||||
// nsIStyleRule interface
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
|
||||
@@ -71,6 +71,12 @@ public:
|
||||
*/
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData)=0;
|
||||
|
||||
/**
|
||||
* Returns whether this style rule has any style data for inherited
|
||||
* properties.
|
||||
*/
|
||||
virtual bool MightMapInheritedStyleData() = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0;
|
||||
#endif
|
||||
|
||||
@@ -54,6 +54,12 @@ nsEmptyStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsEmptyStyleRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsEmptyStyleRule::List(FILE* out, int32_t aIndent) const
|
||||
@@ -107,6 +113,12 @@ nsInitialStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsInitialStyleRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsInitialStyleRule::List(FILE* out, int32_t aIndent) const
|
||||
@@ -132,6 +144,12 @@ nsDisableTextZoomStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
value->SetNoneValue();
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsDisableTextZoomStyleRule::MightMapInheritedStyleData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* virtual */ void
|
||||
nsDisableTextZoomStyleRule::List(FILE* out, int32_t aIndent) const
|
||||
|
||||
@@ -50,6 +50,7 @@ private:
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -63,6 +64,7 @@ private:
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
@@ -76,6 +78,7 @@ private:
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
||||
virtual bool MightMapInheritedStyleData() override;
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
||||
#endif
|
||||
|
||||
@@ -1469,7 +1469,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove, bool aS
|
||||
// to save time since they will never have a titlebar.
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
if (mPopupType == ePopupTypePanel && widget) {
|
||||
mLastClientOffset = widget->GetClientOffsetUntyped();
|
||||
mLastClientOffset = widget->GetClientOffset();
|
||||
viewPoint.x += presContext->DevPixelsToAppUnits(mLastClientOffset.x);
|
||||
viewPoint.y += presContext->DevPixelsToAppUnits(mLastClientOffset.y);
|
||||
}
|
||||
@@ -2137,7 +2137,7 @@ nsMenuPopupFrame::MoveTo(const CSSIntPoint& aPos, bool aUpdateAttrs)
|
||||
{
|
||||
nsIWidget* widget = GetWidget();
|
||||
if ((mScreenRect.x == aPos.x && mScreenRect.y == aPos.y) &&
|
||||
(!widget || widget->GetClientOffsetUntyped() == mLastClientOffset)) {
|
||||
(!widget || widget->GetClientOffset() == mLastClientOffset)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +396,10 @@ public:
|
||||
// or (-1, -1, 0, 0) if anchored.
|
||||
nsIntRect GetScreenAnchorRect() const { return mScreenRect; }
|
||||
|
||||
nsIntPoint GetLastClientOffset() const { return mLastClientOffset; }
|
||||
mozilla::LayoutDeviceIntPoint GetLastClientOffset() const
|
||||
{
|
||||
return mLastClientOffset;
|
||||
}
|
||||
|
||||
// Return the alignment of the popup
|
||||
int8_t GetAlignmentPosition() const;
|
||||
@@ -533,7 +536,7 @@ protected:
|
||||
// The value of the client offset of our widget the last time we positioned
|
||||
// ourselves. We store this so that we can detect when it changes but the
|
||||
// position of our widget didn't change.
|
||||
nsIntPoint mLastClientOffset;
|
||||
mozilla::LayoutDeviceIntPoint mLastClientOffset;
|
||||
|
||||
nsPopupType mPopupType; // type of popup
|
||||
nsPopupState mPopupState; // open state of the popup
|
||||
|
||||
@@ -473,7 +473,8 @@ nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt)
|
||||
nsIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
||||
nsIWidget* widget = menuPopupFrame->GetWidget();
|
||||
if (curDevSize.x == aPnt.x && curDevSize.y == aPnt.y &&
|
||||
(!widget || widget->GetClientOffsetUntyped() == menuPopupFrame->GetLastClientOffset())) {
|
||||
(!widget || widget->GetClientOffset() ==
|
||||
menuPopupFrame->GetLastClientOffset())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* synthesizeNativeKey
|
||||
* synthesizeMouseExpectEvent
|
||||
* synthesizeKeyExpectEvent
|
||||
* synthesizeNativeClick
|
||||
*
|
||||
* When adding methods to this file, please add a performance test for it.
|
||||
*/
|
||||
@@ -35,6 +36,11 @@ window.__defineGetter__('_EU_Cc', function() {
|
||||
return c.value && !c.writable ? Components.classes : SpecialPowers.Cc;
|
||||
});
|
||||
|
||||
window.__defineGetter__('_EU_Cu', function() {
|
||||
var c = Object.getOwnPropertyDescriptor(window, 'Components');
|
||||
return c.value && !c.writable ? Components.utils : SpecialPowers.Cu;
|
||||
});
|
||||
|
||||
/**
|
||||
* Send a mouse event to the node aTarget (aTarget can be an id, or an
|
||||
* actual node) . The "event" passed in to aEvent is just a JavaScript
|
||||
@@ -1438,3 +1444,101 @@ function synthesizeSelectionSet(aOffset, aLength, aReverse, aWindow)
|
||||
var flags = aReverse ? SELECTION_SET_FLAG_REVERSE : 0;
|
||||
return utils.sendSelectionSetEvent(aOffset, aLength, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Synthesize a native mouse click event at a particular point in screen.
|
||||
* This function should be used only for testing native event loop.
|
||||
* Use synthesizeMouse instead for most case.
|
||||
*
|
||||
* This works only on OS X. Throws an error on other OS. Also throws an error
|
||||
* when the library or any of function are not found, or something goes wrong
|
||||
* in native functions.
|
||||
*/
|
||||
function synthesizeNativeOSXClick(x, y)
|
||||
{
|
||||
var { ctypes } = _EU_Cu.import("resource://gre/modules/ctypes.jsm", {});
|
||||
|
||||
// Library
|
||||
var CoreFoundation = ctypes.open("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");
|
||||
var CoreGraphics = ctypes.open("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics");
|
||||
|
||||
// Contants
|
||||
var kCGEventLeftMouseDown = 1;
|
||||
var kCGEventLeftMouseUp = 2;
|
||||
var kCGEventSourceStateHIDSystemState = 1;
|
||||
var kCGHIDEventTap = 0;
|
||||
var kCGMouseButtonLeft = 0;
|
||||
var kCGMouseEventClickState = 1;
|
||||
|
||||
// Types
|
||||
var CGEventField = ctypes.uint32_t;
|
||||
var CGEventRef = ctypes.voidptr_t;
|
||||
var CGEventSourceRef = ctypes.voidptr_t;
|
||||
var CGEventSourceStateID = ctypes.uint32_t;
|
||||
var CGEventTapLocation = ctypes.uint32_t;
|
||||
var CGEventType = ctypes.uint32_t;
|
||||
var CGFloat = ctypes.voidptr_t.size == 4 ? ctypes.float : ctypes.double;
|
||||
var CGMouseButton = ctypes.uint32_t;
|
||||
|
||||
var CGPoint = new ctypes.StructType(
|
||||
"CGPoint",
|
||||
[ { "x" : CGFloat },
|
||||
{ "y" : CGFloat } ]);
|
||||
|
||||
// Functions
|
||||
var CGEventSourceCreate = CoreGraphics.declare(
|
||||
"CGEventSourceCreate",
|
||||
ctypes.default_abi,
|
||||
CGEventSourceRef, CGEventSourceStateID);
|
||||
var CGEventCreateMouseEvent = CoreGraphics.declare(
|
||||
"CGEventCreateMouseEvent",
|
||||
ctypes.default_abi,
|
||||
CGEventRef,
|
||||
CGEventSourceRef, CGEventType, CGPoint, CGMouseButton);
|
||||
var CGEventSetIntegerValueField = CoreGraphics.declare(
|
||||
"CGEventSetIntegerValueField",
|
||||
ctypes.default_abi,
|
||||
ctypes.void_t,
|
||||
CGEventRef, CGEventField, ctypes.int64_t);
|
||||
var CGEventPost = CoreGraphics.declare(
|
||||
"CGEventPost",
|
||||
ctypes.default_abi,
|
||||
ctypes.void_t,
|
||||
CGEventTapLocation, CGEventRef);
|
||||
var CFRelease = CoreFoundation.declare(
|
||||
"CFRelease",
|
||||
ctypes.default_abi,
|
||||
ctypes.void_t,
|
||||
CGEventRef);
|
||||
|
||||
var source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||
if (!source) {
|
||||
throw new Error("CGEventSourceCreate returns null");
|
||||
}
|
||||
|
||||
var loc = new CGPoint({ x: x, y: y });
|
||||
var event = CGEventCreateMouseEvent(source, kCGEventLeftMouseDown, loc,
|
||||
kCGMouseButtonLeft);
|
||||
if (!event) {
|
||||
throw new Error("CGEventCreateMouseEvent returns null");
|
||||
}
|
||||
CGEventSetIntegerValueField(event, kCGMouseEventClickState,
|
||||
new ctypes.Int64(1));
|
||||
CGEventPost(kCGHIDEventTap, event);
|
||||
CFRelease(event);
|
||||
|
||||
event = CGEventCreateMouseEvent(source, kCGEventLeftMouseUp, loc,
|
||||
kCGMouseButtonLeft);
|
||||
if (!event) {
|
||||
throw new Error("CGEventCreateMouseEvent returns null");
|
||||
}
|
||||
CGEventSetIntegerValueField(event, kCGMouseEventClickState,
|
||||
new ctypes.Int64(1));
|
||||
CGEventPost(kCGHIDEventTap, event);
|
||||
CFRelease(event);
|
||||
|
||||
CFRelease(source);
|
||||
|
||||
CoreFoundation.close();
|
||||
CoreGraphics.close();
|
||||
}
|
||||
|
||||
@@ -1117,9 +1117,9 @@ PuppetWidget::GetWindowPosition()
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
PuppetWidget::GetScreenBoundsUntyped(nsIntRect &aRect) {
|
||||
aRect.MoveTo(WidgetToScreenOffsetUntyped());
|
||||
aRect.SizeTo(mBounds.Size());
|
||||
PuppetWidget::GetScreenBounds(LayoutDeviceIntRect& aRect) {
|
||||
aRect.MoveTo(WidgetToScreenOffset());
|
||||
aRect.SizeTo(LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,11 +129,11 @@ public:
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle) override
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override
|
||||
{ return LayoutDeviceIntPoint::FromUnknownPoint(GetWindowPosition() + GetChromeDimensions()); }
|
||||
|
||||
void InitEvent(WidgetGUIEvent& aEvent,
|
||||
mozilla::LayoutDeviceIntPoint* aPoint = nullptr);
|
||||
LayoutDeviceIntPoint* aPoint = nullptr);
|
||||
|
||||
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
|
||||
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) override;
|
||||
@@ -212,7 +212,7 @@ public:
|
||||
// Get the screen position of the application window.
|
||||
nsIntPoint GetWindowPosition();
|
||||
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
|
||||
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
||||
int32_t aPanelX, int32_t aPanelY,
|
||||
@@ -226,13 +226,13 @@ public:
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
@@ -275,9 +275,9 @@ private:
|
||||
|
||||
bool CacheEditorRect();
|
||||
bool CacheCompositionRects(uint32_t& aStartOffset,
|
||||
nsTArray<mozilla::LayoutDeviceIntRect>& aRectArray,
|
||||
nsTArray<LayoutDeviceIntRect>& aRectArray,
|
||||
uint32_t& aTargetCauseOffset);
|
||||
bool GetCaretRect(mozilla::LayoutDeviceIntRect& aCaretRect, uint32_t aCaretOffset);
|
||||
bool GetCaretRect(LayoutDeviceIntRect& aCaretRect, uint32_t aCaretOffset);
|
||||
uint32_t GetCaretOffset();
|
||||
|
||||
nsIWidgetListener* GetCurrentWidgetListener();
|
||||
|
||||
@@ -375,9 +375,9 @@ public:
|
||||
NS_IMETHOD Enable(bool aState) override;
|
||||
virtual bool IsEnabled() const override;
|
||||
NS_IMETHOD SetFocus(bool aRaise) override;
|
||||
NS_IMETHOD GetBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
|
||||
// Returns the "backing scale factor" of the view's window, which is the
|
||||
// ratio of pixels in the window's backing store to Cocoa points. Prior to
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
|
||||
virtual void* GetNativeData(uint32_t aDataType) override;
|
||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect) override;
|
||||
|
||||
static bool ConvertStatus(nsEventStatus aStatus)
|
||||
@@ -453,15 +453,15 @@ public:
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0, aObserver); }
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
@@ -548,7 +548,7 @@ public:
|
||||
|
||||
bool IsPluginFocused() { return mPluginFocused; }
|
||||
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
|
||||
void DispatchAPZWheelInputEvent(mozilla::InputData& aEvent, bool aCanTriggerSwipe);
|
||||
|
||||
|
||||
+14
-12
@@ -906,31 +906,33 @@ NS_IMETHODIMP nsChildView::SetCursor(imgIContainer* aCursor,
|
||||
#pragma mark -
|
||||
|
||||
// Get this component dimension
|
||||
NS_IMETHODIMP nsChildView::GetBoundsUntyped(nsIntRect &aRect)
|
||||
NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
nsIntRect tmp;
|
||||
if (!mView) {
|
||||
aRect = mBounds;
|
||||
tmp = mBounds;
|
||||
} else {
|
||||
aRect = CocoaPointsToDevPixels([mView frame]);
|
||||
tmp = CocoaPointsToDevPixels([mView frame]);
|
||||
}
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(tmp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
NS_IMETHODIMP nsChildView::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
GetBoundsUntyped(aRect);
|
||||
GetBounds(aRect);
|
||||
if (!mParentWidget) {
|
||||
// For top level widgets we want the position on screen, not the position
|
||||
// of this view inside the window.
|
||||
aRect.MoveTo(WidgetToScreenOffsetUntyped());
|
||||
aRect.MoveTo(WidgetToScreenOffset());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
NS_IMETHODIMP nsChildView::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
GetBoundsUntyped(aRect);
|
||||
aRect.MoveTo(WidgetToScreenOffsetUntyped());
|
||||
GetBounds(aRect);
|
||||
aRect.MoveTo(WidgetToScreenOffset());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1523,15 +1525,15 @@ void nsChildView::ReportSizeEvent()
|
||||
|
||||
#pragma mark -
|
||||
|
||||
nsIntPoint nsChildView::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint nsChildView::GetClientOffset()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
NSPoint origin = [mView convertPoint:NSMakePoint(0, 0) toView:nil];
|
||||
origin.y = [[mView window] frame].size.height - origin.y;
|
||||
return CocoaPointsToDevPixels(origin);
|
||||
return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0, 0));
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
||||
}
|
||||
|
||||
// Return the offset between this child view and the screen.
|
||||
|
||||
@@ -268,12 +268,13 @@ public:
|
||||
NS_IMETHOD Enable(bool aState) override;
|
||||
virtual bool IsEnabled() const override;
|
||||
NS_IMETHOD SetModal(bool aState) override;
|
||||
NS_IMETHOD SetFakeModal(bool aState) override;
|
||||
virtual bool IsVisible() const override;
|
||||
NS_IMETHOD SetFocus(bool aState=false) override;
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual mozilla::LayoutDeviceIntSize
|
||||
ClientToWindowSize(const mozilla::LayoutDeviceIntSize& aClientSize) override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
virtual LayoutDeviceIntSize
|
||||
ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
|
||||
|
||||
virtual void* GetNativeData(uint32_t aDataType) override;
|
||||
|
||||
@@ -291,8 +292,8 @@ public:
|
||||
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override;
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
void ReportMoveEvent();
|
||||
void ReportSizeEvent();
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
||||
@@ -324,11 +325,11 @@ public:
|
||||
virtual void SetWindowAnimationType(WindowAnimationType aType) override;
|
||||
virtual void SetDrawsTitle(bool aDrawTitle) override;
|
||||
virtual void SetUseBrightTitlebarForeground(bool aBrightForeground) override;
|
||||
NS_IMETHOD SetNonClientMargins(mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
|
||||
virtual void SetDrawsInTitlebar(bool aState) override;
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
@@ -397,6 +398,7 @@ protected:
|
||||
const IMENotification& aIMENotification) override;
|
||||
|
||||
nsIWidget* mParent; // if we're a popup, this is our parent [WEAK]
|
||||
nsIWidget* mAncestorLink; // link to traverse ancestors [WEAK]
|
||||
BaseWindow* mWindow; // our cocoa window [STRONG]
|
||||
WindowDelegate* mDelegate; // our delegate for processing window msgs [STRONG]
|
||||
RefPtr<nsMenuBarX> mMenuBar;
|
||||
@@ -419,6 +421,7 @@ protected:
|
||||
// used to distinguish between DOM fullscreen and fullscreen mode.
|
||||
bool mInDOMFullscreenTransition;
|
||||
bool mModal;
|
||||
bool mFakeModal;
|
||||
|
||||
// Only true on 10.7+ if SetShowsFullScreenButton(true) is called.
|
||||
bool mSupportsNativeFullScreen;
|
||||
|
||||
@@ -97,6 +97,7 @@ static void RollUpPopups()
|
||||
|
||||
nsCocoaWindow::nsCocoaWindow()
|
||||
: mParent(nullptr)
|
||||
, mAncestorLink(nullptr)
|
||||
, mWindow(nil)
|
||||
, mDelegate(nil)
|
||||
, mSheetWindowParent(nil)
|
||||
@@ -110,6 +111,7 @@ nsCocoaWindow::nsCocoaWindow()
|
||||
, mInFullScreenTransition(false)
|
||||
, mInDOMFullscreenTransition(false)
|
||||
, mModal(false)
|
||||
, mFakeModal(false)
|
||||
, mSupportsNativeFullScreen(false)
|
||||
, mInNativeFullScreenMode(false)
|
||||
, mIsAnimationSuppressed(false)
|
||||
@@ -155,6 +157,7 @@ nsCocoaWindow::~nsCocoaWindow()
|
||||
} else {
|
||||
nsCocoaWindow* childWindow = static_cast<nsCocoaWindow*>(kid);
|
||||
childWindow->mParent = nullptr;
|
||||
childWindow->mAncestorLink = mAncestorLink;
|
||||
kid = kid->GetPrevSibling();
|
||||
}
|
||||
}
|
||||
@@ -269,6 +272,7 @@ nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
||||
Inherited::BaseCreate(aParent, newBounds, aInitData);
|
||||
|
||||
mParent = aParent;
|
||||
mAncestorLink = aParent;
|
||||
|
||||
// Applications that use native popups don't want us to create popup windows.
|
||||
if ((mWindowType == eWindowType_popup) && UseNativePopupWindows())
|
||||
@@ -500,6 +504,13 @@ NS_IMETHODIMP nsCocoaWindow::CreatePopupContentView(const nsIntRect &aRect)
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::Destroy()
|
||||
{
|
||||
// SetFakeModal(true) is called for non-modal window opened by modal window.
|
||||
// On Cocoa, it needs corresponding SetFakeModal(false) on destroy to restore
|
||||
// ancestor windows' state.
|
||||
if (mFakeModal) {
|
||||
SetFakeModal(false);
|
||||
}
|
||||
|
||||
// If we don't hide here we run into problems with panels, this is not ideal.
|
||||
// (Bug 891424)
|
||||
Show(false);
|
||||
@@ -594,7 +605,7 @@ NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
nsAutoreleasePool localPool;
|
||||
|
||||
mModal = aState;
|
||||
nsCocoaWindow *aParent = static_cast<nsCocoaWindow*>(mParent);
|
||||
nsCocoaWindow *ancestor = static_cast<nsCocoaWindow*>(mAncestorLink);
|
||||
if (aState) {
|
||||
++gXULModalLevel;
|
||||
// When a non-sheet window gets "set modal", make the window(s) that it
|
||||
@@ -605,16 +616,16 @@ NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
// ShowModal() (each of these event loops is "exclusive", and can't run at
|
||||
// the same time as other (similar) event loops).
|
||||
if (mWindowType != eWindowType_sheet) {
|
||||
while (aParent) {
|
||||
if (aParent->mNumModalDescendents++ == 0) {
|
||||
NSWindow *aWindow = aParent->GetCocoaWindow();
|
||||
if (aParent->mWindowType != eWindowType_invisible) {
|
||||
while (ancestor) {
|
||||
if (ancestor->mNumModalDescendents++ == 0) {
|
||||
NSWindow *aWindow = ancestor->GetCocoaWindow();
|
||||
if (ancestor->mWindowType != eWindowType_invisible) {
|
||||
[[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:NO];
|
||||
[[aWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:NO];
|
||||
[[aWindow standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
||||
}
|
||||
}
|
||||
aParent = static_cast<nsCocoaWindow*>(aParent->mParent);
|
||||
ancestor = static_cast<nsCocoaWindow*>(ancestor->mParent);
|
||||
}
|
||||
[mWindow setLevel:NSModalPanelWindowLevel];
|
||||
nsCocoaWindowList *windowList = new nsCocoaWindowList;
|
||||
@@ -629,17 +640,17 @@ NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
--gXULModalLevel;
|
||||
NS_ASSERTION(gXULModalLevel >= 0, "Mismatched call to nsCocoaWindow::SetModal(false)!");
|
||||
if (mWindowType != eWindowType_sheet) {
|
||||
while (aParent) {
|
||||
if (--aParent->mNumModalDescendents == 0) {
|
||||
NSWindow *aWindow = aParent->GetCocoaWindow();
|
||||
if (aParent->mWindowType != eWindowType_invisible) {
|
||||
while (ancestor) {
|
||||
if (--ancestor->mNumModalDescendents == 0) {
|
||||
NSWindow *aWindow = ancestor->GetCocoaWindow();
|
||||
if (ancestor->mWindowType != eWindowType_invisible) {
|
||||
[[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:YES];
|
||||
[[aWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:YES];
|
||||
[[aWindow standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(aParent->mNumModalDescendents >= 0, "Widget hierarchy changed while modal!");
|
||||
aParent = static_cast<nsCocoaWindow*>(aParent->mParent);
|
||||
NS_ASSERTION(ancestor->mNumModalDescendents >= 0, "Widget hierarchy changed while modal!");
|
||||
ancestor = static_cast<nsCocoaWindow*>(ancestor->mParent);
|
||||
}
|
||||
if (gGeckoAppModalWindowList) {
|
||||
NS_ASSERTION(gGeckoAppModalWindowList->window == this, "Widget hierarchy changed while modal!");
|
||||
@@ -656,6 +667,12 @@ NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SetFakeModal(bool aState)
|
||||
{
|
||||
mFakeModal = aState;
|
||||
return SetModal(aState);
|
||||
}
|
||||
|
||||
// Hide or show this window
|
||||
NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
{
|
||||
@@ -1437,13 +1454,14 @@ NS_IMETHODIMP nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint
|
||||
aWidth, aHeight, aRepaint, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
CGFloat scaleFactor = BackingScaleFactor();
|
||||
if (!mWindow) {
|
||||
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(
|
||||
nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1455,7 +1473,8 @@ NS_IMETHODIMP nsCocoaWindow::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
r = [mWindow contentRectForFrameRect:[mWindow frame]];
|
||||
}
|
||||
|
||||
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor);
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(
|
||||
nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor));
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -1472,7 +1491,7 @@ nsCocoaWindow::UpdateBounds()
|
||||
mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@@ -1481,7 +1500,7 @@ NS_IMETHODIMP nsCocoaWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
|
||||
#endif
|
||||
|
||||
aRect = mBounds;
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@@ -1868,16 +1887,17 @@ LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
||||
}
|
||||
|
||||
nsIntPoint nsCocoaWindow::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint nsCocoaWindow::GetClientOffset()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
nsIntRect clientRect;
|
||||
GetClientBoundsUntyped(clientRect);
|
||||
LayoutDeviceIntRect clientRect;
|
||||
GetClientBounds(clientRect);
|
||||
|
||||
return clientRect.TopLeft() - mBounds.TopLeft();
|
||||
return clientRect.TopLeft() -
|
||||
LayoutDeviceIntPoint::FromUnknownPoint(mBounds.TopLeft());
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0, 0));
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
||||
}
|
||||
|
||||
LayoutDeviceIntSize
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "HwcComposer2D.h"
|
||||
#include "LayerScope.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/PLayerTransaction.h"
|
||||
@@ -130,8 +131,24 @@ HwcComposer2D*
|
||||
HwcComposer2D::GetInstance()
|
||||
{
|
||||
if (!sInstance) {
|
||||
#ifdef HWC_DEBUG
|
||||
// Make sure only create once
|
||||
static int timesCreated = 0;
|
||||
++timesCreated;
|
||||
MOZ_ASSERT(timesCreated == 1);
|
||||
#endif
|
||||
LOGI("Creating new instance");
|
||||
sInstance = new HwcComposer2D();
|
||||
|
||||
// If anyone uses the compositor thread to create HwcComposer2D,
|
||||
// we just skip this function.
|
||||
// If ClearOnShutdown() can handle objects in other threads
|
||||
// in the future, we can remove this check.
|
||||
if (NS_IsMainThread()) {
|
||||
// If we create HwcComposer2D by the main thread, we can use
|
||||
// ClearOnShutdown() to make sure it will be nullified properly.
|
||||
ClearOnShutdown(&sInstance);
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
@@ -205,6 +222,7 @@ public:
|
||||
} else {
|
||||
screenManager->RemoveScreen(mType);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
GonkDisplay::DisplayType mType;
|
||||
|
||||
@@ -78,8 +78,6 @@ public:
|
||||
// frame's buffer.
|
||||
virtual void onFrameCommitted() = 0;
|
||||
|
||||
virtual void dump(String8& result) const = 0;
|
||||
|
||||
virtual void resizeBuffers(const uint32_t w, const uint32_t h) = 0;
|
||||
|
||||
// setReleaseFenceFd stores a fence file descriptor that will signal when the
|
||||
|
||||
@@ -198,10 +198,6 @@ status_t FramebufferSurface::compositionComplete()
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void FramebufferSurface::dump(String8& result) const {
|
||||
ConsumerBase::dump(result);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
}; // namespace android
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -41,9 +41,6 @@ public:
|
||||
virtual status_t compositionComplete();
|
||||
virtual status_t advanceFrame();
|
||||
virtual void onFrameCommitted();
|
||||
// Implementation of DisplaySurface::dump(). Note that ConsumerBase also
|
||||
// has a non-virtual dump() with the same signature.
|
||||
virtual void dump(String8& result) const;
|
||||
// Cannot resize a buffers in a FramebufferSurface. Only works with virtual
|
||||
// displays.
|
||||
virtual void resizeBuffers(const uint32_t /*w*/, const uint32_t /*h*/) { };
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
virtual NativeData GetNativeData(
|
||||
GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aProducer = nullptr) = 0;
|
||||
android::IGraphicBufferProducer* aSink = nullptr) = 0;
|
||||
|
||||
virtual void NotifyBootAnimationStopped() = 0;
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ GonkDisplayICS::SetDispReleaseFd(int fd)
|
||||
|
||||
GonkDisplay::NativeData
|
||||
GonkDisplayICS::GetNativeData(GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aProducer)
|
||||
android::IGraphicBufferProducer* aSink)
|
||||
{
|
||||
MOZ_ASSERT(aDisplayType == DISPLAY_PRIMARY, "ICS gonk supports primary display only.");
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
virtual NativeData GetNativeData(
|
||||
GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aProducer = nullptr);
|
||||
android::IGraphicBufferProducer* aSink = nullptr);
|
||||
|
||||
virtual void NotifyBootAnimationStopped() {}
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <hardware/power.h>
|
||||
#include <suspend/autosuspend.h>
|
||||
|
||||
#if ANDROID_VERSION >= 19
|
||||
#include "VirtualDisplaySurface.h"
|
||||
#endif
|
||||
#include "FramebufferSurface.h"
|
||||
#if ANDROID_VERSION == 17
|
||||
#include "GraphicBufferAlloc.h"
|
||||
@@ -110,7 +113,7 @@ GonkDisplayJB::GonkDisplayJB()
|
||||
|
||||
mAlloc = new GraphicBufferAlloc();
|
||||
|
||||
CreateSurface(mSTClient, mDispSurface, mWidth, mHeight);
|
||||
CreateFramebufferSurface(mSTClient, mDispSurface, mWidth, mHeight);
|
||||
|
||||
mList = (hwc_display_contents_1_t *)calloc(1, sizeof(*mList) + (sizeof(hwc_layer_1_t)*2));
|
||||
|
||||
@@ -123,7 +126,7 @@ GonkDisplayJB::GonkDisplayJB()
|
||||
PowerOnDisplay(HWC_DISPLAY_PRIMARY);
|
||||
// For devices w/ hwc v1.0 or no hwc, this buffer can not be created,
|
||||
// only create this buffer for devices w/ hwc version > 1.0.
|
||||
CreateSurface(mBootAnimSTClient, mBootAnimDispSurface, mWidth, mHeight);
|
||||
CreateFramebufferSurface(mBootAnimSTClient, mBootAnimDispSurface, mWidth, mHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +140,10 @@ GonkDisplayJB::~GonkDisplayJB()
|
||||
}
|
||||
|
||||
void
|
||||
GonkDisplayJB::CreateSurface(android::sp<ANativeWindow>& aNativeWindow,
|
||||
android::sp<android::DisplaySurface>& aDisplaySurface,
|
||||
uint32_t aWidth, uint32_t aHeight)
|
||||
GonkDisplayJB::CreateFramebufferSurface(android::sp<ANativeWindow>& aNativeWindow,
|
||||
android::sp<android::DisplaySurface>& aDisplaySurface,
|
||||
uint32_t aWidth,
|
||||
uint32_t aHeight)
|
||||
{
|
||||
#if ANDROID_VERSION >= 21
|
||||
sp<IGraphicBufferProducer> producer;
|
||||
@@ -165,6 +169,28 @@ GonkDisplayJB::CreateSurface(android::sp<ANativeWindow>& aNativeWindow,
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
GonkDisplayJB::CreateVirtualDisplaySurface(android::IGraphicBufferProducer* aSink,
|
||||
android::sp<ANativeWindow>& aNativeWindow,
|
||||
android::sp<android::DisplaySurface>& aDisplaySurface)
|
||||
{
|
||||
#if ANDROID_VERSION >= 21
|
||||
sp<IGraphicBufferProducer> producer;
|
||||
sp<IGraphicBufferConsumer> consumer;
|
||||
BufferQueue::createBufferQueue(&producer, &consumer, mAlloc);
|
||||
#elif ANDROID_VERSION >= 19
|
||||
sp<BufferQueue> consumer = new BufferQueue(mAlloc);
|
||||
sp<IGraphicBufferProducer> producer = consumer;
|
||||
#endif
|
||||
|
||||
#if ANDROID_VERSION >= 19
|
||||
sp<VirtualDisplaySurface> virtualDisplay;
|
||||
virtualDisplay = new VirtualDisplaySurface(-1, aSink, producer, consumer, String8("VirtualDisplaySurface"));
|
||||
aDisplaySurface = virtualDisplay;
|
||||
aNativeWindow = new Surface(virtualDisplay);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
GonkDisplayJB::SetEnabled(bool enabled)
|
||||
{
|
||||
@@ -380,7 +406,7 @@ GonkDisplayJB::PowerOnDisplay(int aDpy)
|
||||
|
||||
GonkDisplay::NativeData
|
||||
GonkDisplayJB::GetNativeData(GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aProducer)
|
||||
android::IGraphicBufferProducer* aSink)
|
||||
{
|
||||
NativeData data;
|
||||
|
||||
@@ -403,11 +429,15 @@ GonkDisplayJB::GetNativeData(GonkDisplay::DisplayType aDisplayType,
|
||||
// sound right, Bug 1169176 is the follow-up bug for this issue.
|
||||
data.mXdpi = values[2] ? values[2] / 1000.f : DEFAULT_XDPI;
|
||||
PowerOnDisplay(HWC_DISPLAY_EXTERNAL);
|
||||
CreateSurface(data.mNativeWindow, data.mDisplaySurface, width, height);
|
||||
CreateFramebufferSurface(data.mNativeWindow,
|
||||
data.mDisplaySurface,
|
||||
width,
|
||||
height);
|
||||
} else if (aDisplayType == DISPLAY_VIRTUAL) {
|
||||
// TODO: Bug 1161874 (the support of WifiDisplay) should fill up the
|
||||
// implementation of virtual display.
|
||||
MOZ_CRASH("Display type of virtual is not supported yet.");
|
||||
data.mXdpi = xdpi;
|
||||
CreateVirtualDisplaySurface(aSink,
|
||||
data.mNativeWindow,
|
||||
data.mDisplaySurface);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
@@ -48,15 +48,18 @@ public:
|
||||
|
||||
virtual NativeData GetNativeData(
|
||||
GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aProducer = nullptr);
|
||||
android::IGraphicBufferProducer* aSink = nullptr);
|
||||
|
||||
virtual void NotifyBootAnimationStopped();
|
||||
|
||||
private:
|
||||
void StopBootAnim();
|
||||
void CreateSurface(android::sp<ANativeWindow>& aNativeWindow,
|
||||
android::sp<android::DisplaySurface>& aDisplaySurface,
|
||||
uint32_t aWidth, uint32_t aHeight);
|
||||
void CreateFramebufferSurface(android::sp<ANativeWindow>& aNativeWindow,
|
||||
android::sp<android::DisplaySurface>& aDisplaySurface,
|
||||
uint32_t aWidth, uint32_t aHeight);
|
||||
void CreateVirtualDisplaySurface(android::IGraphicBufferProducer* aSink,
|
||||
android::sp<ANativeWindow>& aNativeWindow,
|
||||
android::sp<android::DisplaySurface>& aDisplaySurface);
|
||||
|
||||
void PowerOnDisplay(int aDpy);
|
||||
|
||||
int DoQueueBuffer(ANativeWindowBuffer* buf);
|
||||
|
||||
@@ -111,8 +111,10 @@ SurfaceFormatToColorDepth(int32_t aSurfaceFormat)
|
||||
|
||||
nsScreenGonk::nsScreenGonk(uint32_t aId,
|
||||
GonkDisplay::DisplayType aDisplayType,
|
||||
const GonkDisplay::NativeData& aNativeData)
|
||||
const GonkDisplay::NativeData& aNativeData,
|
||||
NotifyDisplayChangedEvent aEventVisibility)
|
||||
: mId(aId)
|
||||
, mEventVisibility(aEventVisibility)
|
||||
, mNativeWindow(aNativeData.mNativeWindow)
|
||||
, mDpi(aNativeData.mXdpi)
|
||||
, mScreenRotation(nsIScreen::ROTATION_0_DEG)
|
||||
@@ -180,6 +182,12 @@ nsScreenGonk::GetId()
|
||||
return mId;
|
||||
}
|
||||
|
||||
NotifyDisplayChangedEvent
|
||||
nsScreenGonk::GetEventVisibility()
|
||||
{
|
||||
return mEventVisibility;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreenGonk::GetRect(int32_t *outLeft, int32_t *outTop,
|
||||
int32_t *outWidth, int32_t *outHeight)
|
||||
@@ -193,7 +201,7 @@ nsScreenGonk::GetRect(int32_t *outLeft, int32_t *outTop,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
LayoutDeviceIntRect
|
||||
nsScreenGonk::GetRect()
|
||||
{
|
||||
return mVirtualBounds;
|
||||
@@ -265,9 +273,9 @@ nsScreenGonk::SetRotation(uint32_t aRotation)
|
||||
uint32_t rotation = EffectiveScreenRotation();
|
||||
if (rotation == nsIScreen::ROTATION_90_DEG ||
|
||||
rotation == nsIScreen::ROTATION_270_DEG) {
|
||||
mVirtualBounds = nsIntRect(0, 0,
|
||||
mNaturalBounds.height,
|
||||
mNaturalBounds.width);
|
||||
mVirtualBounds = LayoutDeviceIntRect(0, 0,
|
||||
mNaturalBounds.height,
|
||||
mNaturalBounds.width);
|
||||
} else {
|
||||
mVirtualBounds = mNaturalBounds;
|
||||
}
|
||||
@@ -286,7 +294,7 @@ nsScreenGonk::SetRotation(uint32_t aRotation)
|
||||
LayoutDeviceIntRect
|
||||
nsScreenGonk::GetNaturalBounds()
|
||||
{
|
||||
return LayoutDeviceIntRect::FromUnknownRect(mNaturalBounds);
|
||||
return mNaturalBounds;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -298,7 +306,7 @@ nsScreenGonk::EffectiveScreenRotation()
|
||||
// NB: This isn't gonk-specific, but gonk is the only widget backend
|
||||
// that does this calculation itself, currently.
|
||||
static ScreenOrientationInternal
|
||||
ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
|
||||
ComputeOrientation(uint32_t aRotation, const LayoutDeviceIntSize& aScreenSize)
|
||||
{
|
||||
bool naturallyPortrait = (aScreenSize.height > aScreenSize.width);
|
||||
switch (aRotation) {
|
||||
@@ -332,12 +340,12 @@ RotationToAngle(uint32_t aRotation)
|
||||
ScreenConfiguration
|
||||
nsScreenGonk::GetConfiguration()
|
||||
{
|
||||
ScreenOrientationInternal orientation = ComputeOrientation(mScreenRotation,
|
||||
mNaturalBounds.Size());
|
||||
ScreenOrientationInternal orientation =
|
||||
ComputeOrientation(mScreenRotation, mNaturalBounds.Size());
|
||||
|
||||
// NB: perpetuating colorDepth == pixelDepth illusion here, for
|
||||
// consistency.
|
||||
return ScreenConfiguration(mVirtualBounds, orientation,
|
||||
return ScreenConfiguration(mVirtualBounds.ToUnknownRect(), orientation,
|
||||
RotationToAngle(mScreenRotation),
|
||||
mColorDepth, mColorDepth);
|
||||
}
|
||||
@@ -465,7 +473,7 @@ nsScreenGonk::EnableMirroring()
|
||||
nsWidgetInitData initData;
|
||||
initData.mScreenId = mId;
|
||||
RefPtr<nsWindow> window = new nsWindow();
|
||||
window->Create(nullptr, nullptr, mNaturalBounds, &initData);
|
||||
window->Create(nullptr, nullptr, mNaturalBounds.ToUnknownRect(), &initData);
|
||||
MOZ_ASSERT(static_cast<nsWindow*>(window)->GetScreen() == this);
|
||||
|
||||
// Update mMirroringWidget on compositor thread
|
||||
@@ -773,7 +781,8 @@ NotifyDisplayChange(uint32_t aId, bool aConnected)
|
||||
|
||||
nsresult
|
||||
nsScreenManagerGonk::AddScreen(GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aSink)
|
||||
android::IGraphicBufferProducer* aSink,
|
||||
NotifyDisplayChangedEvent aEventVisibility)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@@ -785,11 +794,15 @@ nsScreenManagerGonk::AddScreen(GonkDisplay::DisplayType aDisplayType,
|
||||
|
||||
GonkDisplay::NativeData nativeData =
|
||||
GetGonkDisplay()->GetNativeData(aDisplayType, aSink);
|
||||
nsScreenGonk* screen = new nsScreenGonk(id, aDisplayType, nativeData);
|
||||
|
||||
nsScreenGonk* screen = new nsScreenGonk(id,
|
||||
aDisplayType,
|
||||
nativeData,
|
||||
aEventVisibility);
|
||||
mScreens.AppendElement(screen);
|
||||
|
||||
NotifyDisplayChange(id, true);
|
||||
if (aEventVisibility == NotifyDisplayChangedEvent::Observable) {
|
||||
NotifyDisplayChange(id, true);
|
||||
}
|
||||
|
||||
// By default, non primary screen does mirroring.
|
||||
if (aDisplayType != GonkDisplay::DISPLAY_PRIMARY &&
|
||||
@@ -808,6 +821,7 @@ nsScreenManagerGonk::RemoveScreen(GonkDisplay::DisplayType aDisplayType)
|
||||
NS_ENSURE_TRUE(aDisplayType < GonkDisplay::DisplayType::NUM_DISPLAY_TYPES,
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
NotifyDisplayChangedEvent eventVisibility = NotifyDisplayChangedEvent::Observable;
|
||||
uint32_t screenId = GetIdFromType(aDisplayType);
|
||||
NS_ENSURE_TRUE(IsScreenConnected(screenId), NS_ERROR_FAILURE);
|
||||
|
||||
@@ -816,12 +830,14 @@ nsScreenManagerGonk::RemoveScreen(GonkDisplay::DisplayType aDisplayType)
|
||||
if (mScreens[i]->IsMirroring()) {
|
||||
mScreens[i]->DisableMirroring();
|
||||
}
|
||||
eventVisibility = mScreens[i]->GetEventVisibility();
|
||||
mScreens.RemoveElementAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NotifyDisplayChange(screenId, false);
|
||||
|
||||
if (eventVisibility == NotifyDisplayChangedEvent::Observable) {
|
||||
NotifyDisplayChange(screenId, false);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -44,15 +44,22 @@ namespace gl {
|
||||
}
|
||||
}
|
||||
|
||||
enum class NotifyDisplayChangedEvent : int8_t {
|
||||
Observable,
|
||||
Suppressed
|
||||
};
|
||||
|
||||
class nsScreenGonk : public nsBaseScreen
|
||||
{
|
||||
typedef mozilla::hal::ScreenConfiguration ScreenConfiguration;
|
||||
typedef mozilla::GonkDisplay GonkDisplay;
|
||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||
|
||||
public:
|
||||
nsScreenGonk(uint32_t aId,
|
||||
GonkDisplay::DisplayType aDisplayType,
|
||||
const GonkDisplay::NativeData& aNativeData);
|
||||
const GonkDisplay::NativeData& aNativeData,
|
||||
NotifyDisplayChangedEvent aEventVisibility);
|
||||
|
||||
~nsScreenGonk();
|
||||
|
||||
@@ -65,11 +72,12 @@ public:
|
||||
NS_IMETHOD SetRotation(uint32_t aRotation);
|
||||
|
||||
uint32_t GetId();
|
||||
nsIntRect GetRect();
|
||||
NotifyDisplayChangedEvent GetEventVisibility();
|
||||
LayoutDeviceIntRect GetRect();
|
||||
float GetDpi();
|
||||
int32_t GetSurfaceFormat();
|
||||
ANativeWindow* GetNativeWindow();
|
||||
mozilla::LayoutDeviceIntRect GetNaturalBounds();
|
||||
LayoutDeviceIntRect GetNaturalBounds();
|
||||
uint32_t EffectiveScreenRotation();
|
||||
ScreenConfiguration GetConfiguration();
|
||||
bool IsPrimaryScreen();
|
||||
@@ -114,12 +122,13 @@ public:
|
||||
|
||||
protected:
|
||||
uint32_t mId;
|
||||
NotifyDisplayChangedEvent mEventVisibility;
|
||||
int32_t mColorDepth;
|
||||
android::sp<ANativeWindow> mNativeWindow;
|
||||
float mDpi;
|
||||
int32_t mSurfaceFormat;
|
||||
nsIntRect mNaturalBounds; // Screen bounds w/o rotation taken into account.
|
||||
nsIntRect mVirtualBounds; // Screen bounds w/ rotation taken into account.
|
||||
LayoutDeviceIntRect mNaturalBounds; // Screen bounds w/o rotation taken into account.
|
||||
LayoutDeviceIntRect mVirtualBounds; // Screen bounds w/ rotation taken into account.
|
||||
uint32_t mScreenRotation;
|
||||
uint32_t mPhysicalScreenRotation;
|
||||
nsTArray<nsWindow*> mTopWindows;
|
||||
@@ -155,7 +164,8 @@ public:
|
||||
void DisplayEnabled(bool aEnabled);
|
||||
|
||||
nsresult AddScreen(GonkDisplay::DisplayType aDisplayType,
|
||||
android::IGraphicBufferProducer* aSink = nullptr);
|
||||
android::IGraphicBufferProducer* aSink = nullptr,
|
||||
NotifyDisplayChangedEvent aEventVisibility = NotifyDisplayChangedEvent::Observable);
|
||||
|
||||
nsresult RemoveScreen(GonkDisplay::DisplayType aDisplayType);
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ nsWindow::nsWindow()
|
||||
nsWindow::~nsWindow()
|
||||
{
|
||||
if (mScreen->IsPrimaryScreen()) {
|
||||
HwcComposer2D::GetInstance()->SetCompositorParent(nullptr);
|
||||
mComposer2D->SetCompositorParent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,9 +353,11 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
mVisible = false;
|
||||
|
||||
if (!aParent) {
|
||||
mBounds = mScreen->GetRect();
|
||||
mBounds = mScreen->GetRect().ToUnknownRect();
|
||||
}
|
||||
|
||||
mComposer2D = HwcComposer2D::GetInstance();
|
||||
|
||||
if (!IS_TOPLEVEL()) {
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -784,7 +786,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
||||
|
||||
CreateCompositor();
|
||||
if (mCompositorParent && mScreen->IsPrimaryScreen()) {
|
||||
HwcComposer2D::GetInstance()->SetCompositorParent(mCompositorParent);
|
||||
mComposer2D->SetCompositorParent(mCompositorParent);
|
||||
}
|
||||
MOZ_ASSERT(mLayerManager);
|
||||
return mLayerManager;
|
||||
@@ -843,10 +845,10 @@ nsWindow::GetGLFrameBufferFormat()
|
||||
return LOCAL_GL_NONE;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
nsWindow::GetNaturalBoundsUntyped()
|
||||
LayoutDeviceIntRect
|
||||
nsWindow::GetNaturalBounds()
|
||||
{
|
||||
return mScreen->GetNaturalBounds().ToUnknownRect();
|
||||
return mScreen->GetNaturalBounds();
|
||||
}
|
||||
|
||||
nsScreenGonk*
|
||||
@@ -871,5 +873,5 @@ nsWindow::GetComposer2D()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return HwcComposer2D::GetInstance();
|
||||
return mComposer2D;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ struct InputContext;
|
||||
struct InputContextAction;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
class HwcComposer2D;
|
||||
}
|
||||
|
||||
class nsScreenGonk;
|
||||
|
||||
class nsWindow : public nsBaseWidget
|
||||
@@ -75,7 +79,7 @@ public:
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
void DispatchTouchInputViaAPZ(mozilla::MultiTouchInput& aInput);
|
||||
void DispatchTouchEventForAPZ(const mozilla::MultiTouchInput& aInput,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
@@ -118,7 +122,7 @@ public:
|
||||
|
||||
virtual uint32_t GetGLFrameBufferFormat() override;
|
||||
|
||||
virtual nsIntRect GetNaturalBoundsUntyped() override;
|
||||
virtual LayoutDeviceIntRect GetNaturalBounds() override;
|
||||
virtual bool NeedsPaint();
|
||||
|
||||
virtual Composer2D* GetComposer2D() override;
|
||||
@@ -164,6 +168,8 @@ private:
|
||||
nsAutoPtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
|
||||
|
||||
RefPtr<nsScreenGonk> mScreen;
|
||||
|
||||
RefPtr<mozilla::HwcComposer2D> mComposer2D;
|
||||
};
|
||||
|
||||
#endif /* nsWindow_h */
|
||||
|
||||
+14
-15
@@ -1474,41 +1474,40 @@ nsWindow::SetFocus(bool aRaise)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
if (mIsTopLevel && mContainer) {
|
||||
// use the point including window decorations
|
||||
gint x, y;
|
||||
gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
|
||||
aRect.MoveTo(GdkPointToDevicePixels({ x, y }).ToUnknownPoint());
|
||||
}
|
||||
else {
|
||||
aRect.MoveTo(WidgetToScreenOffsetUntyped());
|
||||
aRect.MoveTo(GdkPointToDevicePixels({ x, y }));
|
||||
} else {
|
||||
aRect.MoveTo(WidgetToScreenOffset());
|
||||
}
|
||||
// mBounds.Size() is the window bounds, not the window-manager frame
|
||||
// bounds (bug 581863). gdk_window_get_frame_extents would give the
|
||||
// frame bounds, but mBounds.Size() is returned here for consistency
|
||||
// with Resize.
|
||||
aRect.SizeTo(mBounds.Size());
|
||||
LOG(("GetScreenBoundsUntyped %d,%d | %dx%d\n",
|
||||
aRect.SizeTo(LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
|
||||
LOG(("GetScreenBounds %d,%d | %dx%d\n",
|
||||
aRect.x, aRect.y, aRect.width, aRect.height));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gfx::IntSize
|
||||
LayoutDeviceIntSize
|
||||
nsWindow::GetClientSize()
|
||||
{
|
||||
return gfx::IntSize(mBounds.width, mBounds.height);
|
||||
return LayoutDeviceIntSize(mBounds.width, mBounds.height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
nsWindow::GetClientBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
// GetBounds returns a rect whose top left represents the top left of the
|
||||
// outer bounds, but whose width/height represent the size of the inner
|
||||
// bounds (which is messed up).
|
||||
GetBoundsUntyped(aRect);
|
||||
aRect.MoveBy(GetClientOffsetUntyped());
|
||||
GetBounds(aRect);
|
||||
aRect.MoveBy(GetClientOffset());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1555,10 +1554,10 @@ nsWindow::UpdateClientOffset()
|
||||
mClientOffset = nsIntPoint(left, top);
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsWindow::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint
|
||||
nsWindow::GetClientOffset()
|
||||
{
|
||||
return mClientOffset;
|
||||
return LayoutDeviceIntPoint::FromUnknownPoint(mClientOffset);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
+12
-12
@@ -131,10 +131,10 @@ public:
|
||||
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
|
||||
NS_IMETHOD Enable(bool aState) override;
|
||||
NS_IMETHOD SetFocus(bool aRaise = false) override;
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) override;
|
||||
virtual mozilla::gfx::IntSize GetClientSize() override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
||||
virtual LayoutDeviceIntSize GetClientSize() override;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle) override;
|
||||
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override;
|
||||
NS_IMETHOD SetWindowClass(const nsAString& xulWinType) override;
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
NS_IMETHOD EnableDragDrop(bool aEnable) override;
|
||||
NS_IMETHOD CaptureMouse(bool aCapture) override;
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
@@ -222,7 +222,7 @@ private:
|
||||
|
||||
void NativeShow (bool aAction);
|
||||
void SetHasMappedToplevel(bool aState);
|
||||
mozilla::LayoutDeviceIntSize GetSafeWindowSize(mozilla::LayoutDeviceIntSize aSize);
|
||||
LayoutDeviceIntSize GetSafeWindowSize(LayoutDeviceIntSize aSize);
|
||||
|
||||
void EnsureGrabs (void);
|
||||
void GrabPointer (guint32 aTime);
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
bool IsDestroyed() { return mIsDestroyed; }
|
||||
|
||||
void DispatchDragEvent(mozilla::EventMessage aMsg,
|
||||
const mozilla::LayoutDeviceIntPoint& aRefPoint,
|
||||
const LayoutDeviceIntPoint& aRefPoint,
|
||||
guint aTime);
|
||||
static void UpdateDragStatus (GdkDragContext *aDragContext,
|
||||
nsIDragService *aDragService);
|
||||
@@ -312,16 +312,16 @@ public:
|
||||
#endif
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0, aObserver); }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
@@ -341,8 +341,8 @@ public:
|
||||
|
||||
// From GDK
|
||||
int GdkCoordToDevicePixels(gint coord);
|
||||
mozilla::LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
|
||||
mozilla::LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
|
||||
LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
|
||||
LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
|
||||
nsIntRect GdkRectToDevicePixels(GdkRectangle rect);
|
||||
|
||||
protected:
|
||||
|
||||
+26
-19
@@ -790,15 +790,10 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
|
||||
HideWindowChrome(aFullScreen);
|
||||
|
||||
if (aFullScreen) {
|
||||
if (!mOriginalBounds)
|
||||
mOriginalBounds = new nsIntRect();
|
||||
GetScreenBoundsUntyped(*mOriginalBounds);
|
||||
// convert dev pix to display pix for window manipulation
|
||||
CSSToLayoutDeviceScale scale = GetDefaultScale();
|
||||
mOriginalBounds->x = NSToIntRound(mOriginalBounds->x / scale.scale);
|
||||
mOriginalBounds->y = NSToIntRound(mOriginalBounds->y / scale.scale);
|
||||
mOriginalBounds->width = NSToIntRound(mOriginalBounds->width / scale.scale);
|
||||
mOriginalBounds->height = NSToIntRound(mOriginalBounds->height / scale.scale);
|
||||
if (!mOriginalBounds) {
|
||||
mOriginalBounds = new CSSIntRect();
|
||||
}
|
||||
*mOriginalBounds = GetScaledScreenBounds();
|
||||
|
||||
// Move to top-left corner of screen and size to the screen dimensions
|
||||
nsCOMPtr<nsIScreenManager> screenManager;
|
||||
@@ -1286,18 +1281,18 @@ NS_METHOD nsBaseWidget::ResizeClient(double aX,
|
||||
* If the implementation of nsWindow supports borders this method MUST be overridden
|
||||
*
|
||||
**/
|
||||
NS_METHOD nsBaseWidget::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
NS_METHOD nsBaseWidget::GetClientBounds(LayoutDeviceIntRect &aRect)
|
||||
{
|
||||
return GetBoundsUntyped(aRect);
|
||||
return GetBounds(aRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the implementation of nsWindow supports borders this method MUST be overridden
|
||||
*
|
||||
**/
|
||||
NS_METHOD nsBaseWidget::GetBoundsUntyped(nsIntRect &aRect)
|
||||
NS_METHOD nsBaseWidget::GetBounds(LayoutDeviceIntRect &aRect)
|
||||
{
|
||||
aRect = mBounds;
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1306,12 +1301,12 @@ NS_METHOD nsBaseWidget::GetBoundsUntyped(nsIntRect &aRect)
|
||||
* this method must be overridden
|
||||
*
|
||||
**/
|
||||
NS_METHOD nsBaseWidget::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
NS_METHOD nsBaseWidget::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
return GetBoundsUntyped(aRect);
|
||||
return GetBounds(aRect);
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect &aRect)
|
||||
NS_METHOD nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
if (SizeMode() != nsSizeMode_Normal) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@@ -1319,10 +1314,10 @@ NS_METHOD nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect &aRect)
|
||||
return GetScreenBounds(aRect);
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsBaseWidget::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint
|
||||
nsBaseWidget::GetClientOffset()
|
||||
{
|
||||
return nsIntPoint(0, 0);
|
||||
return LayoutDeviceIntPoint(0, 0);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -1701,6 +1696,18 @@ nsBaseWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
|
||||
NewRunnableMethod(mAPZC.get(), &APZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
|
||||
}
|
||||
|
||||
CSSIntRect
|
||||
nsBaseWidget::GetScaledScreenBounds()
|
||||
{
|
||||
LayoutDeviceIntRect bounds;
|
||||
GetScreenBounds(bounds);
|
||||
|
||||
// *Dividing* a LayoutDeviceIntRect by a CSSToLayoutDeviceScale gives a
|
||||
// CSSIntRect.
|
||||
CSSToLayoutDeviceScale scale = GetDefaultScale();
|
||||
return RoundedToInt(bounds / scale);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, bool aLongTap,
|
||||
nsIObserver* aObserver)
|
||||
|
||||
+19
-16
@@ -98,6 +98,7 @@ protected:
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
typedef mozilla::layers::APZEventState APZEventState;
|
||||
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
|
||||
typedef mozilla::CSSIntRect CSSIntRect;
|
||||
typedef mozilla::ScreenRotation ScreenRotation;
|
||||
|
||||
virtual ~nsBaseWidget();
|
||||
@@ -182,15 +183,13 @@ public:
|
||||
NS_IMETHOD MoveClient(double aX, double aY) override;
|
||||
NS_IMETHOD ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD GetBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
NS_IMETHOD GetNonClientMargins(
|
||||
mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
NS_IMETHOD SetNonClientMargins(
|
||||
mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
NS_IMETHOD EnableDragDrop(bool aEnable) override;
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
@@ -221,7 +220,7 @@ public:
|
||||
virtual bool ComputeShouldAccelerate();
|
||||
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override { return nsIMEUpdatePreference(); }
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const mozilla::LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD OverrideSystemMouseScrollSpeed(double aOriginalDeltaX,
|
||||
double aOriginalDeltaY,
|
||||
double& aOverriddenDeltaX,
|
||||
@@ -277,12 +276,16 @@ public:
|
||||
|
||||
nsPopupLevel PopupLevel() { return mPopupLevel; }
|
||||
|
||||
virtual mozilla::LayoutDeviceIntSize
|
||||
ClientToWindowSize(const mozilla::LayoutDeviceIntSize& aClientSize) override
|
||||
virtual LayoutDeviceIntSize
|
||||
ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override
|
||||
{
|
||||
return aClientSize;
|
||||
}
|
||||
|
||||
// return the widget's outside dimensions
|
||||
// in global coordinates in display pixel.
|
||||
CSSIntRect GetScaledScreenBounds();
|
||||
|
||||
// return true if this is a popup widget with a native titlebar
|
||||
bool IsPopupWithTitleBar() const
|
||||
{
|
||||
@@ -371,7 +374,7 @@ protected:
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override
|
||||
@@ -380,14 +383,14 @@ protected:
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{
|
||||
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
@@ -497,7 +500,7 @@ protected:
|
||||
nsCursor mCursor;
|
||||
nsBorderStyle mBorderStyle;
|
||||
nsIntRect mBounds;
|
||||
nsIntRect* mOriginalBounds;
|
||||
CSSIntRect* mOriginalBounds;
|
||||
// When this pointer is null, the widget is not clipped
|
||||
mozilla::UniquePtr<nsIntRect[]> mClipRects;
|
||||
uint32_t mClipRectCount;
|
||||
|
||||
+52
-59
@@ -122,8 +122,8 @@ typedef void* nsNativeWidget;
|
||||
#endif
|
||||
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x483BF75C, 0xF909, 0x45C3, \
|
||||
{ 0x95, 0xBE, 0x41, 0x89, 0xDB, 0xCE, 0x2E, 0x13 } };
|
||||
{ 0xd953b7a1, 0x6981, 0x4ed7, \
|
||||
{ 0xbc, 0xf0, 0xed, 0x96, 0x70, 0xee, 0x23, 0x28 } }
|
||||
|
||||
/*
|
||||
* Window shadow styles
|
||||
@@ -331,6 +331,10 @@ class nsIWidget : public nsISupports {
|
||||
typedef mozilla::widget::SizeConstraints SizeConstraints;
|
||||
typedef mozilla::widget::TextEventDispatcher TextEventDispatcher;
|
||||
typedef mozilla::CompositorVsyncDispatcher CompositorVsyncDispatcher;
|
||||
typedef mozilla::LayoutDeviceIntMargin LayoutDeviceIntMargin;
|
||||
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||
typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
|
||||
|
||||
// Used in UpdateThemeGeometries.
|
||||
struct ThemeGeometry {
|
||||
@@ -589,6 +593,15 @@ class nsIWidget : public nsISupports {
|
||||
*/
|
||||
NS_IMETHOD SetModal(bool aModal) = 0;
|
||||
|
||||
/**
|
||||
* Make the non-modal window opened by modal window fake-modal, that will
|
||||
* call SetFakeModal(false) on destroy on Cocoa.
|
||||
*/
|
||||
NS_IMETHOD SetFakeModal(bool aModal)
|
||||
{
|
||||
return SetModal(aModal);
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum number of simultaneous touch contacts supported by the device.
|
||||
* In the case of devices with multiple digitizers (e.g. multiple touch screens),
|
||||
@@ -807,13 +820,13 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRect On return it holds the x, y, width and height of
|
||||
* this widget.
|
||||
*/
|
||||
NS_IMETHOD GetBounds(mozilla::LayoutDeviceIntRect &aRect) {
|
||||
nsIntRect tmp;
|
||||
nsresult rv = GetBoundsUntyped(tmp);
|
||||
aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
|
||||
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) = 0;
|
||||
NS_IMETHOD GetBoundsUntyped(nsIntRect& aRect) {
|
||||
LayoutDeviceIntRect tmp;
|
||||
nsresult rv = GetBounds(tmp);
|
||||
aRect = tmp.ToUnknownRect();
|
||||
return rv;
|
||||
}
|
||||
NS_IMETHOD GetBoundsUntyped(nsIntRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Get this widget's outside dimensions in global coordinates. This
|
||||
@@ -825,13 +838,13 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRect On return it holds the x, y, width and height of
|
||||
* this widget.
|
||||
*/
|
||||
NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) {
|
||||
nsIntRect tmp;
|
||||
nsresult rv = GetScreenBoundsUntyped(tmp);
|
||||
aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) = 0;
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect& aRect) {
|
||||
LayoutDeviceIntRect tmp;
|
||||
nsresult rv = GetScreenBounds(tmp);
|
||||
aRect = tmp.ToUnknownRect();
|
||||
return rv;
|
||||
}
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Similar to GetScreenBounds except that this function will always
|
||||
@@ -845,7 +858,7 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRect On return it holds the x, y, width and height of
|
||||
* this widget.
|
||||
*/
|
||||
NS_IMETHOD GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) = 0;
|
||||
NS_IMETHOD GetRestoredBounds(mozilla::LayoutDeviceIntRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Get this widget's client area bounds, if the window has a 3D border
|
||||
@@ -859,18 +872,18 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRect On return it holds the x. y, width and height of
|
||||
* the client area of this widget.
|
||||
*/
|
||||
NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) {
|
||||
nsIntRect tmp;
|
||||
nsresult rv = GetClientBoundsUntyped(tmp);
|
||||
aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
|
||||
NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect& aRect) = 0;
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect& aRect) {
|
||||
LayoutDeviceIntRect tmp;
|
||||
nsresult rv = GetClientBounds(tmp);
|
||||
aRect = tmp.ToUnknownRect();
|
||||
return rv;
|
||||
}
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Get the non-client area dimensions of the window.
|
||||
*/
|
||||
NS_IMETHOD GetNonClientMargins(mozilla::LayoutDeviceIntMargin &margins) = 0;
|
||||
NS_IMETHOD GetNonClientMargins(LayoutDeviceIntMargin& aMargins) = 0;
|
||||
|
||||
/**
|
||||
* Sets the non-client area dimensions of the window. Pass -1 to restore
|
||||
@@ -884,32 +897,24 @@ class nsIWidget : public nsISupports {
|
||||
* dimensions between zero and size < system default.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetNonClientMargins(mozilla::LayoutDeviceIntMargin &margins) = 0;
|
||||
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) = 0;
|
||||
|
||||
/**
|
||||
* Get the client offset from the window origin.
|
||||
*
|
||||
* The untyped version exists temporarily to ease conversion to typed
|
||||
* coordinates.
|
||||
*
|
||||
* @return the x and y of the offset.
|
||||
*
|
||||
*/
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() {
|
||||
nsIntPoint tmp = GetClientOffsetUntyped();
|
||||
return mozilla::LayoutDeviceIntPoint::FromUnknownPoint(tmp);
|
||||
}
|
||||
virtual nsIntPoint GetClientOffsetUntyped() = 0;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() = 0;
|
||||
|
||||
/**
|
||||
* Equivalent to GetClientBounds but only returns the size.
|
||||
*/
|
||||
virtual mozilla::gfx::IntSize GetClientSize() {
|
||||
// Dependeing on the backend, overloading this method may be useful if
|
||||
// if requesting the client offset is expensive.
|
||||
mozilla::LayoutDeviceIntRect rect;
|
||||
virtual LayoutDeviceIntSize GetClientSize() {
|
||||
// Depending on the backend, overloading this method may be useful if
|
||||
// requesting the client offset is expensive.
|
||||
LayoutDeviceIntRect rect;
|
||||
GetClientBounds(rect);
|
||||
return mozilla::gfx::IntSize(rect.width, rect.height);
|
||||
return rect.Size();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1003,7 +1008,7 @@ class nsIWidget : public nsISupports {
|
||||
nsCOMPtr<nsIWidget> mChild;
|
||||
uintptr_t mWindowID; // e10s specific, the unique plugin port id
|
||||
bool mVisible; // e10s specific, widget visibility
|
||||
mozilla::LayoutDeviceIntRect mBounds;
|
||||
LayoutDeviceIntRect mBounds;
|
||||
nsTArray<nsIntRect> mClipRegion;
|
||||
};
|
||||
|
||||
@@ -1327,24 +1332,19 @@ class nsIWidget : public nsISupports {
|
||||
NS_IMETHOD SetIcon(const nsAString& anIconSpec) = 0;
|
||||
|
||||
/**
|
||||
* Return this widget's origin in screen coordinates. The untyped version
|
||||
* exists temporarily to ease conversion to typed coordinates.
|
||||
* Return this widget's origin in screen coordinates.
|
||||
*
|
||||
* @return screen coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() = 0;
|
||||
virtual nsIntPoint WidgetToScreenOffsetUntyped() {
|
||||
return WidgetToScreenOffset().ToUnknownPoint();
|
||||
}
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() = 0;
|
||||
|
||||
/**
|
||||
* Given the specified client size, return the corresponding window size,
|
||||
* which includes the area for the borders and titlebar. This method
|
||||
* should work even when the window is not yet visible.
|
||||
*/
|
||||
virtual mozilla::LayoutDeviceIntSize ClientToWindowSize(
|
||||
const mozilla::LayoutDeviceIntSize& aClientSize) = 0;
|
||||
virtual LayoutDeviceIntSize ClientToWindowSize(
|
||||
const LayoutDeviceIntSize& aClientSize) = 0;
|
||||
|
||||
/**
|
||||
* Dispatches an event to the widget
|
||||
@@ -1547,7 +1547,7 @@ class nsIWidget : public nsISupports {
|
||||
* @param aObserver the observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) = 0;
|
||||
@@ -1558,7 +1558,7 @@ class nsIWidget : public nsISupports {
|
||||
* @param aObserver the observer that will get notified once the events
|
||||
* have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) = 0;
|
||||
|
||||
/**
|
||||
@@ -1584,7 +1584,7 @@ class nsIWidget : public nsISupports {
|
||||
* @param aObserver The observer that will get notified once the
|
||||
* events have been dispatched.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
@@ -1822,7 +1822,7 @@ public:
|
||||
* Call this method when a dialog is opened which has a default button.
|
||||
* The button's rectangle should be supplied in aButtonRect.
|
||||
*/
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const mozilla::LayoutDeviceIntRect& aButtonRect) = 0;
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) = 0;
|
||||
|
||||
/**
|
||||
* Compute the overridden system mouse scroll speed on the root content of
|
||||
@@ -1914,7 +1914,7 @@ public:
|
||||
if (!IsVisible()) {
|
||||
return false;
|
||||
}
|
||||
mozilla::LayoutDeviceIntRect bounds;
|
||||
LayoutDeviceIntRect bounds;
|
||||
nsresult rv = GetBounds(bounds);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
return !bounds.IsEmpty();
|
||||
@@ -1931,17 +1931,10 @@ public:
|
||||
* No code outside of the composition pipeline should know or care
|
||||
* about this. If you're not an agent of the compositor, you
|
||||
* probably shouldn't call this method.
|
||||
*
|
||||
* The untyped version exists temporarily to ease conversion to typed
|
||||
* coordinates.
|
||||
*/
|
||||
virtual mozilla::LayoutDeviceIntRect GetNaturalBounds() {
|
||||
nsIntRect tmp = GetNaturalBoundsUntyped();
|
||||
return mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
|
||||
}
|
||||
virtual nsIntRect GetNaturalBoundsUntyped() {
|
||||
nsIntRect bounds;
|
||||
GetBoundsUntyped(bounds);
|
||||
virtual LayoutDeviceIntRect GetNaturalBounds() {
|
||||
LayoutDeviceIntRect bounds;
|
||||
GetBounds(bounds);
|
||||
return bounds;
|
||||
}
|
||||
|
||||
|
||||
@@ -445,7 +445,6 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
|
||||
case Qt::Key_TouchpadOff:
|
||||
case Qt::Key_unknown:
|
||||
case Qt::Key_Call:
|
||||
case Qt::Key_CameraFocus:
|
||||
case Qt::Key_Context1:
|
||||
case Qt::Key_Context2:
|
||||
case Qt::Key_Context3:
|
||||
|
||||
@@ -634,7 +634,7 @@ nsWindow::Invalidate(const nsIntRect &aRect)
|
||||
LayoutDeviceIntPoint
|
||||
nsWindow::WidgetToScreenOffset()
|
||||
{
|
||||
NS_ENSURE_TRUE(mWidget, nsIntPoint(0,0));
|
||||
NS_ENSURE_TRUE(mWidget, LayoutDeviceIntPoint(0,0));
|
||||
|
||||
QPoint origin(0, 0);
|
||||
origin = mWidget->mapToGlobal(origin);
|
||||
@@ -1500,14 +1500,14 @@ void find_first_visible_parent(QWindow* aItem, QWindow*& aVisibleItem)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
aRect = gfx::IntRect(gfx::IntPoint(0, 0), mBounds.Size());
|
||||
aRect = LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0),
|
||||
LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
|
||||
if (mIsTopLevel) {
|
||||
QPoint pos = mWidget->position();
|
||||
aRect.MoveTo(pos.x(), pos.y());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
aRect.MoveTo(WidgetToScreenOffset());
|
||||
}
|
||||
LOG(("GetScreenBounds %d %d | %d %d | %d %d\n",
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
||||
nsEventStatus& aStatus);
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
void DispatchDeactivateEvent(void);
|
||||
void DispatchActivateEventOnTopLevelWindow(void);
|
||||
void DispatchDeactivateEventOnTopLevelWindow(void);
|
||||
void DispatchResizeEvent(mozilla::LayoutDeviceIntRect &aRect,
|
||||
void DispatchResizeEvent(LayoutDeviceIntRect &aRect,
|
||||
nsEventStatus &aStatus);
|
||||
|
||||
// Remember the last sizemode so that we can restore it when
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
nsIWidget *aWidget,
|
||||
bool aActivate);
|
||||
NS_IMETHOD SetSizeMode(nsSizeMode aMode);
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect);
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD SetHasTransparentBackground(bool aTransparent);
|
||||
NS_IMETHOD GetHasTransparentBackground(bool& aTransparent);
|
||||
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
return mVisible;
|
||||
}
|
||||
NS_IMETHOD SetFocus(bool aState=false) override;
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
|
||||
virtual void SetBackgroundColor(const nscolor &aColor) override;
|
||||
virtual void* GetNativeData(uint32_t aDataType) override;
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
void EnteredFullScreen(bool aFullScreen);
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
void ReportMoveEvent();
|
||||
void ReportSizeEvent();
|
||||
void ReportSizeModeEvent(nsSizeMode aMode);
|
||||
|
||||
@@ -779,7 +779,7 @@ void nsWindow::ReportSizeEvent()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
LayoutDeviceIntPoint p = WidgetToScreenOffset();
|
||||
|
||||
|
||||
+16
-16
@@ -1843,7 +1843,7 @@ NS_METHOD nsWindow::SetFocus(bool aRaise)
|
||||
// Return the window's full dimensions in screen coordinates.
|
||||
// If the window has a parent, converts the origin to an offset
|
||||
// of the parent's screen origin.
|
||||
NS_METHOD nsWindow::GetBoundsUntyped(nsIntRect &aRect)
|
||||
NS_METHOD nsWindow::GetBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
if (mWnd) {
|
||||
RECT r;
|
||||
@@ -1905,21 +1905,21 @@ NS_METHOD nsWindow::GetBoundsUntyped(nsIntRect &aRect)
|
||||
aRect.x = r.left;
|
||||
aRect.y = r.top;
|
||||
} else {
|
||||
aRect = mBounds;
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get this component dimension
|
||||
NS_METHOD nsWindow::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
NS_METHOD nsWindow::GetClientBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
if (mWnd) {
|
||||
RECT r;
|
||||
VERIFY(::GetClientRect(mWnd, &r));
|
||||
|
||||
nsIntRect bounds;
|
||||
GetBoundsUntyped(bounds);
|
||||
aRect.MoveTo(bounds.TopLeft() + GetClientOffsetUntyped());
|
||||
LayoutDeviceIntRect bounds;
|
||||
GetBounds(bounds);
|
||||
aRect.MoveTo(bounds.TopLeft() + GetClientOffset());
|
||||
aRect.width = r.right - r.left;
|
||||
aRect.height = r.bottom - r.top;
|
||||
|
||||
@@ -1930,7 +1930,7 @@ NS_METHOD nsWindow::GetClientBoundsUntyped(nsIntRect &aRect)
|
||||
}
|
||||
|
||||
// Like GetBounds, but don't offset by the parent
|
||||
NS_METHOD nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
NS_METHOD nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
if (mWnd) {
|
||||
RECT r;
|
||||
@@ -1940,9 +1940,9 @@ NS_METHOD nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
|
||||
aRect.height = r.bottom - r.top;
|
||||
aRect.x = r.left;
|
||||
aRect.y = r.top;
|
||||
} else
|
||||
aRect = mBounds;
|
||||
|
||||
} else {
|
||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1972,19 +1972,19 @@ NS_METHOD nsWindow::GetRestoredBounds(LayoutDeviceIntRect &aRect)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the x,y offset of the client area from the origin
|
||||
// of the window. If the window is borderless returns (0,0).
|
||||
nsIntPoint
|
||||
nsWindow::GetClientOffsetUntyped()
|
||||
// Return the x,y offset of the client area from the origin of the window. If
|
||||
// the window is borderless returns (0,0).
|
||||
LayoutDeviceIntPoint
|
||||
nsWindow::GetClientOffset()
|
||||
{
|
||||
if (!mWnd) {
|
||||
return nsIntPoint(0, 0);
|
||||
return LayoutDeviceIntPoint(0, 0);
|
||||
}
|
||||
|
||||
RECT r1;
|
||||
GetWindowRect(mWnd, &r1);
|
||||
LayoutDeviceIntPoint pt = WidgetToScreenOffset();
|
||||
return nsIntPoint(pt.x - r1.left, pt.y - r1.top);
|
||||
return LayoutDeviceIntPoint(pt.x - r1.left, pt.y - r1.top);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+18
-20
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
// nsWindowBase
|
||||
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
|
||||
mozilla::LayoutDeviceIntPoint* aPoint = nullptr) override;
|
||||
LayoutDeviceIntPoint* aPoint = nullptr) override;
|
||||
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) override;
|
||||
virtual bool DispatchKeyboardEvent(mozilla::WidgetKeyboardEvent* aEvent) override;
|
||||
virtual bool DispatchWheelEvent(mozilla::WidgetWheelEvent* aEvent) override;
|
||||
@@ -116,12 +116,12 @@ public:
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
virtual bool IsEnabled() const;
|
||||
NS_IMETHOD SetFocus(bool aRaise);
|
||||
NS_IMETHOD GetBoundsUntyped(nsIntRect &aRect);
|
||||
NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect);
|
||||
NS_IMETHOD GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect);
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
void SetBackgroundColor(const nscolor &aColor);
|
||||
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
|
||||
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
void SetBackgroundColor(const nscolor& aColor);
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
uint32_t aHotspotX, uint32_t aHotspotY);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
@@ -137,8 +137,8 @@ public:
|
||||
virtual void FreeNativeData(void * data, uint32_t aDataType);
|
||||
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
||||
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
virtual mozilla::LayoutDeviceIntSize ClientToWindowSize(const mozilla::LayoutDeviceIntSize& aClientSize) override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset();
|
||||
virtual LayoutDeviceIntSize ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
|
||||
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
||||
nsEventStatus& aStatus);
|
||||
NS_IMETHOD EnableDragDrop(bool aEnable);
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
||||
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
||||
bool* aAllowRetaining = nullptr);
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const mozilla::LayoutDeviceIntRect& aButtonRect) override;
|
||||
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override;
|
||||
NS_IMETHOD OverrideSystemMouseScrollSpeed(double aOriginalDeltaX,
|
||||
double aOriginalDeltaY,
|
||||
double& aOverriddenDeltaX,
|
||||
@@ -163,16 +163,16 @@ public:
|
||||
const nsAString& aCharacters,
|
||||
const nsAString& aUnmodifiedCharacters,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
uint32_t aModifierFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
||||
nsIObserver* aObserver) override
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0, aObserver); }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
||||
uint32_t aNativeMessage,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
@@ -190,10 +190,8 @@ public:
|
||||
virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion);
|
||||
#endif // MOZ_XUL
|
||||
virtual nsIMEUpdatePreference GetIMEUpdatePreference();
|
||||
NS_IMETHOD GetNonClientMargins(
|
||||
mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
NS_IMETHOD SetNonClientMargins(
|
||||
mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
NS_IMETHOD GetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
void SetDrawsInTitlebar(bool aState);
|
||||
already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
|
||||
virtual void EndRemoteDrawing() override;
|
||||
@@ -511,11 +509,11 @@ protected:
|
||||
|
||||
// Non-client margin settings
|
||||
// Pre-calculated outward offset applied to default frames
|
||||
mozilla::LayoutDeviceIntMargin mNonClientOffset;
|
||||
LayoutDeviceIntMargin mNonClientOffset;
|
||||
// Margins set by the owner
|
||||
mozilla::LayoutDeviceIntMargin mNonClientMargins;
|
||||
LayoutDeviceIntMargin mNonClientMargins;
|
||||
// Margins we'd like to set once chrome is reshown:
|
||||
mozilla::LayoutDeviceIntMargin mFutureMarginsOnceChromeShows;
|
||||
LayoutDeviceIntMargin mFutureMarginsOnceChromeShows;
|
||||
// Indicates we need to apply margins once toggling chrome into showing:
|
||||
bool mFutureMarginsToUse;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
* @param aPoint message position in physical coordinates.
|
||||
*/
|
||||
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
|
||||
mozilla::LayoutDeviceIntPoint* aPoint = nullptr) = 0;
|
||||
LayoutDeviceIntPoint* aPoint = nullptr) = 0;
|
||||
|
||||
/*
|
||||
* Dispatch a gecko event for this widget.
|
||||
|
||||
Reference in New Issue
Block a user