mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team.
This commit is contained in:
commit
72c9423622
@ -23,11 +23,11 @@
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "nsView.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
@ -141,7 +141,7 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
nsIContent* aContent, nsIFrame* aFrame,
|
||||
nsIPresShell* aPresShell, nsIWidget* aRootWidget)
|
||||
{
|
||||
if (!nsDOMTouchEvent::PrefEnabled())
|
||||
if (!dom::TouchEvent::PrefEnabled())
|
||||
return;
|
||||
|
||||
WidgetTouchEvent event(true, aEventType, aRootWidget);
|
||||
@ -149,9 +149,8 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
// XXX: Touch has an identifier of -1 to hint that it is synthesized.
|
||||
nsRefPtr<mozilla::dom::Touch> t =
|
||||
new mozilla::dom::Touch(-1, nsIntPoint(aX, aY),
|
||||
nsIntPoint(1, 1), 0.0f, 1.0f);
|
||||
nsRefPtr<dom::Touch> t = new dom::Touch(-1, nsIntPoint(aX, aY),
|
||||
nsIntPoint(1, 1), 0.0f, 1.0f);
|
||||
t->SetTarget(aContent);
|
||||
event.touches.AppendElement(t);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -933,7 +933,6 @@ Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
|
||||
if (canvasFrame) {
|
||||
*aBoundingFrame = canvasFrame;
|
||||
|
||||
nsPresContext* presContext = mDoc->PresContext();
|
||||
aTotalBounds = *hitRegionRect;
|
||||
|
||||
return;
|
||||
|
@ -1791,7 +1791,6 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
|
||||
return NS_OK;
|
||||
|
||||
int32_t startHTOffset = 0, endHTOffset = 0;
|
||||
nsresult rv = NS_OK;
|
||||
for (int32_t idx = 0; idx < rangeCount; idx++) {
|
||||
nsRange* range = domSel->GetRangeAt(idx);
|
||||
if (range->Collapsed())
|
||||
|
@ -19,13 +19,13 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -19,13 +19,13 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"branch": "",
|
||||
"revision": ""
|
||||
},
|
||||
"revision": "46003c7d6ba57fee31542ad22656334a34d4d8ef",
|
||||
"revision": "d0ed050535c3a5337c09c0de720de78954a42f31",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,12 +17,12 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -19,12 +19,12 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
|
||||
|
@ -17,12 +17,12 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -17,12 +17,12 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3e9005ca10de70f6a55cf52c87a8b96937acd481"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a980b8f54956ed470667033630b02492efdf4a07"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
@ -533,7 +533,7 @@ class Automation(object):
|
||||
# will otherwise lead to OOM conditions on the current test slaves.
|
||||
if totalMemory <= 1024 * 1024 * 4:
|
||||
self.log.info("INFO | automation.py | ASan running in low-memory configuration")
|
||||
env["ASAN_OPTIONS"] = "quarantine_size=50331648"
|
||||
env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5"
|
||||
else:
|
||||
self.log.info("INFO | automation.py | ASan running in default memory configuration")
|
||||
except OSError,err:
|
||||
|
@ -479,7 +479,7 @@ def environment(xrePath, env=None, crashreporter=True, debugger=False, dmdPath=N
|
||||
message = "INFO | runtests.py | ASan running in %s configuration"
|
||||
if totalMemory <= 1024 * 1024 * 4:
|
||||
message = message % 'low-memory'
|
||||
env["ASAN_OPTIONS"] = "quarantine_size=50331648"
|
||||
env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5"
|
||||
else:
|
||||
message = message % 'default memory'
|
||||
except OSError,err:
|
||||
|
@ -32,7 +32,6 @@ class nsCSSStyleSheet;
|
||||
class nsIDocShell;
|
||||
class nsDocShell;
|
||||
class nsDOMNavigationTiming;
|
||||
class nsDOMTouchList;
|
||||
class nsEventStates;
|
||||
class nsFrameLoader;
|
||||
class nsHTMLCSSStyleSheet;
|
||||
@ -113,6 +112,7 @@ class NodeFilter;
|
||||
class NodeIterator;
|
||||
class ProcessingInstruction;
|
||||
class Touch;
|
||||
class TouchList;
|
||||
class TreeWalker;
|
||||
class UndoManager;
|
||||
class XPathEvaluator;
|
||||
@ -2200,11 +2200,11 @@ public:
|
||||
int32_t aScreenX, int32_t aScreenY, int32_t aClientX,
|
||||
int32_t aClientY, int32_t aRadiusX, int32_t aRadiusY,
|
||||
float aRotationAngle, float aForce);
|
||||
already_AddRefed<nsDOMTouchList> CreateTouchList();
|
||||
already_AddRefed<nsDOMTouchList>
|
||||
already_AddRefed<mozilla::dom::TouchList> CreateTouchList();
|
||||
already_AddRefed<mozilla::dom::TouchList>
|
||||
CreateTouchList(mozilla::dom::Touch& aTouch,
|
||||
const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
|
||||
already_AddRefed<nsDOMTouchList>
|
||||
already_AddRefed<mozilla::dom::TouchList>
|
||||
CreateTouchList(const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
|
||||
|
||||
void SetStyleSheetChangeEventsEnabled(bool aValue)
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "mozilla/dom/HTMLContentElement.h"
|
||||
#include "mozilla/dom/TextDecoder.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
@ -70,7 +71,6 @@
|
||||
#include "mozilla/dom/DataTransfer.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
@ -179,8 +179,8 @@
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "mozilla/dom/SVGElementBinding.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
||||
@ -10013,18 +10013,18 @@ nsIDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
return touch.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMTouchList>
|
||||
already_AddRefed<TouchList>
|
||||
nsIDocument::CreateTouchList()
|
||||
{
|
||||
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
|
||||
nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
|
||||
return retval.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMTouchList>
|
||||
already_AddRefed<TouchList>
|
||||
nsIDocument::CreateTouchList(Touch& aTouch,
|
||||
const Sequence<OwningNonNull<Touch> >& aTouches)
|
||||
{
|
||||
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
|
||||
nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
|
||||
retval->Append(&aTouch);
|
||||
for (uint32_t i = 0; i < aTouches.Length(); ++i) {
|
||||
retval->Append(aTouches[i].get());
|
||||
@ -10032,10 +10032,10 @@ nsIDocument::CreateTouchList(Touch& aTouch,
|
||||
return retval.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMTouchList>
|
||||
already_AddRefed<TouchList>
|
||||
nsIDocument::CreateTouchList(const Sequence<OwningNonNull<Touch> >& aTouches)
|
||||
{
|
||||
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this));
|
||||
nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
|
||||
for (uint32_t i = 0; i < aTouches.Length(); ++i) {
|
||||
retval->Append(aTouches[i].get());
|
||||
}
|
||||
|
@ -97,9 +97,9 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
#include "imgIContainer.h"
|
||||
@ -1955,7 +1955,7 @@ nsGenericHTMLElement::SetUndoScopeInternal(bool aUndoScope)
|
||||
bool
|
||||
nsGenericHTMLElement::TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */)
|
||||
{
|
||||
return nsDOMTouchEvent::PrefEnabled();
|
||||
return TouchEvent::PrefEnabled();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -268,8 +268,8 @@ protected:
|
||||
TrackTicks aStart, TrackTicks aEnd)
|
||||
{
|
||||
NS_ASSERTION(aStart <= aEnd, "Endpoints inverted");
|
||||
NS_ASSERTION(aStart >= 0 && aEnd <= aSource.mDuration,
|
||||
"Slice out of range");
|
||||
NS_WARN_IF_FALSE(aStart >= 0 && aEnd <= aSource.mDuration,
|
||||
"Slice out of range");
|
||||
mDuration += aEnd - aStart;
|
||||
TrackTicks offset = 0;
|
||||
for (uint32_t i = 0; i < aSource.mChunks.Length() && offset < aEnd; ++i) {
|
||||
|
@ -1239,9 +1239,9 @@ MediaStreamGraphImpl::RunThread()
|
||||
} else {
|
||||
ps->ProduceOutput(prevComputedTime, mStateComputedTime,
|
||||
ProcessedMediaStream::ALLOW_FINISH);
|
||||
NS_ASSERTION(stream->mBuffer.GetEnd() >=
|
||||
GraphTimeToStreamTime(stream, mStateComputedTime),
|
||||
"Stream did not produce enough data");
|
||||
NS_WARN_IF_FALSE(stream->mBuffer.GetEnd() >=
|
||||
GraphTimeToStreamTime(stream, mStateComputedTime),
|
||||
"Stream did not produce enough data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ inline StreamTime TicksToTimeRound(TrackRate aRate, TrackTicks aTicks)
|
||||
inline StreamTime TicksToTimeRoundDown(TrackRate aRate, TrackTicks aTicks)
|
||||
{
|
||||
NS_ASSERTION(0 < aRate && aRate <= TRACK_RATE_MAX, "Bad rate");
|
||||
NS_ASSERTION(0 <= aTicks && aTicks <= TRACK_TICKS_MAX, "Bad samples");
|
||||
NS_WARN_IF_FALSE(0 <= aTicks && aTicks <= TRACK_TICKS_MAX, "Bad samples");
|
||||
return (aTicks << MEDIA_TIME_FRAC_BITS)/aRate;
|
||||
}
|
||||
|
||||
|
@ -249,8 +249,8 @@ protected:
|
||||
StreamTime outputEnd = GraphTimeToStreamTime(interval.mEnd);
|
||||
TrackTicks startTicks = outputTrack->GetEnd();
|
||||
StreamTime outputStart = GraphTimeToStreamTime(interval.mStart);
|
||||
NS_ASSERTION(startTicks == TimeToTicksRoundUp(rate, outputStart),
|
||||
"Samples missing");
|
||||
NS_WARN_IF_FALSE(startTicks == TimeToTicksRoundUp(rate, outputStart),
|
||||
"Samples missing");
|
||||
TrackTicks endTicks = TimeToTicksRoundUp(rate, outputEnd);
|
||||
TrackTicks ticks = endTicks - startTicks;
|
||||
StreamTime inputStart = source->GraphTimeToStreamTime(interval.mStart);
|
||||
|
@ -20,8 +20,8 @@ namespace dom {
|
||||
SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetGUIEvent(false, NS_SVG_ZOOM, 0))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetGUIEvent(false, NS_SVG_ZOOM, 0))
|
||||
, mPreviousScale(0)
|
||||
, mNewScale(0)
|
||||
{
|
||||
|
@ -6,11 +6,11 @@
|
||||
#ifndef mozilla_dom_SVGZoomEvent_h
|
||||
#define mozilla_dom_SVGZoomEvent_h
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "DOMSVGPoint.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/SVGZoomEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
@ -20,14 +20,14 @@ class nsISVGPoint;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class SVGZoomEvent MOZ_FINAL : public nsDOMUIEvent
|
||||
class SVGZoomEvent MOZ_FINAL : public UIEvent
|
||||
{
|
||||
public:
|
||||
SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent);
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
@ -136,7 +136,7 @@
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsIMessageManager.h"
|
||||
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "mozilla/dom/HTMLCollectionBinding.h"
|
||||
@ -868,7 +868,7 @@ nsDOMClassInfo::RegisterExternalClasses()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) \
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
||||
nsDOMTouchEvent::PrefEnabled())
|
||||
TouchEvent::PrefEnabled())
|
||||
#else // !MOZ_B2G
|
||||
#define DOM_CLASSINFO_WINDOW_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) \
|
||||
@ -878,7 +878,7 @@ nsDOMClassInfo::RegisterExternalClasses()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) \
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
||||
nsDOMTouchEvent::PrefEnabled())
|
||||
TouchEvent::PrefEnabled())
|
||||
#endif // MOZ_B2G
|
||||
|
||||
nsresult
|
||||
|
@ -64,7 +64,8 @@ DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \
|
||||
/* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \
|
||||
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent, \
|
||||
nsDOMEventBase, 10, _extra) \
|
||||
DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra) \
|
||||
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::UIEvent, \
|
||||
nsDOMEventBase, 11, _extra) \
|
||||
DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra)
|
||||
|
||||
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
|
||||
@ -79,6 +80,7 @@ namespace dom {
|
||||
class Element;
|
||||
class EventTarget;
|
||||
class MouseEvent;
|
||||
class UIEvent;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -721,19 +721,8 @@ static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
|
||||
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
|
||||
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
|
||||
#endif
|
||||
static const char js_typeinfer_content_str[] = JS_OPTIONS_DOT_STR "typeinference.content";
|
||||
static const char js_typeinfer_chrome_str[] = JS_OPTIONS_DOT_STR "typeinference.chrome";
|
||||
static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log";
|
||||
static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify";
|
||||
static const char js_asmjs_content_str[] = JS_OPTIONS_DOT_STR "asmjs";
|
||||
static const char js_baselinejit_content_str[] = JS_OPTIONS_DOT_STR "baselinejit.content";
|
||||
static const char js_baselinejit_chrome_str[] = JS_OPTIONS_DOT_STR "baselinejit.chrome";
|
||||
static const char js_baselinejit_eager_str[] = JS_OPTIONS_DOT_STR "baselinejit.unsafe_eager_compilation";
|
||||
static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content";
|
||||
static const char js_ion_chrome_str[] = JS_OPTIONS_DOT_STR "ion.chrome";
|
||||
static const char js_ion_eager_str[] = JS_OPTIONS_DOT_STR "ion.unsafe_eager_compilation";
|
||||
static const char js_parallel_parsing_str[] = JS_OPTIONS_DOT_STR "parallel_parsing";
|
||||
static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation";
|
||||
|
||||
void
|
||||
nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
@ -756,39 +745,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
nsCOMPtr<nsIDOMWindow> contentWindow(do_QueryInterface(global));
|
||||
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
|
||||
|
||||
bool useTypeInference = Preferences::GetBool((chromeWindow || !contentWindow) ?
|
||||
js_typeinfer_chrome_str :
|
||||
js_typeinfer_content_str);
|
||||
bool useBaselineJIT = Preferences::GetBool((chromeWindow || !contentWindow) ?
|
||||
js_baselinejit_chrome_str :
|
||||
js_baselinejit_content_str);
|
||||
bool useBaselineJITEager = Preferences::GetBool(js_baselinejit_eager_str);
|
||||
bool useIon = Preferences::GetBool((chromeWindow || !contentWindow) ?
|
||||
js_ion_chrome_str :
|
||||
js_ion_content_str);
|
||||
bool useIonEager = Preferences::GetBool(js_ion_eager_str);
|
||||
bool useAsmJS = Preferences::GetBool(js_asmjs_content_str);
|
||||
bool parallelParsing = Preferences::GetBool(js_parallel_parsing_str);
|
||||
bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str);
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
|
||||
if (xr) {
|
||||
bool safeMode = false;
|
||||
xr->GetInSafeMode(&safeMode);
|
||||
if (safeMode) {
|
||||
useTypeInference = false;
|
||||
useBaselineJIT = false;
|
||||
useBaselineJITEager = false;
|
||||
useIon = false;
|
||||
useIonEager = false;
|
||||
useAsmJS = false;
|
||||
}
|
||||
}
|
||||
|
||||
JS::ContextOptionsRef(cx).setTypeInference(useTypeInference)
|
||||
.setBaseline(useBaselineJIT)
|
||||
.setIon(useIon)
|
||||
.setAsmJS(useAsmJS);
|
||||
|
||||
#ifdef DEBUG
|
||||
// In debug builds, warnings are enabled in chrome context if
|
||||
// javascript.options.strict.debug is true
|
||||
@ -800,15 +756,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
|
||||
JS::ContextOptionsRef(cx).setWerror(Preferences::GetBool(js_werror_option_str));
|
||||
|
||||
::JS_SetParallelParsingEnabled(context->mContext, parallelParsing);
|
||||
::JS_SetParallelIonCompilationEnabled(context->mContext, parallelIonCompilation);
|
||||
|
||||
::JS_SetGlobalJitCompilerOption(context->mContext, JSJITCOMPILER_BASELINE_USECOUNT_TRIGGER,
|
||||
(useBaselineJITEager ? 0 : -1));
|
||||
|
||||
::JS_SetGlobalJitCompilerOption(context->mContext, JSJITCOMPILER_ION_USECOUNT_TRIGGER,
|
||||
(useIonEager ? 0 : -1));
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
int32_t zeal = Preferences::GetInt(js_zeal_option_str, -1);
|
||||
int32_t frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);
|
||||
|
@ -340,10 +340,11 @@ public:
|
||||
// keep the same document active but create a new window.
|
||||
bool HasActiveDocument()
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
return IsCurrentInnerWindow() ||
|
||||
(GetOuterWindow() &&
|
||||
GetOuterWindow()->GetCurrentInnerWindow() &&
|
||||
GetOuterWindow()->GetCurrentInnerWindow()->GetDoc() == mDoc);
|
||||
(mOuterWindow &&
|
||||
mOuterWindow->GetCurrentInnerWindow() &&
|
||||
mOuterWindow->GetCurrentInnerWindow()->GetDoc() == mDoc);
|
||||
}
|
||||
|
||||
bool IsOuterWindow() const
|
||||
|
@ -222,64 +222,6 @@ nsScreen::GetLockOrientationPermission() const
|
||||
return doc->MozFullScreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreen::MozLockOrientation(JS::Handle<JS::Value> aOrientation, JSContext* aCx,
|
||||
bool* aReturn)
|
||||
{
|
||||
if (aOrientation.isObject()) {
|
||||
JS::Rooted<JSObject*> seq(aCx, &aOrientation.toObject());
|
||||
if (IsArrayLike(aCx, seq)) {
|
||||
uint32_t length;
|
||||
// JS_GetArrayLength actually works on all objects
|
||||
if (!JS_GetArrayLength(aCx, seq, &length)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Sequence<nsString> orientations;
|
||||
if (!orientations.SetCapacity(length)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> temp(aCx);
|
||||
if (!JS_GetElement(aCx, seq, i, &temp)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, temp));
|
||||
if (!jsString) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsDependentJSString str;
|
||||
if (!str.init(aCx, jsString)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*orientations.AppendElement() = str;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
*aReturn = MozLockOrientation(orientations, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, aOrientation));
|
||||
if (!jsString) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsDependentJSString orientation;
|
||||
if (!orientation.init(aCx, jsString)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
*aReturn = MozLockOrientation(orientation, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
bool
|
||||
nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv)
|
||||
{
|
||||
@ -365,13 +307,6 @@ nsScreen::MozUnlockOrientation()
|
||||
hal::UnlockScreenOrientation();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreen::SlowMozUnlockOrientation()
|
||||
{
|
||||
MozUnlockOrientation();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsScreen::IsDeviceSizePageSize()
|
||||
{
|
||||
|
@ -263,12 +263,6 @@ IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> obj)
|
||||
return !JS_ObjectIsDate(cx, obj) && !JS_ObjectIsRegExp(cx, obj);
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
IsArrayLike(JSContext* cx, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
return IsNotDateOrRegExp(cx, obj);
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
IsObjectValueConvertibleToDictionary(JSContext* cx,
|
||||
JS::Handle<JS::Value> objVal)
|
||||
|
@ -97,10 +97,6 @@ DOMInterfaces = {
|
||||
'concrete': False
|
||||
},
|
||||
|
||||
'AnimationEvent': {
|
||||
'nativeType': 'mozilla::dom::AnimationEvent',
|
||||
},
|
||||
|
||||
'ArchiveReader': {
|
||||
'nativeType': 'mozilla::dom::file::ArchiveReader',
|
||||
},
|
||||
@ -140,10 +136,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'inputBuffer', 'outputBuffer' ],
|
||||
},
|
||||
|
||||
'BeforeUnloadEvent': {
|
||||
'nativeType': 'mozilla::dom::BeforeUnloadEvent',
|
||||
},
|
||||
|
||||
'BarProp': {
|
||||
'headerFile': 'mozilla/dom/BarProps.h',
|
||||
},
|
||||
@ -233,18 +225,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'item' ]
|
||||
},
|
||||
|
||||
'ClipboardEvent': {
|
||||
'nativeType': 'mozilla::dom::ClipboardEvent',
|
||||
},
|
||||
|
||||
'CommandEvent': {
|
||||
'nativeType': 'mozilla::dom::CommandEvent',
|
||||
},
|
||||
|
||||
'CompositionEvent': {
|
||||
'nativeType': 'mozilla::dom::CompositionEvent',
|
||||
},
|
||||
|
||||
'Console': {
|
||||
'implicitJSContext': [ 'trace', 'time', 'timeEnd' ],
|
||||
},
|
||||
@ -303,10 +283,6 @@ DOMInterfaces = {
|
||||
'nativeType': 'nsDOMDataChannel',
|
||||
},
|
||||
|
||||
'DataContainerEvent': {
|
||||
'nativeType': 'mozilla::dom::DataContainerEvent',
|
||||
},
|
||||
|
||||
'DedicatedWorkerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'workers': True,
|
||||
@ -852,14 +828,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'item' ]
|
||||
},
|
||||
|
||||
'NotifyPaintEvent': {
|
||||
'nativeType': 'nsDOMNotifyPaintEvent',
|
||||
},
|
||||
|
||||
'NotifyAudioAvailableEvent': {
|
||||
'nativeType': 'nsDOMNotifyAudioAvailableEvent',
|
||||
},
|
||||
|
||||
'OfflineAudioCompletionEvent': {
|
||||
'resultNotAddRefed': [ 'renderedBuffer' ],
|
||||
},
|
||||
@ -958,10 +926,6 @@ DOMInterfaces = {
|
||||
'nativeType': 'nsScreen',
|
||||
},
|
||||
|
||||
'ScrollAreaEvent': {
|
||||
'nativeType': 'nsDOMScrollAreaEvent',
|
||||
},
|
||||
|
||||
'Selection': {
|
||||
'nativeType': 'mozilla::Selection',
|
||||
'resultNotAddRefed': [ 'anchorNode', 'focusNode', 'getRangeAt' ],
|
||||
@ -1247,25 +1211,12 @@ DOMInterfaces = {
|
||||
'nativeOwnership': 'owned',
|
||||
},
|
||||
|
||||
'TimeEvent': {
|
||||
'nativeType': 'nsDOMTimeEvent',
|
||||
},
|
||||
|
||||
'TimeRanges': {
|
||||
'wrapperCache': False
|
||||
},
|
||||
|
||||
'TouchEvent': {
|
||||
'nativeType': 'nsDOMTouchEvent',
|
||||
},
|
||||
|
||||
'TouchList': {
|
||||
'nativeType': 'nsDOMTouchList',
|
||||
'headerFile': 'nsDOMTouchEvent.h',
|
||||
},
|
||||
|
||||
'TransitionEvent': {
|
||||
'nativeType': 'nsDOMTransitionEvent',
|
||||
'headerFile': 'mozilla/dom/TouchEvent.h',
|
||||
},
|
||||
|
||||
'TreeColumns': {
|
||||
@ -1277,10 +1228,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'root', 'currentNode' ],
|
||||
},
|
||||
|
||||
'UIEvent': {
|
||||
'nativeType': 'nsDOMUIEvent',
|
||||
},
|
||||
|
||||
'UndoManager': {
|
||||
'implicitJSContext' : [ 'undo', 'redo', 'transact' ],
|
||||
},
|
||||
@ -1478,10 +1425,6 @@ DOMInterfaces = {
|
||||
'headerFile': 'WebSocket.h',
|
||||
},
|
||||
|
||||
'WheelEvent': {
|
||||
'nativeType': 'mozilla::dom::WheelEvent',
|
||||
},
|
||||
|
||||
'Window': {
|
||||
'nativeType': 'nsGlobalWindow',
|
||||
# When turning on Window, remember to drop the "'register': False"
|
||||
@ -1579,10 +1522,6 @@ DOMInterfaces = {
|
||||
'headerFile': 'XULDocument.h'
|
||||
},
|
||||
|
||||
'XULCommandEvent': {
|
||||
'nativeType': 'nsDOMXULCommandEvent',
|
||||
},
|
||||
|
||||
'XULElement': {
|
||||
'nativeType': 'nsXULElement',
|
||||
'resultNotAddRefed': [ 'controllers', 'style' ]
|
||||
|
@ -3105,31 +3105,35 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||
arrayRef = "${declName}"
|
||||
|
||||
# NOTE: Keep this in sync with variadic conversions as needed
|
||||
templateBody = ("""JS::Rooted<JSObject*> seq(cx, &${val}.toObject());\n
|
||||
if (!IsArrayLike(cx, seq)) {
|
||||
templateBody = ("""JS::ForOfIterator iter(cx);
|
||||
if (!iter.init(${val}, JS::ForOfIterator::AllowNonIterable)) {
|
||||
%s
|
||||
}
|
||||
uint32_t length;
|
||||
// JS_GetArrayLength actually works on all objects
|
||||
if (!JS_GetArrayLength(cx, seq, &length)) {
|
||||
if (!iter.valueIsIterable()) {
|
||||
%s
|
||||
}
|
||||
%s &arr = %s;
|
||||
if (!arr.SetCapacity(length)) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
%s
|
||||
}
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> temp(cx);
|
||||
if (!JS_GetElement(cx, seq, i, &temp)) {
|
||||
JS::Rooted<JS::Value> temp(cx);
|
||||
while (true) {
|
||||
bool done;
|
||||
if (!iter.next(&temp, &done)) {
|
||||
%s
|
||||
}
|
||||
%s& slot = *arr.AppendElement();
|
||||
""" % (CGIndenter(CGGeneric(notSequence)).define(),
|
||||
exceptionCodeIndented.define(),
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
%s* slotPtr = arr.AppendElement();
|
||||
if (!slotPtr) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
%s
|
||||
}
|
||||
%s& slot = *slotPtr;
|
||||
""" % (exceptionCodeIndented.define(),
|
||||
CGIndenter(CGGeneric(notSequence)).define(),
|
||||
sequenceType,
|
||||
arrayRef,
|
||||
exceptionCodeIndented.define(),
|
||||
CGIndenter(exceptionCodeIndented).define(),
|
||||
elementInfo.declType.define(),
|
||||
CGIndenter(exceptionCodeIndented).define(),
|
||||
elementInfo.declType.define()))
|
||||
|
||||
@ -3196,12 +3200,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
|
||||
arrayObjectMemberTypes = filter(lambda t: t.isArray() or t.isSequence(), memberTypes)
|
||||
if len(arrayObjectMemberTypes) > 0:
|
||||
assert len(arrayObjectMemberTypes) == 1
|
||||
memberType = arrayObjectMemberTypes[0]
|
||||
name = memberType.name
|
||||
arrayObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${val}, ${mutableVal}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
||||
arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, argObj)")
|
||||
names.append(name)
|
||||
raise TypeError("Bug 767924: We don't support sequences in unions yet")
|
||||
else:
|
||||
arrayObject = None
|
||||
|
||||
|
@ -36,7 +36,6 @@ using namespace mozilla::dom;
|
||||
using namespace mozilla::idl;
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaStream)
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
|
||||
@ -44,53 +43,25 @@ NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMCameraControl)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCapabilities)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGetCameraOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGetCameraOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAutoFocusOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAutoFocusOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTakePictureOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTakePictureOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStartRecordingOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStartRecordingOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReleaseOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReleaseOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSetConfigurationOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSetConfigurationOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnShutterCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnClosedCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnRecorderStateChangeCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnPreviewStateChangeCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCapabilities)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGetCameraOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGetCameraOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAutoFocusOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAutoFocusOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTakePictureOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTakePictureOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStartRecordingOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStartRecordingOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReleaseOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReleaseOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSetConfigurationOnSuccessCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSetConfigurationOnErrorCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnShutterCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnClosedCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnRecorderStateChangeCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnPreviewStateChangeCb)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsDOMCameraControl)
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_18(nsDOMCameraControl, DOMMediaStream,
|
||||
mCapabilities,
|
||||
mWindow,
|
||||
mGetCameraOnSuccessCb,
|
||||
mGetCameraOnErrorCb,
|
||||
mAutoFocusOnSuccessCb,
|
||||
mAutoFocusOnErrorCb,
|
||||
mTakePictureOnSuccessCb,
|
||||
mTakePictureOnErrorCb,
|
||||
mStartRecordingOnSuccessCb,
|
||||
mStartRecordingOnErrorCb,
|
||||
mReleaseOnSuccessCb,
|
||||
mReleaseOnErrorCb,
|
||||
mSetConfigurationOnSuccessCb,
|
||||
mSetConfigurationOnErrorCb,
|
||||
mOnShutterCb,
|
||||
mOnClosedCb,
|
||||
mOnRecorderStateChangeCb,
|
||||
mOnPreviewStateChangeCb)
|
||||
|
||||
class mozilla::StartRecordingHelper : public nsIDOMEventListener
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ class StartRecordingHelper;
|
||||
class nsDOMCameraControl MOZ_FINAL : public DOMMediaStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsDOMCameraControl(uint32_t aCameraId,
|
||||
|
@ -681,12 +681,15 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function() {
|
||||
ok(true, "Test setting array properties to scalar values")
|
||||
ok(true, "Test that after setting array properties to scalar values the property os not a non-array")
|
||||
const FIELDS = ["email","url","adr","tel","impp"];
|
||||
createResult1 = new mozContact();
|
||||
for (var prop of FIELDS) {
|
||||
createResult1[prop] = {type: ["foo"]};
|
||||
ok(Array.isArray(createResult1[prop]), prop + " is array");
|
||||
try {
|
||||
createResult1[prop] = {type: ["foo"]};
|
||||
} catch (e) {}
|
||||
ok(createResult1[prop] === null ||
|
||||
Array.isArray(createResult1[prop]), prop + " is array");
|
||||
}
|
||||
next();
|
||||
},
|
||||
|
@ -14,8 +14,8 @@ namespace dom {
|
||||
CompositionEvent::CompositionEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetCompositionEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetCompositionEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetCompositionEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
|
||||
"event type mismatch");
|
||||
@ -36,12 +36,12 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
|
||||
// TODO: Native event should have locale information.
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(CompositionEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(CompositionEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(CompositionEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(CompositionEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(CompositionEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CompositionEvent::GetData(nsAString& aData)
|
||||
@ -65,8 +65,7 @@ CompositionEvent::InitCompositionEvent(const nsAString& aType,
|
||||
const nsAString& aData,
|
||||
const nsAString& aLocale)
|
||||
{
|
||||
nsresult rv =
|
||||
nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mData = aData;
|
||||
|
@ -7,15 +7,15 @@
|
||||
#ifndef mozilla_dom_CompositionEvent_h_
|
||||
#define mozilla_dom_CompositionEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
#include "mozilla/dom/CompositionEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CompositionEvent : public nsDOMUIEvent,
|
||||
class CompositionEvent : public UIEvent,
|
||||
public nsIDOMCompositionEvent
|
||||
{
|
||||
public:
|
||||
@ -24,7 +24,7 @@ public:
|
||||
WidgetCompositionEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
NS_DECL_NSIDOMCOMPOSITIONEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
|
@ -320,7 +320,7 @@ NS_IMETHODIMP
|
||||
DataTransfer::GetFiles(nsIDOMFileList** aFileList)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aFileList = GetFiles(rv);
|
||||
NS_IF_ADDREF(*aFileList = GetFiles(rv));
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,6 @@ DragEvent::InitDragEvent(const nsAString& aType,
|
||||
nsIDOMDataTransfer* aDataTransfer)
|
||||
{
|
||||
nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer);
|
||||
NS_ENSURE_ARG(dataTransfer);
|
||||
|
||||
nsresult rv =
|
||||
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
|
||||
|
@ -10,14 +10,13 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, nsDOMUIEvent, nsIDOMFocusEvent)
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, UIEvent, nsIDOMFocusEvent)
|
||||
|
||||
FocusEvent::FocusEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalFocusEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent :
|
||||
new InternalFocusEvent(false, NS_FOCUS_CONTENT))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalFocusEvent(false, NS_FOCUS_CONTENT))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
@ -50,7 +49,8 @@ FocusEvent::InitFocusEvent(const nsAString& aType,
|
||||
int32_t aDetail,
|
||||
EventTarget* aRelatedTarget)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv =
|
||||
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget;
|
||||
return NS_OK;
|
||||
|
@ -5,15 +5,15 @@
|
||||
#ifndef mozilla_dom_FocusEvent_h_
|
||||
#define mozilla_dom_FocusEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMFocusEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/FocusEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMFocusEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class FocusEvent : public nsDOMUIEvent,
|
||||
class FocusEvent : public UIEvent,
|
||||
public nsIDOMFocusEvent
|
||||
{
|
||||
public:
|
||||
@ -21,7 +21,7 @@ public:
|
||||
NS_DECL_NSIDOMFOCUSEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
@ -13,8 +13,8 @@ namespace dom {
|
||||
KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetKeyboardEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetKeyboardEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch");
|
||||
|
||||
@ -28,12 +28,12 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(KeyboardEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(KeyboardEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(KeyboardEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
bool
|
||||
KeyboardEvent::AltKey()
|
||||
@ -212,7 +212,7 @@ KeyboardEvent::InitKeyEvent(const nsAString& aType,
|
||||
uint32_t aKeyCode,
|
||||
uint32_t aCharCode)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
|
||||
|
@ -6,15 +6,15 @@
|
||||
#ifndef mozilla_dom_KeyboardEvent_h_
|
||||
#define mozilla_dom_KeyboardEvent_h_
|
||||
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/KeyboardEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class KeyboardEvent : public nsDOMUIEvent,
|
||||
class KeyboardEvent : public UIEvent,
|
||||
public nsIDOMKeyEvent
|
||||
{
|
||||
public:
|
||||
@ -28,7 +28,7 @@ public:
|
||||
NS_DECL_NSIDOMKEYEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
@ -15,9 +15,9 @@ namespace dom {
|
||||
MouseEvent::MouseEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetMouseEventBase* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetMouseEvent(false, 0, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetMouseEvent(false, 0, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
{
|
||||
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
|
||||
// It's not that important, though, since a scroll event is not a real
|
||||
@ -41,12 +41,12 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(MouseEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(MouseEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(MouseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
MouseEvent::InitMouseEvent(const nsAString& aType,
|
||||
@ -65,7 +65,8 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
|
||||
uint16_t aButton,
|
||||
nsIDOMEventTarget* aRelatedTarget)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv =
|
||||
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
switch(mEvent->eventStructType) {
|
||||
|
@ -6,15 +6,15 @@
|
||||
#ifndef mozilla_dom_MouseEvent_h_
|
||||
#define mozilla_dom_MouseEvent_h_
|
||||
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/MouseEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class MouseEvent : public nsDOMUIEvent,
|
||||
class MouseEvent : public UIEvent,
|
||||
public nsIDOMMouseEvent
|
||||
{
|
||||
public:
|
||||
@ -28,7 +28,7 @@ public:
|
||||
NS_DECL_NSIDOMMOUSEEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
@ -121,6 +121,6 @@ protected:
|
||||
|
||||
#define NS_FORWARD_TO_MOUSEEVENT \
|
||||
NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
#endif // mozilla_dom_MouseEvent_h_
|
||||
|
182
dom/events/NotifyAudioAvailableEvent.cpp
Normal file
182
dom/events/NotifyAudioAvailableEvent.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/NotifyAudioAvailableEvent.h"
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
#include "nsError.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NotifyAudioAvailableEvent::NotifyAudioAvailableEvent(
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime)
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent)
|
||||
, mFrameBuffer(aFrameBuffer)
|
||||
, mFrameBufferLength(aFrameBufferLength)
|
||||
, mTime(aTime)
|
||||
, mCachedArray(nullptr)
|
||||
, mAllowAudioData(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(NotifyAudioAvailableEvent);
|
||||
if (mEvent) {
|
||||
mEvent->message = aEventType;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(NotifyAudioAvailableEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(NotifyAudioAvailableEvent, nsDOMEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(NotifyAudioAvailableEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(NotifyAudioAvailableEvent,
|
||||
nsDOMEvent)
|
||||
if (tmp->mCachedArray) {
|
||||
tmp->mCachedArray = nullptr;
|
||||
DropJSObjects(tmp);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(NotifyAudioAvailableEvent,
|
||||
nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(NotifyAudioAvailableEvent,
|
||||
nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCachedArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(NotifyAudioAvailableEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyAudioAvailableEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NotifyAudioAvailableEvent::~NotifyAudioAvailableEvent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(NotifyAudioAvailableEvent);
|
||||
if (mCachedArray) {
|
||||
mCachedArray = nullptr;
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aResult)
|
||||
{
|
||||
if (!mAllowAudioData) {
|
||||
// Media is not same-origin, don't allow the data out.
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
if (mCachedArray) {
|
||||
aResult.setObject(*mCachedArray);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Cache this array so we don't recreate on next call.
|
||||
mozilla::HoldJSObjects(this);
|
||||
|
||||
mCachedArray = JS_NewFloat32Array(aCx, mFrameBufferLength);
|
||||
if (!mCachedArray) {
|
||||
mozilla::DropJSObjects(this);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(),
|
||||
mFrameBufferLength * sizeof(float));
|
||||
|
||||
aResult.setObject(*mCachedArray);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NotifyAudioAvailableEvent::GetTime(float* aRetVal)
|
||||
{
|
||||
*aRetVal = Time();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime,
|
||||
bool aAllowAudioData)
|
||||
{
|
||||
// Auto manage the memory which stores the frame buffer. This ensures
|
||||
// that if we exit due to some error, the memory will be freed. Otherwise,
|
||||
// the framebuffer's memory will be freed when this event is destroyed.
|
||||
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mFrameBuffer = frameBuffer.forget();
|
||||
mFrameBufferLength = aFrameBufferLength;
|
||||
mTime = aTime;
|
||||
mAllowAudioData = aAllowAudioData;
|
||||
mCachedArray = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
NotifyAudioAvailableEvent::InitAudioAvailableEvent(
|
||||
const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
const Nullable<Sequence<float> >& aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime,
|
||||
bool aAllowAudioData,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if ((aFrameBuffer.IsNull() && aFrameBufferLength > 0) ||
|
||||
(!aFrameBuffer.IsNull() &&
|
||||
aFrameBuffer.Value().Length() < aFrameBufferLength)) {
|
||||
aRv = NS_ERROR_UNEXPECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoArrayPtr<float> buffer;
|
||||
if (!aFrameBuffer.IsNull()) {
|
||||
buffer = new float[aFrameBufferLength];
|
||||
memcpy(buffer.get(), aFrameBuffer.Value().Elements(),
|
||||
aFrameBufferLength * sizeof(float));
|
||||
}
|
||||
|
||||
aRv = InitAudioAvailableEvent(aType, aCanBubble, aCancelable,
|
||||
buffer.forget(),
|
||||
aFrameBufferLength,
|
||||
aTime, aAllowAudioData);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime)
|
||||
{
|
||||
NotifyAudioAvailableEvent* it =
|
||||
new NotifyAudioAvailableEvent(aOwner, aPresContext, aEvent, aEventType,
|
||||
aFrameBuffer, aFrameBufferLength, aTime);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
78
dom/events/NotifyAudioAvailableEvent.h
Normal file
78
dom/events/NotifyAudioAvailableEvent.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_NotifyAudioAvailableEvent_h_
|
||||
#define mozilla_dom_NotifyAudioAvailableEvent_h_
|
||||
|
||||
#include "nsIDOMNotifyAudioAvailableEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class NotifyAudioAvailableEvent : public nsDOMEvent,
|
||||
public nsIDOMNotifyAudioAvailableEvent
|
||||
{
|
||||
public:
|
||||
NotifyAudioAvailableEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
|
||||
NotifyAudioAvailableEvent, nsDOMEvent)
|
||||
|
||||
NS_DECL_NSIDOMNOTIFYAUDIOAVAILABLEEVENT
|
||||
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
|
||||
|
||||
~NotifyAudioAvailableEvent();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
JSObject* GetFrameBuffer(JSContext* aCx, ErrorResult& aRv)
|
||||
{
|
||||
JS::Rooted<JS::Value> dummy(aCx);
|
||||
aRv = GetFrameBuffer(aCx, &dummy);
|
||||
return mCachedArray;
|
||||
}
|
||||
|
||||
float Time()
|
||||
{
|
||||
return mTime;
|
||||
}
|
||||
|
||||
void InitAudioAvailableEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
const Nullable<Sequence<float> >& aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime,
|
||||
bool aAllowAudioData,
|
||||
ErrorResult& aRv);
|
||||
private:
|
||||
nsAutoArrayPtr<float> mFrameBuffer;
|
||||
uint32_t mFrameBufferLength;
|
||||
float mTime;
|
||||
JS::Heap<JSObject*> mCachedArray;
|
||||
bool mAllowAudioData;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_NotifyAudioAvailableEvent_h_
|
@ -5,20 +5,20 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/NotifyPaintEvent.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include "nsDOMNotifyPaintEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPaintRequest.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
if (mEvent) {
|
||||
@ -29,15 +29,15 @@ nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMNotifyPaintEvent)
|
||||
NS_INTERFACE_MAP_BEGIN(NotifyPaintEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyPaintEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMNotifyPaintEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMNotifyPaintEvent, nsDOMEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(NotifyPaintEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(NotifyPaintEvent, nsDOMEvent)
|
||||
|
||||
nsRegion
|
||||
nsDOMNotifyPaintEvent::GetRegion()
|
||||
NotifyPaintEvent::GetRegion()
|
||||
{
|
||||
nsRegion r;
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
@ -51,14 +51,14 @@ nsDOMNotifyPaintEvent::GetRegion()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMNotifyPaintEvent::GetBoundingClientRect(nsIDOMClientRect** aResult)
|
||||
NotifyPaintEvent::GetBoundingClientRect(nsIDOMClientRect** aResult)
|
||||
{
|
||||
*aResult = BoundingClientRect().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRect>
|
||||
nsDOMNotifyPaintEvent::BoundingClientRect()
|
||||
NotifyPaintEvent::BoundingClientRect()
|
||||
{
|
||||
nsRefPtr<DOMRect> rect = new DOMRect(ToSupports(this));
|
||||
|
||||
@ -70,14 +70,14 @@ nsDOMNotifyPaintEvent::BoundingClientRect()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMNotifyPaintEvent::GetClientRects(nsIDOMClientRectList** aResult)
|
||||
NotifyPaintEvent::GetClientRects(nsIDOMClientRectList** aResult)
|
||||
{
|
||||
*aResult = ClientRects().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRectList>
|
||||
nsDOMNotifyPaintEvent::ClientRects()
|
||||
NotifyPaintEvent::ClientRects()
|
||||
{
|
||||
nsISupports* parent = ToSupports(this);
|
||||
nsRefPtr<DOMRectList> rectList = new DOMRectList(parent);
|
||||
@ -95,7 +95,7 @@ nsDOMNotifyPaintEvent::ClientRects()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMNotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
|
||||
NotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
|
||||
{
|
||||
nsRefPtr<nsPaintRequestList> requests = PaintRequests();
|
||||
requests.forget(aResult);
|
||||
@ -103,7 +103,7 @@ nsDOMNotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
|
||||
}
|
||||
|
||||
already_AddRefed<nsPaintRequestList>
|
||||
nsDOMNotifyPaintEvent::PaintRequests()
|
||||
NotifyPaintEvent::PaintRequests()
|
||||
{
|
||||
nsDOMEvent* parent = this;
|
||||
nsRefPtr<nsPaintRequestList> requests = new nsPaintRequestList(parent);
|
||||
@ -120,8 +120,8 @@ nsDOMNotifyPaintEvent::PaintRequests()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
bool aSerializeInterfaceType)
|
||||
NotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
bool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("notifypaintevent"));
|
||||
@ -138,7 +138,7 @@ nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
NotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
|
||||
|
||||
@ -155,16 +155,21 @@ nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
{
|
||||
nsDOMNotifyPaintEvent* it =
|
||||
new nsDOMNotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType,
|
||||
aInvalidateRequests);
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
{
|
||||
NotifyPaintEvent* it = new NotifyPaintEvent(aOwner, aPresContext, aEvent,
|
||||
aEventType, aInvalidateRequests);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMNotifyPaintEvent_h_
|
||||
#define nsDOMNotifyPaintEvent_h_
|
||||
#ifndef mozilla_dom_NotifyPaintEvent_h_
|
||||
#define mozilla_dom_NotifyPaintEvent_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMNotifyPaintEvent.h"
|
||||
@ -16,23 +16,20 @@ class nsPaintRequestList;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMRect;
|
||||
class DOMRectList;
|
||||
}
|
||||
}
|
||||
|
||||
class nsDOMNotifyPaintEvent : public nsDOMEvent,
|
||||
public nsIDOMNotifyPaintEvent
|
||||
class NotifyPaintEvent : public nsDOMEvent,
|
||||
public nsIDOMNotifyPaintEvent
|
||||
{
|
||||
typedef mozilla::dom::DOMRect DOMRect;
|
||||
typedef mozilla::dom::DOMRectList DOMRectList;
|
||||
|
||||
public:
|
||||
nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
nsInvalidateRequestList* aInvalidateRequests);
|
||||
NotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
nsInvalidateRequestList* aInvalidateRequests);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
@ -50,7 +47,7 @@ public:
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::NotifyPaintEventBinding::Wrap(aCx, aScope, this);
|
||||
return NotifyPaintEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRectList> ClientRects();
|
||||
@ -64,4 +61,7 @@ private:
|
||||
nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests;
|
||||
};
|
||||
|
||||
#endif // nsDOMNotifyPaintEvent_h_
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_NotifyPaintEvent_h_
|
@ -5,36 +5,36 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/ScrollAreaEvent.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
|
||||
#include "nsDOMScrollAreaEvent.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsDOMScrollAreaEvent::nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext *aPresContext,
|
||||
InternalScrollAreaEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent)
|
||||
ScrollAreaEvent::ScrollAreaEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalScrollAreaEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext, aEvent)
|
||||
, mClientArea(nullptr)
|
||||
{
|
||||
mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(ScrollAreaEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMScrollAreaEvent)
|
||||
NS_INTERFACE_MAP_BEGIN(ScrollAreaEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
|
||||
#define FORWARD_GETTER(_name) \
|
||||
NS_IMETHODIMP \
|
||||
nsDOMScrollAreaEvent::Get ## _name(float* aResult) \
|
||||
{ \
|
||||
*aResult = _name(); \
|
||||
return NS_OK; \
|
||||
#define FORWARD_GETTER(_name) \
|
||||
NS_IMETHODIMP \
|
||||
ScrollAreaEvent::Get ## _name(float* aResult) \
|
||||
{ \
|
||||
*aResult = _name(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
FORWARD_GETTER(X)
|
||||
@ -43,15 +43,18 @@ FORWARD_GETTER(Width)
|
||||
FORWARD_GETTER(Height)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow *aView,
|
||||
int32_t aDetail,
|
||||
float aX, float aY,
|
||||
float aWidth, float aHeight)
|
||||
ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
int32_t aDetail,
|
||||
float aX,
|
||||
float aY,
|
||||
float aWidth,
|
||||
float aHeight)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv =
|
||||
UIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mClientArea.SetRect(aX, aY, aWidth, aHeight);
|
||||
@ -60,8 +63,8 @@ nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
bool aSerializeInterfaceType)
|
||||
ScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
bool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
|
||||
@ -76,7 +79,7 @@ nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
ScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
|
||||
|
||||
@ -90,13 +93,18 @@ nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext *aPresContext,
|
||||
NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalScrollAreaEvent* aEvent)
|
||||
{
|
||||
nsDOMScrollAreaEvent* ev =
|
||||
new nsDOMScrollAreaEvent(aOwner, aPresContext, aEvent);
|
||||
ScrollAreaEvent* ev = new ScrollAreaEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(ev, aInstancePtrResult);
|
||||
}
|
@ -3,32 +3,32 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMScrollAreaEvent_h__
|
||||
#define nsDOMScrollAreaEvent_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMScrollAreaEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#ifndef mozilla_dom_ScrollAreaEvent_h_
|
||||
#define mozilla_dom_ScrollAreaEvent_h_
|
||||
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/ScrollAreaEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMScrollAreaEvent.h"
|
||||
|
||||
class nsDOMScrollAreaEvent : public nsDOMUIEvent,
|
||||
public nsIDOMScrollAreaEvent
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ScrollAreaEvent : public UIEvent,
|
||||
public nsIDOMScrollAreaEvent
|
||||
{
|
||||
typedef mozilla::dom::DOMRect DOMRect;
|
||||
|
||||
public:
|
||||
nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext *aPresContext,
|
||||
mozilla::InternalScrollAreaEvent* aEvent);
|
||||
ScrollAreaEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalScrollAreaEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSIDOMSCROLLAREAEVENT
|
||||
|
||||
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::)
|
||||
NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
|
||||
|
||||
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
|
||||
NS_IMETHOD DuplicatePrivateData()
|
||||
@ -41,7 +41,7 @@ public:
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::ScrollAreaEventBinding::Wrap(aCx, aScope, this);
|
||||
return ScrollAreaEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
float X() const
|
||||
@ -71,7 +71,7 @@ public:
|
||||
int32_t aDetail,
|
||||
float aX, float aY,
|
||||
float aWidth, float aHeight,
|
||||
mozilla::ErrorResult& aRv)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView,
|
||||
aDetail, aX, aY, aWidth, aHeight);
|
||||
@ -81,4 +81,7 @@ protected:
|
||||
DOMRect mClientArea;
|
||||
};
|
||||
|
||||
#endif // nsDOMScrollAreaEvent_h__
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ScrollAreaEvent_h_
|
@ -7,14 +7,14 @@
|
||||
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/TouchBinding.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
Touch::Touch(mozilla::dom::EventTarget* aTarget,
|
||||
Touch::Touch(EventTarget* aTarget,
|
||||
int32_t aIdentifier,
|
||||
int32_t aPageX,
|
||||
int32_t aPageY,
|
||||
@ -71,10 +71,11 @@ Touch::~Touch()
|
||||
{
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
// static
|
||||
bool
|
||||
Touch::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
|
||||
return TouchEvent::PrefEnabled(aCx, aGlobal);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
|
||||
@ -117,7 +118,7 @@ Touch::InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent)
|
||||
}
|
||||
|
||||
void
|
||||
Touch::SetTarget(mozilla::dom::EventTarget* aTarget)
|
||||
Touch::SetTarget(EventTarget* aTarget)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
}
|
||||
@ -132,7 +133,7 @@ Touch::Equals(Touch* aTouch)
|
||||
mRadius.y == aTouch->RadiusY();
|
||||
}
|
||||
|
||||
/* virtual */ JSObject*
|
||||
JSObject*
|
||||
Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return TouchBinding::Wrap(aCx, aScope, this);
|
||||
|
@ -3,8 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_Touch_h
|
||||
#define mozilla_dom_Touch_h
|
||||
#ifndef mozilla_dom_Touch_h_
|
||||
#define mozilla_dom_Touch_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
@ -27,7 +27,7 @@ class Touch MOZ_FINAL : public nsISupports
|
||||
public:
|
||||
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
Touch(mozilla::dom::EventTarget* aTarget,
|
||||
Touch(EventTarget* aTarget,
|
||||
int32_t aIdentifier,
|
||||
int32_t aPageX,
|
||||
int32_t aPageY,
|
||||
@ -52,7 +52,7 @@ public:
|
||||
|
||||
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
|
||||
|
||||
void SetTarget(mozilla::dom::EventTarget* aTarget);
|
||||
void SetTarget(EventTarget* aTarget);
|
||||
|
||||
bool Equals(Touch* aTouch);
|
||||
|
||||
@ -92,4 +92,4 @@ protected:
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_Touch_h
|
||||
#endif // mozilla_dom_Touch_h_
|
||||
|
@ -4,42 +4,52 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchListBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
// TouchList
|
||||
#ifdef XP_WIN
|
||||
namespace widget {
|
||||
extern int32_t IsTouchDeviceSupportPresent();
|
||||
} // namespace widget
|
||||
#endif // #ifdef XP_WIN
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchList)
|
||||
namespace dom {
|
||||
|
||||
/******************************************************************************
|
||||
* TouchList
|
||||
*****************************************************************************/
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TouchList)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsDOMTouchList, mParent, mPoints)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(TouchList, mParent, mPoints)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTouchList)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(TouchList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(TouchList)
|
||||
|
||||
/* virtual */ JSObject*
|
||||
nsDOMTouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
JSObject*
|
||||
TouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return TouchListBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsDOMTouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
// static
|
||||
bool
|
||||
TouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
|
||||
return TouchEvent::PrefEnabled(aCx, aGlobal);
|
||||
}
|
||||
|
||||
Touch*
|
||||
nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
|
||||
TouchList::IdentifiedTouch(int32_t aIdentifier) const
|
||||
{
|
||||
for (uint32_t i = 0; i < mPoints.Length(); ++i) {
|
||||
Touch* point = mPoints[i];
|
||||
@ -50,13 +60,15 @@ nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TouchEvent
|
||||
/******************************************************************************
|
||||
* TouchEvent
|
||||
*****************************************************************************/
|
||||
|
||||
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||
TouchEvent::TouchEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
@ -71,38 +83,33 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(nsDOMTouchEvent, nsDOMUIEvent,
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(TouchEvent, UIEvent,
|
||||
mTouches,
|
||||
mTargetTouches,
|
||||
mChangedTouches)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTouchEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TouchEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(TouchEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(TouchEvent, UIEvent)
|
||||
|
||||
void
|
||||
nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
int32_t aDetail,
|
||||
bool aCtrlKey,
|
||||
bool aAltKey,
|
||||
bool aShiftKey,
|
||||
bool aMetaKey,
|
||||
nsDOMTouchList* aTouches,
|
||||
nsDOMTouchList* aTargetTouches,
|
||||
nsDOMTouchList* aChangedTouches,
|
||||
mozilla::ErrorResult& aRv)
|
||||
TouchEvent::InitTouchEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
int32_t aDetail,
|
||||
bool aCtrlKey,
|
||||
bool aAltKey,
|
||||
bool aShiftKey,
|
||||
bool aMetaKey,
|
||||
TouchList* aTouches,
|
||||
TouchList* aTargetTouches,
|
||||
TouchList* aChangedTouches,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = nsDOMUIEvent::InitUIEvent(aType,
|
||||
aCanBubble,
|
||||
aCancelable,
|
||||
aView,
|
||||
aDetail);
|
||||
aRv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
@ -114,8 +121,8 @@ nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
|
||||
mChangedTouches = aChangedTouches;
|
||||
}
|
||||
|
||||
nsDOMTouchList*
|
||||
nsDOMTouchEvent::Touches()
|
||||
TouchList*
|
||||
TouchEvent::Touches()
|
||||
{
|
||||
if (!mTouches) {
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
@ -128,16 +135,16 @@ nsDOMTouchEvent::Touches()
|
||||
unchangedTouches.AppendElement(touches[i]);
|
||||
}
|
||||
}
|
||||
mTouches = new nsDOMTouchList(ToSupports(this), unchangedTouches);
|
||||
mTouches = new TouchList(ToSupports(this), unchangedTouches);
|
||||
} else {
|
||||
mTouches = new nsDOMTouchList(ToSupports(this), touchEvent->touches);
|
||||
mTouches = new TouchList(ToSupports(this), touchEvent->touches);
|
||||
}
|
||||
}
|
||||
return mTouches;
|
||||
}
|
||||
|
||||
nsDOMTouchList*
|
||||
nsDOMTouchEvent::TargetTouches()
|
||||
TouchList*
|
||||
TouchEvent::TargetTouches()
|
||||
{
|
||||
if (!mTargetTouches) {
|
||||
nsTArray< nsRefPtr<Touch> > targetTouches;
|
||||
@ -153,13 +160,13 @@ nsDOMTouchEvent::TargetTouches()
|
||||
}
|
||||
}
|
||||
}
|
||||
mTargetTouches = new nsDOMTouchList(ToSupports(this), targetTouches);
|
||||
mTargetTouches = new TouchList(ToSupports(this), targetTouches);
|
||||
}
|
||||
return mTargetTouches;
|
||||
}
|
||||
|
||||
nsDOMTouchList*
|
||||
nsDOMTouchEvent::ChangedTouches()
|
||||
TouchList*
|
||||
TouchEvent::ChangedTouches()
|
||||
{
|
||||
if (!mChangedTouches) {
|
||||
nsTArray< nsRefPtr<Touch> > changedTouches;
|
||||
@ -170,20 +177,14 @@ nsDOMTouchEvent::ChangedTouches()
|
||||
changedTouches.AppendElement(touches[i]);
|
||||
}
|
||||
}
|
||||
mChangedTouches = new nsDOMTouchList(ToSupports(this), changedTouches);
|
||||
mChangedTouches = new TouchList(ToSupports(this), changedTouches);
|
||||
}
|
||||
return mChangedTouches;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
extern int32_t IsTouchDeviceSupportPresent();
|
||||
} }
|
||||
#endif
|
||||
|
||||
// static
|
||||
bool
|
||||
nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
bool prefValue = false;
|
||||
int32_t flag = 0;
|
||||
@ -196,7 +197,7 @@ nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
// On Windows we auto-detect based on device support.
|
||||
if (!sDidCheckTouchDeviceSupport) {
|
||||
sDidCheckTouchDeviceSupport = true;
|
||||
sIsTouchDeviceSupportPresent = mozilla::widget::IsTouchDeviceSupportPresent();
|
||||
sIsTouchDeviceSupportPresent = widget::IsTouchDeviceSupportPresent();
|
||||
}
|
||||
prefValue = sIsTouchDeviceSupportPresent;
|
||||
#else
|
||||
@ -214,35 +215,41 @@ nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMTouchEvent::AltKey()
|
||||
TouchEvent::AltKey()
|
||||
{
|
||||
return mEvent->AsTouchEvent()->IsAlt();
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMTouchEvent::MetaKey()
|
||||
TouchEvent::MetaKey()
|
||||
{
|
||||
return mEvent->AsTouchEvent()->IsMeta();
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMTouchEvent::CtrlKey()
|
||||
TouchEvent::CtrlKey()
|
||||
{
|
||||
return mEvent->AsTouchEvent()->IsControl();
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMTouchEvent::ShiftKey()
|
||||
TouchEvent::ShiftKey()
|
||||
{
|
||||
return mEvent->AsTouchEvent()->IsShift();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent)
|
||||
{
|
||||
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
|
||||
TouchEvent* it = new TouchEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -2,38 +2,38 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsDOMTouchEvent_h_
|
||||
#define nsDOMTouchEvent_h_
|
||||
#ifndef mozilla_dom_TouchEvent_h_
|
||||
#define mozilla_dom_TouchEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchEventBinding.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
|
||||
class nsAString;
|
||||
|
||||
class nsDOMTouchList MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
typedef mozilla::dom::Touch Touch;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TouchList MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTouchList)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TouchList)
|
||||
|
||||
nsDOMTouchList(nsISupports* aParent)
|
||||
TouchList(nsISupports* aParent)
|
||||
: mParent(aParent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
nsJSContext::LikelyShortLivingObjectCreated();
|
||||
}
|
||||
nsDOMTouchList(nsISupports* aParent,
|
||||
const nsTArray< nsRefPtr<Touch> >& aTouches)
|
||||
TouchList(nsISupports* aParent,
|
||||
const nsTArray<nsRefPtr<Touch> >& aTouches)
|
||||
: mParent(aParent)
|
||||
, mPoints(aTouches)
|
||||
{
|
||||
@ -46,15 +46,16 @@ public:
|
||||
mPoints.AppendElement(aPoint);
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
nsISupports* GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
|
||||
static bool PrefEnabled(JSContext* aCx = nullptr,
|
||||
JSObject* aGlobal = nullptr);
|
||||
|
||||
uint32_t Length() const
|
||||
{
|
||||
@ -76,28 +77,28 @@ public:
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
nsTArray< nsRefPtr<Touch> > mPoints;
|
||||
nsTArray<nsRefPtr<Touch> > mPoints;
|
||||
};
|
||||
|
||||
class nsDOMTouchEvent : public nsDOMUIEvent
|
||||
class TouchEvent : public UIEvent
|
||||
{
|
||||
public:
|
||||
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetTouchEvent* aEvent);
|
||||
TouchEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TouchEvent, UIEvent)
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::TouchEventBinding::Wrap(aCx, aScope, this);
|
||||
return TouchEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsDOMTouchList* Touches();
|
||||
nsDOMTouchList* TargetTouches();
|
||||
nsDOMTouchList* ChangedTouches();
|
||||
TouchList* Touches();
|
||||
TouchList* TargetTouches();
|
||||
TouchList* ChangedTouches();
|
||||
|
||||
bool AltKey();
|
||||
bool MetaKey();
|
||||
@ -113,16 +114,20 @@ public:
|
||||
bool aAltKey,
|
||||
bool aShiftKey,
|
||||
bool aMetaKey,
|
||||
nsDOMTouchList* aTouches,
|
||||
nsDOMTouchList* aTargetTouches,
|
||||
nsDOMTouchList* aChangedTouches,
|
||||
mozilla::ErrorResult& aRv);
|
||||
TouchList* aTouches,
|
||||
TouchList* aTargetTouches,
|
||||
TouchList* aChangedTouches,
|
||||
ErrorResult& aRv);
|
||||
|
||||
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
|
||||
static bool PrefEnabled(JSContext* aCx = nullptr,
|
||||
JSObject* aGlobal = nullptr);
|
||||
protected:
|
||||
nsRefPtr<nsDOMTouchList> mTouches;
|
||||
nsRefPtr<nsDOMTouchList> mTargetTouches;
|
||||
nsRefPtr<nsDOMTouchList> mChangedTouches;
|
||||
nsRefPtr<TouchList> mTouches;
|
||||
nsRefPtr<TouchList> mTargetTouches;
|
||||
nsRefPtr<TouchList> mChangedTouches;
|
||||
};
|
||||
|
||||
#endif /* !defined(nsDOMTouchEvent_h_) */
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_TouchEvent_h_
|
@ -3,15 +3,16 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMTransitionEvent.h"
|
||||
#include "prtime.h"
|
||||
#include "mozilla/dom/TransitionEvent.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "prtime.h"
|
||||
|
||||
using namespace mozilla;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext *aPresContext,
|
||||
InternalTransitionEvent* aEvent)
|
||||
TransitionEvent::TransitionEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalTransitionEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalTransitionEvent(false, 0))
|
||||
{
|
||||
@ -24,22 +25,22 @@ nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMTransitionEvent)
|
||||
NS_INTERFACE_MAP_BEGIN(TransitionEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTransitionEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTransitionEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTransitionEvent, nsDOMEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(TransitionEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(TransitionEvent, nsDOMEvent)
|
||||
|
||||
//static
|
||||
already_AddRefed<nsDOMTransitionEvent>
|
||||
nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::TransitionEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv)
|
||||
// static
|
||||
already_AddRefed<TransitionEvent>
|
||||
TransitionEvent::Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const TransitionEventInit& aParam,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<nsDOMTransitionEvent> e = new nsDOMTransitionEvent(t, nullptr, nullptr);
|
||||
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<TransitionEvent> e = new TransitionEvent(t, nullptr, nullptr);
|
||||
bool trusted = e->Init(t);
|
||||
|
||||
aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
|
||||
@ -54,39 +55,44 @@ nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTransitionEvent::GetPropertyName(nsAString & aPropertyName)
|
||||
TransitionEvent::GetPropertyName(nsAString& aPropertyName)
|
||||
{
|
||||
aPropertyName = mEvent->AsTransitionEvent()->propertyName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTransitionEvent::GetElapsedTime(float *aElapsedTime)
|
||||
TransitionEvent::GetElapsedTime(float* aElapsedTime)
|
||||
{
|
||||
*aElapsedTime = ElapsedTime();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float
|
||||
nsDOMTransitionEvent::ElapsedTime()
|
||||
TransitionEvent::ElapsedTime()
|
||||
{
|
||||
return mEvent->AsTransitionEvent()->elapsedTime;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTransitionEvent::GetPseudoElement(nsAString& aPseudoElement)
|
||||
TransitionEvent::GetPseudoElement(nsAString& aPseudoElement)
|
||||
{
|
||||
aPseudoElement = mEvent->AsTransitionEvent()->pseudoElement;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMTransitionEvent(nsIDOMEvent **aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext *aPresContext,
|
||||
NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalTransitionEvent* aEvent)
|
||||
{
|
||||
nsDOMTransitionEvent *it =
|
||||
new nsDOMTransitionEvent(aOwner, aPresContext, aEvent);
|
||||
TransitionEvent *it = new TransitionEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsDOMTransitionEvent_h_
|
||||
#define nsDOMTransitionEvent_h_
|
||||
#ifndef mozilla_dom_TransitionEvent_h_
|
||||
#define mozilla_dom_TransitionEvent_h_
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIDOMTransitionEvent.h"
|
||||
@ -12,28 +12,31 @@
|
||||
|
||||
class nsAString;
|
||||
|
||||
class nsDOMTransitionEvent : public nsDOMEvent,
|
||||
public nsIDOMTransitionEvent
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TransitionEvent : public nsDOMEvent,
|
||||
public nsIDOMTransitionEvent
|
||||
{
|
||||
public:
|
||||
nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext *aPresContext,
|
||||
mozilla::InternalTransitionEvent* aEvent);
|
||||
TransitionEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalTransitionEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
NS_DECL_NSIDOMTRANSITIONEVENT
|
||||
|
||||
static already_AddRefed<nsDOMTransitionEvent>
|
||||
Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
static already_AddRefed<TransitionEvent>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::TransitionEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv);
|
||||
const TransitionEventInit& aParam,
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::TransitionEventBinding::Wrap(aCx, aScope, this);
|
||||
return TransitionEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
// xpidl implementation
|
||||
@ -43,4 +46,7 @@ public:
|
||||
float ElapsedTime();
|
||||
};
|
||||
|
||||
#endif /* !defined(nsDOMTransitionEvent_h_) */
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_TransitionEvent_h_
|
@ -5,28 +5,33 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "prtime.h"
|
||||
|
||||
using namespace mozilla;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext, WidgetGUIEvent* aEvent)
|
||||
UIEvent::UIEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalUIEvent(false, 0))
|
||||
, mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0), mMovementPoint(0, 0)
|
||||
, mClientPoint(0, 0)
|
||||
, mLayerPoint(0, 0)
|
||||
, mPagePoint(0, 0)
|
||||
, mMovementPoint(0, 0)
|
||||
, mIsPointerLocked(nsEventStateManager::sIsPointerLocked)
|
||||
, mLastClientPoint(nsEventStateManager::sLastClientPoint)
|
||||
{
|
||||
@ -73,15 +78,15 @@ nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
already_AddRefed<nsDOMUIEvent>
|
||||
nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::UIEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv)
|
||||
// static
|
||||
already_AddRefed<UIEvent>
|
||||
UIEvent::Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const UIEventInit& aParam,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<nsDOMUIEvent> e = new nsDOMUIEvent(t, nullptr, nullptr);
|
||||
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<UIEvent> e = new UIEvent(t, nullptr, nullptr);
|
||||
bool trusted = e->Init(t);
|
||||
aRv = e->InitUIEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
|
||||
aParam.mDetail);
|
||||
@ -89,13 +94,13 @@ nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
return e.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMUIEvent, nsDOMEvent,
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(UIEvent, nsDOMEvent,
|
||||
mView)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(UIEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(UIEvent, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(UIEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
@ -108,7 +113,7 @@ DevPixelsToCSSPixels(const LayoutDeviceIntPoint& aPoint,
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetMovementPoint()
|
||||
UIEvent::GetMovementPoint()
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mMovementPoint;
|
||||
@ -132,7 +137,7 @@ nsDOMUIEvent::GetMovementPoint()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetView(nsIDOMWindow** aView)
|
||||
UIEvent::GetView(nsIDOMWindow** aView)
|
||||
{
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
@ -140,18 +145,18 @@ nsDOMUIEvent::GetView(nsIDOMWindow** aView)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetDetail(int32_t* aDetail)
|
||||
UIEvent::GetDetail(int32_t* aDetail)
|
||||
{
|
||||
*aDetail = mDetail;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
nsIDOMWindow* viewArg,
|
||||
int32_t detailArg)
|
||||
UIEvent::InitUIEvent(const nsAString& typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
nsIDOMWindow* viewArg,
|
||||
int32_t detailArg)
|
||||
{
|
||||
if (viewArg) {
|
||||
nsCOMPtr<nsPIDOMWindow> view = do_QueryInterface(viewArg);
|
||||
@ -166,9 +171,8 @@ nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ---- nsDOMNSUIEvent implementation -------------------
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetPageX(int32_t* aPageX)
|
||||
UIEvent::GetPageX(int32_t* aPageX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageX);
|
||||
*aPageX = PageX();
|
||||
@ -176,7 +180,7 @@ nsDOMUIEvent::GetPageX(int32_t* aPageX)
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsDOMUIEvent::PageX() const
|
||||
UIEvent::PageX() const
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mPagePoint.x;
|
||||
@ -189,7 +193,7 @@ nsDOMUIEvent::PageX() const
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetPageY(int32_t* aPageY)
|
||||
UIEvent::GetPageY(int32_t* aPageY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageY);
|
||||
*aPageY = PageY();
|
||||
@ -197,7 +201,7 @@ nsDOMUIEvent::GetPageY(int32_t* aPageY)
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsDOMUIEvent::PageY() const
|
||||
UIEvent::PageY() const
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mPagePoint.y;
|
||||
@ -210,7 +214,7 @@ nsDOMUIEvent::PageY() const
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetWhich(uint32_t* aWhich)
|
||||
UIEvent::GetWhich(uint32_t* aWhich)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWhich);
|
||||
*aWhich = Which();
|
||||
@ -218,7 +222,7 @@ nsDOMUIEvent::GetWhich(uint32_t* aWhich)
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
nsDOMUIEvent::GetRangeParent()
|
||||
UIEvent::GetRangeParent()
|
||||
{
|
||||
nsIFrame* targetFrame = nullptr;
|
||||
|
||||
@ -243,7 +247,7 @@ nsDOMUIEvent::GetRangeParent()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
UIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRangeParent);
|
||||
*aRangeParent = nullptr;
|
||||
@ -255,7 +259,7 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
|
||||
UIEvent::GetRangeOffset(int32_t* aRangeOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRangeOffset);
|
||||
*aRangeOffset = RangeOffset();
|
||||
@ -263,7 +267,7 @@ nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsDOMUIEvent::RangeOffset() const
|
||||
UIEvent::RangeOffset() const
|
||||
{
|
||||
if (!mPresContext) {
|
||||
return 0;
|
||||
@ -280,7 +284,7 @@ nsDOMUIEvent::RangeOffset() const
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
|
||||
UIEvent::GetCancelBubble(bool* aCancelBubble)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCancelBubble);
|
||||
*aCancelBubble = CancelBubble();
|
||||
@ -288,14 +292,14 @@ nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::SetCancelBubble(bool aCancelBubble)
|
||||
UIEvent::SetCancelBubble(bool aCancelBubble)
|
||||
{
|
||||
mEvent->mFlags.mPropagationStopped = aCancelBubble;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetLayerPoint() const
|
||||
UIEvent::GetLayerPoint() const
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
@ -320,7 +324,7 @@ nsDOMUIEvent::GetLayerPoint() const
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
|
||||
UIEvent::GetLayerX(int32_t* aLayerX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLayerX);
|
||||
*aLayerX = GetLayerPoint().x;
|
||||
@ -328,7 +332,7 @@ nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
|
||||
UIEvent::GetLayerY(int32_t* aLayerY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLayerY);
|
||||
*aLayerY = GetLayerPoint().y;
|
||||
@ -336,14 +340,14 @@ nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetIsChar(bool* aIsChar)
|
||||
UIEvent::GetIsChar(bool* aIsChar)
|
||||
{
|
||||
*aIsChar = IsChar();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMUIEvent::IsChar() const
|
||||
UIEvent::IsChar() const
|
||||
{
|
||||
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
|
||||
if (keyEvent) {
|
||||
@ -354,7 +358,7 @@ nsDOMUIEvent::IsChar() const
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::DuplicatePrivateData()
|
||||
UIEvent::DuplicatePrivateData()
|
||||
{
|
||||
mClientPoint = nsDOMEvent::GetClientCoords(mPresContext,
|
||||
mEvent,
|
||||
@ -378,7 +382,7 @@ nsDOMUIEvent::DuplicatePrivateData()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
UIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
|
||||
@ -392,7 +396,7 @@ nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
UIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), false);
|
||||
@ -400,14 +404,14 @@ nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
}
|
||||
|
||||
// XXX Following struct and array are used only in
|
||||
// nsDOMUIEvent::ComputeModifierState(), but if we define them in it,
|
||||
// UIEvent::ComputeModifierState(), but if we define them in it,
|
||||
// we fail to build on Mac at calling mozilla::ArrayLength().
|
||||
struct nsModifierPair
|
||||
struct ModifierPair
|
||||
{
|
||||
mozilla::Modifier modifier;
|
||||
Modifier modifier;
|
||||
const char* name;
|
||||
};
|
||||
static const nsModifierPair kPairs[] = {
|
||||
static const ModifierPair kPairs[] = {
|
||||
{ MODIFIER_ALT, NS_DOM_KEYNAME_ALT },
|
||||
{ MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH },
|
||||
{ MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK },
|
||||
@ -421,9 +425,9 @@ static const nsModifierPair kPairs[] = {
|
||||
{ MODIFIER_OS, NS_DOM_KEYNAME_OS }
|
||||
};
|
||||
|
||||
/* static */
|
||||
mozilla::Modifiers
|
||||
nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
// static
|
||||
Modifiers
|
||||
UIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
{
|
||||
if (aModifiersList.IsEmpty()) {
|
||||
return 0;
|
||||
@ -439,7 +443,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
aModifiersList.BeginReading(listStart);
|
||||
aModifiersList.EndReading(listEnd);
|
||||
|
||||
for (uint32_t i = 0; i < mozilla::ArrayLength(kPairs); i++) {
|
||||
for (uint32_t i = 0; i < ArrayLength(kPairs); i++) {
|
||||
nsAString::const_iterator start(listStart), end(listEnd);
|
||||
if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) {
|
||||
continue;
|
||||
@ -456,7 +460,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
|
||||
UIEvent::GetModifierStateInternal(const nsAString& aKey)
|
||||
{
|
||||
WidgetInputEvent* inputEvent = mEvent->AsInputEvent();
|
||||
MOZ_ASSERT(inputEvent, "mEvent must be WidgetInputEvent or derived class");
|
||||
@ -499,12 +503,18 @@ nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
{
|
||||
nsDOMUIEvent* it = new nsDOMUIEvent(aOwner, aPresContext, aEvent);
|
||||
UIEvent* it = new UIEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMUIEvent_h
|
||||
#define nsDOMUIEvent_h
|
||||
#ifndef mozilla_dom_UIEvent_h_
|
||||
#define mozilla_dom_UIEvent_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
@ -16,30 +16,31 @@
|
||||
|
||||
class nsINode;
|
||||
|
||||
class nsDOMUIEvent : public nsDOMEvent,
|
||||
public nsIDOMUIEvent
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class UIEvent : public nsDOMEvent,
|
||||
public nsIDOMUIEvent
|
||||
{
|
||||
typedef mozilla::CSSIntPoint CSSIntPoint;
|
||||
public:
|
||||
nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent);
|
||||
UIEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, nsDOMEvent)
|
||||
|
||||
// nsIDOMUIEvent Interface
|
||||
NS_DECL_NSIDOMUIEVENT
|
||||
|
||||
|
||||
// Forward to nsDOMEvent
|
||||
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
|
||||
NS_IMETHOD DuplicatePrivateData() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
|
||||
|
||||
static nsIntPoint
|
||||
CalculateScreenPoint(nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent)
|
||||
static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
{
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
@ -51,20 +52,21 @@ public:
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
mozilla::WidgetGUIEvent* event = aEvent->AsGUIEvent();
|
||||
WidgetGUIEvent* event = aEvent->AsGUIEvent();
|
||||
if (!event->widget) {
|
||||
return mozilla::LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
|
||||
return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
|
||||
}
|
||||
|
||||
mozilla::LayoutDeviceIntPoint offset = aEvent->refPoint +
|
||||
mozilla::LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
|
||||
nscoord factor = aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
LayoutDeviceIntPoint offset = aEvent->refPoint +
|
||||
LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
|
||||
nscoord factor =
|
||||
aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
|
||||
}
|
||||
|
||||
static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
WidgetEvent* aEvent,
|
||||
CSSIntPoint* aDefaultClientPoint)
|
||||
{
|
||||
if (!aEvent ||
|
||||
@ -95,15 +97,15 @@ public:
|
||||
return CSSIntPoint::FromAppUnitsRounded(pt);
|
||||
}
|
||||
|
||||
static already_AddRefed<nsDOMUIEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::UIEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv);
|
||||
static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const UIEventInit& aParam,
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::UIEventBinding::Wrap(aCx, aScope, this);
|
||||
return UIEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsIDOMWindow* GetView() const
|
||||
@ -164,27 +166,29 @@ protected:
|
||||
bool mIsPointerLocked;
|
||||
CSSIntPoint mLastClientPoint;
|
||||
|
||||
typedef mozilla::Modifiers Modifiers;
|
||||
static Modifiers ComputeModifierState(const nsAString& aModifiersList);
|
||||
bool GetModifierStateInternal(const nsAString& aKey);
|
||||
};
|
||||
|
||||
#define NS_FORWARD_TO_NSDOMUIEVENT \
|
||||
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_FORWARD_TO_UIEVENT \
|
||||
NS_FORWARD_NSIDOMUIEVENT(UIEvent::) \
|
||||
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION \
|
||||
NS_IMETHOD DuplicatePrivateData() \
|
||||
{ \
|
||||
return nsDOMUIEvent::DuplicatePrivateData(); \
|
||||
return UIEvent::DuplicatePrivateData(); \
|
||||
} \
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, \
|
||||
bool aSerializeInterfaceType) \
|
||||
{ \
|
||||
nsDOMUIEvent::Serialize(aMsg, aSerializeInterfaceType); \
|
||||
UIEvent::Serialize(aMsg, aSerializeInterfaceType); \
|
||||
} \
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \
|
||||
void** aIter) \
|
||||
{ \
|
||||
return nsDOMUIEvent::Deserialize(aMsg, aIter); \
|
||||
return UIEvent::Deserialize(aMsg, aIter); \
|
||||
}
|
||||
|
||||
#endif // nsDOMUIEvent_h
|
||||
#endif // mozilla_dom_UIEvent_h_
|
139
dom/events/XULCommandEvent.cpp
Normal file
139
dom/events/XULCommandEvent.cpp
Normal file
@ -0,0 +1,139 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/XULCommandEvent.h"
|
||||
#include "prtime.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
}
|
||||
else {
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(XULCommandEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(XULCommandEvent, UIEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(XULCommandEvent, UIEvent,
|
||||
mSourceEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULCommandEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMXULCommandEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
bool
|
||||
XULCommandEvent::AltKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsAlt();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandEvent::GetAltKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = AltKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
XULCommandEvent::CtrlKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsControl();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandEvent::GetCtrlKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = CtrlKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
XULCommandEvent::ShiftKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsShift();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandEvent::GetShiftKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = ShiftKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
XULCommandEvent::MetaKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsMeta();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandEvent::GetMetaKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = MetaKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSourceEvent);
|
||||
*aSourceEvent = GetSourceEvent().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandEvent::InitCommandEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
int32_t aDetail,
|
||||
bool aCtrlKey,
|
||||
bool aAltKey,
|
||||
bool aShiftKey,
|
||||
bool aMetaKey,
|
||||
nsIDOMEvent* aSourceEvent)
|
||||
{
|
||||
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
|
||||
aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
|
||||
aShiftKey, aMetaKey);
|
||||
mSourceEvent = aSourceEvent;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
{
|
||||
XULCommandEvent* it = new XULCommandEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -6,32 +6,35 @@
|
||||
|
||||
// This class implements a XUL "command" event. See nsIDOMXULCommandEvent.idl
|
||||
|
||||
#ifndef nsDOMXULCommandEvent_h_
|
||||
#define nsDOMXULCommandEvent_h_
|
||||
#ifndef mozilla_dom_XULCommandEvent_h_
|
||||
#define mozilla_dom_XULCommandEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/XULCommandEventBinding.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
|
||||
class nsDOMXULCommandEvent : public nsDOMUIEvent,
|
||||
public nsIDOMXULCommandEvent
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class XULCommandEvent : public UIEvent,
|
||||
public nsIDOMXULCommandEvent
|
||||
{
|
||||
public:
|
||||
nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetInputEvent* aEvent);
|
||||
XULCommandEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
|
||||
NS_DECL_NSIDOMXULCOMMANDEVENT
|
||||
|
||||
// Forward our inherited virtual methods to the base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::XULCommandEventBinding::Wrap(aCx, aScope, this);
|
||||
return XULCommandEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
bool AltKey();
|
||||
@ -53,7 +56,7 @@ public:
|
||||
bool aCtrlKey, bool aAltKey,
|
||||
bool aShiftKey, bool aMetaKey,
|
||||
nsDOMEvent* aSourceEvent,
|
||||
mozilla::ErrorResult& aRv)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail,
|
||||
aCtrlKey, aAltKey, aShiftKey, aMetaKey,
|
||||
@ -64,4 +67,7 @@ protected:
|
||||
nsCOMPtr<nsIDOMEvent> mSourceEvent;
|
||||
};
|
||||
|
||||
#endif // nsDOMXULCommandEvent_h_
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_XULCommandEvent_h_
|
@ -18,8 +18,6 @@ EXPORTS += [
|
||||
'nsDOMEvent.h',
|
||||
'nsDOMEventTargetHelper.h',
|
||||
'nsDOMKeyNameList.h',
|
||||
'nsDOMTouchEvent.h',
|
||||
'nsDOMUIEvent.h',
|
||||
'nsEventDispatcher.h',
|
||||
'nsEventListenerManager.h',
|
||||
'nsEventNameList.h',
|
||||
@ -52,10 +50,17 @@ EXPORTS.mozilla.dom += [
|
||||
'MouseEvent.h',
|
||||
'MouseScrollEvent.h',
|
||||
'MutationEvent.h',
|
||||
'NotifyAudioAvailableEvent.h',
|
||||
'NotifyPaintEvent.h',
|
||||
'PointerEvent.h',
|
||||
'ScrollAreaEvent.h',
|
||||
'SimpleGestureEvent.h',
|
||||
'Touch.h',
|
||||
'TouchEvent.h',
|
||||
'TransitionEvent.h',
|
||||
'UIEvent.h',
|
||||
'WheelEvent.h',
|
||||
'XULCommandEvent.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WEBSPEECH']:
|
||||
@ -78,14 +83,11 @@ UNIFIED_SOURCES += [
|
||||
'MouseEvent.cpp',
|
||||
'MouseScrollEvent.cpp',
|
||||
'MutationEvent.cpp',
|
||||
'NotifyAudioAvailableEvent.cpp',
|
||||
'nsAsyncDOMEvent.cpp',
|
||||
'nsContentEventHandler.cpp',
|
||||
'nsDOMEventTargetHelper.cpp',
|
||||
'nsDOMNotifyAudioAvailableEvent.cpp',
|
||||
'nsDOMTextEvent.cpp',
|
||||
'nsDOMTouchEvent.cpp',
|
||||
'nsDOMTransitionEvent.cpp',
|
||||
'nsDOMXULCommandEvent.cpp',
|
||||
'nsEventDispatcher.cpp',
|
||||
'nsEventListenerService.cpp',
|
||||
'nsIMEStateManager.cpp',
|
||||
@ -96,28 +98,31 @@ UNIFIED_SOURCES += [
|
||||
'SimpleGestureEvent.cpp',
|
||||
'TextComposition.cpp',
|
||||
'Touch.cpp',
|
||||
'TouchEvent.cpp',
|
||||
'TransitionEvent.cpp',
|
||||
'WheelEvent.cpp',
|
||||
'XULCommandEvent.cpp',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'NotifyPaintEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'nsDOMEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'nsDOMNotifyPaintEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'nsDOMScrollAreaEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'nsDOMUIEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# mozilla/HalSensor.h, which includes ipc/IPCMessageUtils.h, which
|
||||
# on Windows includes windows.h.
|
||||
'nsEventListenerManager.cpp',
|
||||
# nsEventStateManager.cpp should be built separately because of Mac OS X headers.
|
||||
'nsEventStateManager.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'ScrollAreaEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'UIEvent.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WEBSPEECH']:
|
||||
|
@ -1,169 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMNotifyAudioAvailableEvent.h"
|
||||
|
||||
#include "nsError.h"
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsDOMNotifyAudioAvailableEvent::nsDOMNotifyAudioAvailableEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime)
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent),
|
||||
mFrameBuffer(aFrameBuffer),
|
||||
mFrameBufferLength(aFrameBufferLength),
|
||||
mTime(aTime),
|
||||
mCachedArray(nullptr),
|
||||
mAllowAudioData(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDOMNotifyAudioAvailableEvent);
|
||||
if (mEvent) {
|
||||
mEvent->message = aEventType;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMNotifyAudioAvailableEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
|
||||
if (tmp->mCachedArray) {
|
||||
tmp->mCachedArray = nullptr;
|
||||
mozilla::DropJSObjects(tmp);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCachedArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMNotifyAudioAvailableEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyAudioAvailableEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
nsDOMNotifyAudioAvailableEvent::~nsDOMNotifyAudioAvailableEvent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsDOMNotifyAudioAvailableEvent);
|
||||
if (mCachedArray) {
|
||||
mCachedArray = nullptr;
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
|
||||
{
|
||||
if (!mAllowAudioData) {
|
||||
// Media is not same-origin, don't allow the data out.
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
if (mCachedArray) {
|
||||
aResult.setObject(*mCachedArray);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Cache this array so we don't recreate on next call.
|
||||
mozilla::HoldJSObjects(this);
|
||||
|
||||
mCachedArray = JS_NewFloat32Array(aCx, mFrameBufferLength);
|
||||
if (!mCachedArray) {
|
||||
mozilla::DropJSObjects(this);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
|
||||
|
||||
aResult.setObject(*mCachedArray);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMNotifyAudioAvailableEvent::GetTime(float *aRetVal)
|
||||
{
|
||||
*aRetVal = Time();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMNotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime,
|
||||
bool aAllowAudioData)
|
||||
{
|
||||
// Auto manage the memory which stores the frame buffer. This ensures
|
||||
// that if we exit due to some error, the memory will be freed. Otherwise,
|
||||
// the framebuffer's memory will be freed when this event is destroyed.
|
||||
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mFrameBuffer = frameBuffer.forget();
|
||||
mFrameBufferLength = aFrameBufferLength;
|
||||
mTime = aTime;
|
||||
mAllowAudioData = aAllowAudioData;
|
||||
mCachedArray = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
const Nullable<Sequence<float> >& aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime,
|
||||
bool aAllowAudioData,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if ((aFrameBuffer.IsNull() && aFrameBufferLength > 0) ||
|
||||
(!aFrameBuffer.IsNull() &&
|
||||
aFrameBuffer.Value().Length() < aFrameBufferLength)) {
|
||||
aRv = NS_ERROR_UNEXPECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoArrayPtr<float> buffer;
|
||||
if (!aFrameBuffer.IsNull()) {
|
||||
buffer = new float[aFrameBufferLength];
|
||||
memcpy(buffer.get(), aFrameBuffer.Value().Elements(),
|
||||
aFrameBufferLength * sizeof(float));
|
||||
}
|
||||
|
||||
aRv = InitAudioAvailableEvent(aType, aCanBubble, aCancelable,
|
||||
buffer.forget(),
|
||||
aFrameBufferLength,
|
||||
aTime, aAllowAudioData);
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
float* aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime)
|
||||
{
|
||||
nsDOMNotifyAudioAvailableEvent* it =
|
||||
new nsDOMNotifyAudioAvailableEvent(aOwner, aPresContext, aEvent, aEventType,
|
||||
aFrameBuffer, aFrameBufferLength, aTime);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMNotifyAudioAvailableEvent_h_
|
||||
#define nsDOMNotifyAudioAvailableEvent_h_
|
||||
|
||||
#include "nsIDOMNotifyAudioAvailableEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
class nsDOMNotifyAudioAvailableEvent : public nsDOMEvent,
|
||||
public nsIDOMNotifyAudioAvailableEvent
|
||||
{
|
||||
public:
|
||||
nsDOMNotifyAudioAvailableEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
uint32_t aEventType, float * aFrameBuffer,
|
||||
uint32_t aFrameBufferLength, float aTime);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMNotifyAudioAvailableEvent,
|
||||
nsDOMEvent)
|
||||
|
||||
NS_DECL_NSIDOMNOTIFYAUDIOAVAILABLEEVENT
|
||||
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
|
||||
|
||||
nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
float * aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime);
|
||||
|
||||
~nsDOMNotifyAudioAvailableEvent();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
JSObject* GetFrameBuffer(JSContext* aCx, mozilla::ErrorResult& aRv)
|
||||
{
|
||||
JS::Rooted<JS::Value> dummy(aCx);
|
||||
aRv = GetFrameBuffer(aCx, &dummy);
|
||||
return mCachedArray;
|
||||
}
|
||||
|
||||
float Time()
|
||||
{
|
||||
return mTime;
|
||||
}
|
||||
|
||||
void InitAudioAvailableEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
const mozilla::dom::Nullable<mozilla::dom::Sequence<float> >& aFrameBuffer,
|
||||
uint32_t aFrameBufferLength,
|
||||
float aTime,
|
||||
bool aAllowAudioData,
|
||||
mozilla::ErrorResult& aRv);
|
||||
private:
|
||||
nsAutoArrayPtr<float> mFrameBuffer;
|
||||
uint32_t mFrameBufferLength;
|
||||
float mTime;
|
||||
JS::Heap<JSObject*> mCachedArray;
|
||||
bool mAllowAudioData;
|
||||
};
|
||||
|
||||
#endif // nsDOMNotifyAudioAvailableEvent_h_
|
@ -10,12 +10,13 @@
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTextEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_TEXT_EVENT, "event type mismatch");
|
||||
|
||||
@ -53,12 +54,12 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMTextEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_METHOD nsDOMTextEvent::GetText(nsString& aText)
|
||||
{
|
||||
|
@ -6,15 +6,17 @@
|
||||
#ifndef nsDOMTextEvent_h__
|
||||
#define nsDOMTextEvent_h__
|
||||
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIPrivateTextEvent.h"
|
||||
#include "nsPrivateTextRange.h"
|
||||
|
||||
class nsDOMTextEvent : public nsDOMUIEvent,
|
||||
class nsDOMTextEvent : public mozilla::dom::UIEvent,
|
||||
public nsIPrivateTextEvent
|
||||
{
|
||||
typedef mozilla::dom::UIEvent UIEvent;
|
||||
|
||||
public:
|
||||
nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
@ -23,7 +25,7 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
// nsIPrivateTextEvent interface
|
||||
NS_IMETHOD GetText(nsString& aText) MOZ_OVERRIDE;
|
||||
|
@ -1,130 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMXULCommandEvent.h"
|
||||
#include "prtime.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsDOMXULCommandEvent::nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
}
|
||||
else {
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMXULCommandEvent, nsDOMUIEvent,
|
||||
mSourceEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMXULCommandEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMXULCommandEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
|
||||
bool
|
||||
nsDOMXULCommandEvent::AltKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsAlt();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetAltKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = AltKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMXULCommandEvent::CtrlKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsControl();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetCtrlKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = CtrlKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMXULCommandEvent::ShiftKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsShift();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetShiftKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = ShiftKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMXULCommandEvent::MetaKey()
|
||||
{
|
||||
return mEvent->AsInputEvent()->IsMeta();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetMetaKey(bool* aIsDown)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDown);
|
||||
*aIsDown = MetaKey();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSourceEvent);
|
||||
*aSourceEvent = GetSourceEvent().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
int32_t aDetail,
|
||||
bool aCtrlKey, bool aAltKey,
|
||||
bool aShiftKey, bool aMetaKey,
|
||||
nsIDOMEvent* aSourceEvent)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
|
||||
aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
|
||||
aShiftKey, aMetaKey);
|
||||
mSourceEvent = aSourceEvent;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
{
|
||||
nsDOMXULCommandEvent* it =
|
||||
new nsDOMXULCommandEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -14,11 +14,11 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "GeneratedEvents.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/MiscEvents.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
@ -818,7 +818,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
if (aEventType.LowerCaseEqualsLiteral("closeevent"))
|
||||
return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("touchevent") &&
|
||||
nsDOMTouchEvent::PrefEnabled())
|
||||
TouchEvent::PrefEnabled())
|
||||
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
|
||||
return NS_NewDOMHashChangeEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsEventStateManager.h"
|
||||
@ -50,7 +51,6 @@
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
|
||||
#include "nsSubDocumentFrame.h"
|
||||
@ -1030,9 +1030,9 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT) &&
|
||||
!sIsPointerLocked) {
|
||||
sLastScreenPoint =
|
||||
nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
UIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
sLastClientPoint =
|
||||
nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
UIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
}
|
||||
|
||||
// Do not take account NS_MOUSE_ENTER/EXIT so that loading a page
|
||||
@ -2337,9 +2337,9 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
|
||||
// target of the mouse event. If one wasn't set in the
|
||||
// aDataTransfer during the event handler, just use the original
|
||||
// target instead.
|
||||
nsCOMPtr<Element> dragTarget = aDataTransfer->GetDragTarget();
|
||||
nsCOMPtr<nsIContent> dragTarget = aDataTransfer->GetDragTarget();
|
||||
if (!dragTarget) {
|
||||
dragTarget = do_QueryInterface(aDragTarget);
|
||||
dragTarget = aDragTarget;
|
||||
if (!dragTarget)
|
||||
return false;
|
||||
}
|
||||
@ -4332,7 +4332,7 @@ nsEventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
|
||||
// Returns the center point of the window's inner content area.
|
||||
// This is in widget coordinates, i.e. relative to the widget's top
|
||||
// left corner, not in screen coordinates, the same units that
|
||||
// nsDOMUIEvent::refPoint is in.
|
||||
// UIEvent::refPoint is in.
|
||||
//
|
||||
// XXX Hack alert: XXX
|
||||
// However, we do the computation in integer CSS pixels, NOT device pix,
|
||||
@ -4386,7 +4386,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
||||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
|
||||
// Movement is calculated in nsDOMUIEvent::GetMovementPoint() as:
|
||||
// Movement is calculated in UIEvent::GetMovementPoint() as:
|
||||
// previous_mousemove_refPoint - current_mousemove_refPoint.
|
||||
if (sIsPointerLocked && aMouseEvent->widget) {
|
||||
// The pointer is locked. If the pointer is not located at the center of
|
||||
|
@ -198,6 +198,7 @@ function testOnPointerProperty()
|
||||
iframeBody.onpointerover = function (e) { gOnPointerPropHandled["pointerover"] = true; }
|
||||
iframeBody.onpointerenter = function (e) { gOnPointerPropHandled["pointerenter"] = true; }
|
||||
iframeBody.onpointerleave = function (e) { gOnPointerPropHandled["pointerleave"] = true; }
|
||||
iframeBody.onpointercancel = function (e) { gOnPointerPropHandled["pointercancel"] = true; }
|
||||
|
||||
iframeBody.dispatchEvent(getDefaultArgEvent("pointerdown"));
|
||||
is(gOnPointerPropHandled['pointerdown'], true, "pointerdown property is performed");
|
||||
@ -220,6 +221,9 @@ function testOnPointerProperty()
|
||||
iframeBody.dispatchEvent(getDefaultArgEvent("pointerleave"));
|
||||
is(gOnPointerPropHandled['pointerleave'], true, "pointerleave property is performed");
|
||||
|
||||
iframeBody.dispatchEvent(getDefaultArgEvent("pointercancel"));
|
||||
is(gOnPointerPropHandled['pointercancel'], true, "pointercancel property is performed");
|
||||
|
||||
nextTest();
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ function penter(evt) {
|
||||
is(evt.target.id, t, "Wrong event target!");
|
||||
}
|
||||
is(evt.bubbles, false, evt.type + " should not bubble!");
|
||||
is(evt.cancelable, true, evt.type + " is cancelable!");
|
||||
is(evt.cancelable, false, evt.type + " is cancelable!");
|
||||
is(evt.target, evt.currentTarget, "Wrong event target!");
|
||||
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
|
||||
"Leaking nodes to another document?");
|
||||
@ -183,7 +183,7 @@ function pleave(evt) {
|
||||
is(evt.target.id, t, "Wrong event target!");
|
||||
}
|
||||
is(evt.bubbles, false, evt.type + " should not bubble!");
|
||||
is(evt.cancelable, true, evt.type + " is cancelable!");
|
||||
is(evt.cancelable, false, evt.type + " is cancelable!");
|
||||
is(evt.target, evt.currentTarget, "Wrong event target!");
|
||||
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
|
||||
"Leaking nodes to another document?");
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(bcdf4ce4-9785-4e31-a851-1d51ea16da20)]
|
||||
[scriptable, builtinclass, uuid(e732649a-4f78-4ded-abe1-dbdc36fd59d3)]
|
||||
interface nsIDOMScreen : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute long top;
|
||||
@ -26,36 +26,4 @@ interface nsIDOMScreen : nsIDOMEventTarget
|
||||
*/
|
||||
[binaryname(SlowMozOrientation)]
|
||||
readonly attribute DOMString mozOrientation;
|
||||
|
||||
/**
|
||||
* Lock the screen to the specified orientations(s). This method returns true
|
||||
* if the lock was acquired successfully, and false otherwise.
|
||||
*
|
||||
* The parameter can be a DOMString or an Array of DOMStrings. If you pass a
|
||||
* string, we lock the screen to that one orientation. If you pass an Array,
|
||||
* we ensure that the screen is always in one of the given orientations.
|
||||
*
|
||||
* Valid orientations are "portrait", "portrait-primary",
|
||||
* "portrait-secondary", "landscape", "landscape-primary", and
|
||||
* "landscape-secondary".
|
||||
* These tokens are case-sensitive.
|
||||
*
|
||||
* If you pass a string that's not one of the valid orientations, or if you
|
||||
* pass an array of orientations and any of the orientations in the array is
|
||||
* not valid, we reject the lock and return false.
|
||||
*
|
||||
* The "-primary" orientations correspond to holding the device right-side up,
|
||||
* while the "-secondary" orientations correspond to holding the device
|
||||
* upside-down. Locking the orientation in "portrait" is the same as locking
|
||||
* the orientation in ['portrait-primary', 'portrait-secondary'], and the
|
||||
* "landscape" orientation similarly corresponds to the set
|
||||
* ['landscape-primary', 'landscape-secondary'].
|
||||
*/
|
||||
[implicit_jscontext] boolean mozLockOrientation(in jsval orientation);
|
||||
|
||||
/**
|
||||
* Unlock the screen orientation.
|
||||
*/
|
||||
[binaryname(SlowMozUnlockOrientation)]
|
||||
void mozUnlockOrientation();
|
||||
};
|
||||
|
@ -3,16 +3,17 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMTimeEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "mozilla/dom/TimeEvent.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsPresContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsDOMTimeEvent::nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
TimeEvent::TimeEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalUIEvent(false, 0)),
|
||||
mDetail(0)
|
||||
@ -43,18 +44,18 @@ nsDOMTimeEvent::nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMTimeEvent, nsDOMEvent,
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(TimeEvent, nsDOMEvent,
|
||||
mView)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTimeEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTimeEvent, nsDOMEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(TimeEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(TimeEvent, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTimeEvent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TimeEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTimeEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTimeEvent::GetView(nsIDOMWindow** aView)
|
||||
TimeEvent::GetView(nsIDOMWindow** aView)
|
||||
{
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
@ -62,16 +63,16 @@ nsDOMTimeEvent::GetView(nsIDOMWindow** aView)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTimeEvent::GetDetail(int32_t* aDetail)
|
||||
TimeEvent::GetDetail(int32_t* aDetail)
|
||||
{
|
||||
*aDetail = mDetail;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg,
|
||||
nsIDOMWindow* aViewArg,
|
||||
int32_t aDetailArg)
|
||||
TimeEvent::InitTimeEvent(const nsAString& aTypeArg,
|
||||
nsIDOMWindow* aViewArg,
|
||||
int32_t aDetailArg)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, false /*doesn't bubble*/,
|
||||
false /*can't cancel*/);
|
||||
@ -83,11 +84,18 @@ nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMTimeEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMTimeEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
{
|
||||
nsDOMTimeEvent* it = new nsDOMTimeEvent(aOwner, aPresContext, aEvent);
|
||||
TimeEvent* it = new TimeEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -3,24 +3,27 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef NS_DOMTIMEEVENT_H_
|
||||
#define NS_DOMTIMEEVENT_H_
|
||||
#ifndef mozilla_dom_TimeEvent_h_
|
||||
#define mozilla_dom_TimeEvent_h_
|
||||
|
||||
#include "nsIDOMTimeEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "mozilla/dom/TimeEventBinding.h"
|
||||
|
||||
class nsDOMTimeEvent MOZ_FINAL : public nsDOMEvent,
|
||||
public nsIDOMTimeEvent
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TimeEvent MOZ_FINAL : public nsDOMEvent,
|
||||
public nsIDOMTimeEvent
|
||||
{
|
||||
public:
|
||||
nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent);
|
||||
TimeEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent);
|
||||
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMTimeEvent, nsDOMEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TimeEvent, nsDOMEvent)
|
||||
|
||||
// nsIDOMTimeEvent interface:
|
||||
NS_DECL_NSIDOMTIMEEVENT
|
||||
@ -31,7 +34,7 @@ public:
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::TimeEventBinding::Wrap(aCx, aScope, this);
|
||||
return TimeEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
int32_t Detail() const
|
||||
@ -45,7 +48,7 @@ public:
|
||||
}
|
||||
|
||||
void InitTimeEvent(const nsAString& aType, nsIDOMWindow* aView,
|
||||
int32_t aDetail, mozilla::ErrorResult& aRv)
|
||||
int32_t aDetail, ErrorResult& aRv)
|
||||
{
|
||||
aRv = InitTimeEvent(aType, aView, aDetail);
|
||||
}
|
||||
@ -55,4 +58,7 @@ private:
|
||||
int32_t mDetail;
|
||||
};
|
||||
|
||||
#endif // NS_DOMTIMEEVENT_H_
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_TimeEvent_h_
|
@ -7,7 +7,6 @@
|
||||
TEST_TOOL_DIRS += ['test']
|
||||
|
||||
EXPORTS += [
|
||||
'nsDOMTimeEvent.h',
|
||||
'nsISMILAttr.h',
|
||||
'nsISMILType.h',
|
||||
'nsSMILAnimationController.h',
|
||||
@ -32,8 +31,11 @@ EXPORTS += [
|
||||
'nsSMILValue.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'TimeEvent.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsDOMTimeEvent.cpp',
|
||||
'nsSMILAnimationController.cpp',
|
||||
'nsSMILAnimationFunction.cpp',
|
||||
'nsSMILCompositor.cpp',
|
||||
@ -57,6 +59,7 @@ UNIFIED_SOURCES += [
|
||||
'SMILEnumType.cpp',
|
||||
'SMILIntegerType.cpp',
|
||||
'SMILStringType.cpp',
|
||||
'TimeEvent.cpp',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
@ -9,6 +9,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
|
||||
const NETWORKMANAGER_CONTRACTID = "@mozilla.org/network/manager;1";
|
||||
const NETWORKMANAGER_CID =
|
||||
@ -64,6 +65,7 @@ const NETWORK_INTERFACE_DOWN = "down";
|
||||
|
||||
const TETHERING_STATE_ONGOING = "ongoing";
|
||||
const TETHERING_STATE_IDLE = "idle";
|
||||
const TETHERING_STATE_ACTIVE = "active";
|
||||
|
||||
// Settings DB path for USB tethering.
|
||||
const SETTINGS_USB_ENABLED = "tethering.usb.enabled";
|
||||
@ -78,6 +80,9 @@ const SETTINGS_USB_DNS2 = "tethering.usb.dns2";
|
||||
const SETTINGS_WIFI_DHCPSERVER_STARTIP = "tethering.wifi.dhcpserver.startip";
|
||||
const SETTINGS_WIFI_DHCPSERVER_ENDIP = "tethering.wifi.dhcpserver.endip";
|
||||
|
||||
// Settings DB patch for dun required setting.
|
||||
const SETTINGS_DUN_REQUIRED = "tethering.dun.required";
|
||||
|
||||
// Default value for USB tethering.
|
||||
const DEFAULT_USB_IP = "192.168.0.1";
|
||||
const DEFAULT_USB_PREFIX = "24";
|
||||
@ -90,6 +95,18 @@ const DEFAULT_DNS2 = "8.8.4.4";
|
||||
const DEFAULT_WIFI_DHCPSERVER_STARTIP = "192.168.1.10";
|
||||
const DEFAULT_WIFI_DHCPSERVER_ENDIP = "192.168.1.30";
|
||||
|
||||
const IPV4_ADDRESS_ANY = "0.0.0.0";
|
||||
const IPV6_ADDRESS_ANY = "::0";
|
||||
|
||||
const IPV4_MAX_PREFIX_LENGTH = 32;
|
||||
const IPV6_MAX_PREFIX_LENGTH = 128;
|
||||
|
||||
const PREF_DATA_DEFAULT_SERVICE_ID = "ril.data.defaultServiceId";
|
||||
const MOBILE_DUN_CONNECT_TIMEOUT = 30000;
|
||||
const MOBILE_DUN_RETRY_INTERVAL = 5000;
|
||||
const MOBILE_DUN_MAX_RETRIES = 5;
|
||||
|
||||
|
||||
const DEBUG = false;
|
||||
|
||||
function defineLazyRegExp(obj, name, pattern) {
|
||||
@ -198,10 +215,15 @@ NetworkManager.prototype = {
|
||||
}
|
||||
// Add extra host route. For example, mms proxy or mmsc.
|
||||
this.setExtraHostRoute(network);
|
||||
// Dun type is a special case where we add the default route to a
|
||||
// secondary table.
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.setSecondaryDefaultRoute(network);
|
||||
}
|
||||
#endif
|
||||
// Remove pre-created default route and let setAndConfigureActive()
|
||||
// to set default route only on preferred network
|
||||
gNetworkService.removeDefaultRoute(network.name);
|
||||
gNetworkService.removeDefaultRoute(network);
|
||||
this.setAndConfigureActive();
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// Update data connection when Wifi connected/disconnected
|
||||
@ -226,13 +248,17 @@ NetworkManager.prototype = {
|
||||
}
|
||||
// Remove extra host route. For example, mms proxy or mmsc.
|
||||
this.removeExtraHostRoute(network);
|
||||
// Remove secondary default route for dun.
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.removeSecondaryDefaultRoute(network);
|
||||
}
|
||||
#endif
|
||||
// Remove routing table in /proc/net/route
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
gNetworkService.resetRoutingTable(network);
|
||||
#ifdef MOZ_B2G_RIL
|
||||
} else if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
gNetworkService.removeDefaultRoute(network.name);
|
||||
gNetworkService.removeDefaultRoute(network);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -256,11 +282,20 @@ NetworkManager.prototype = {
|
||||
let regNetwork = subject.QueryInterface(Ci.nsINetworkInterface);
|
||||
// Add extra host route. For example, mms proxy or mmsc.
|
||||
this.setExtraHostRoute(regNetwork);
|
||||
// Dun type is a special case where we add the default route to a
|
||||
// secondary table.
|
||||
if (regNetwork.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.setSecondaryDefaultRoute(regNetwork);
|
||||
}
|
||||
break;
|
||||
case TOPIC_INTERFACE_UNREGISTERED:
|
||||
let unregNetwork = subject.QueryInterface(Ci.nsINetworkInterface);
|
||||
// Remove extra host route. For example, mms proxy or mmsc.
|
||||
this.removeExtraHostRoute(unregNetwork);
|
||||
// Remove secondary default route for dun.
|
||||
if (unregNetwork.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.removeSecondaryDefaultRoute(unregNetwork);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case TOPIC_MOZSETTINGS_CHANGED:
|
||||
@ -280,6 +315,10 @@ NetworkManager.prototype = {
|
||||
Services.obs.removeObserver(this, TOPIC_INTERFACE_UNREGISTERED);
|
||||
#endif
|
||||
Services.obs.removeObserver(this, TOPIC_INTERFACE_STATE_CHANGED);
|
||||
#ifdef MOZ_B2G_RIL
|
||||
this.dunConnectTimer.cancel();
|
||||
this.dunRetryTimer.cancel();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -291,6 +330,7 @@ NetworkManager.prototype = {
|
||||
let excludeMms = aMsg.json.excludeMms;
|
||||
let excludeSupl = aMsg.json.excludeSupl;
|
||||
let excludeIms = aMsg.json.excludeIms;
|
||||
let excludeDun = aMsg.json.excludeDun;
|
||||
#endif
|
||||
let interfaces = [];
|
||||
|
||||
@ -298,7 +338,8 @@ NetworkManager.prototype = {
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if ((i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS && excludeMms) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL && excludeSupl) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS && excludeIms)) {
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS && excludeIms) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN && excludeDun)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -341,7 +382,7 @@ NetworkManager.prototype = {
|
||||
#endif
|
||||
// Remove pre-created default route and let setAndConfigureActive()
|
||||
// to set default route only on preferred network
|
||||
gNetworkService.removeDefaultRoute(network.name);
|
||||
gNetworkService.removeDefaultRoute(network);
|
||||
this.setAndConfigureActive();
|
||||
Services.obs.notifyObservers(network, TOPIC_INTERFACE_REGISTERED, null);
|
||||
debug("Network '" + network.name + "' registered.");
|
||||
@ -456,6 +497,39 @@ NetworkManager.prototype = {
|
||||
gNetworkService.removeHostRouteWithResolve(network, mmsHosts);
|
||||
}
|
||||
},
|
||||
|
||||
setSecondaryDefaultRoute: function(network) {
|
||||
// First, we need to add a host route to the gateway in the secondary
|
||||
// routing table to make the gateway reachable. Host route takes the max
|
||||
// prefix and gateway address 'any'.
|
||||
let route = {
|
||||
ip: network.gateway,
|
||||
prefix: IPV4_MAX_PREFIX_LENGTH,
|
||||
gateway: IPV4_ADDRESS_ANY
|
||||
};
|
||||
gNetworkService.addSecondaryRoute(network.name, route);
|
||||
// Now we can add the default route through gateway. Default route takes the
|
||||
// min prefix and destination ip 'any'.
|
||||
route.ip = IPV4_ADDRESS_ANY;
|
||||
route.prefix = 0;
|
||||
route.gateway = network.gateway;
|
||||
gNetworkService.addSecondaryRoute(network.name, route);
|
||||
},
|
||||
|
||||
removeSecondaryDefaultRoute: function(network) {
|
||||
// Remove both host route and default route.
|
||||
let route = {
|
||||
ip: network.gateway,
|
||||
prefix: IPV4_MAX_PREFIX_LENGTH,
|
||||
gateway: IPV4_ADDRESS_ANY
|
||||
};
|
||||
gNetworkService.removeSecondaryRoute(network.name, route);
|
||||
|
||||
route.ip = IPV4_ADDRESS_ANY;
|
||||
route.prefix = "0";
|
||||
route.gateway = network.gateway;
|
||||
gNetworkService.removeSecondaryRoute(network.name, route);
|
||||
},
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
/**
|
||||
@ -586,6 +660,11 @@ NetworkManager.prototype = {
|
||||
|
||||
this.tetheringSettings[SETTINGS_WIFI_DHCPSERVER_STARTIP] = DEFAULT_WIFI_DHCPSERVER_STARTIP;
|
||||
this.tetheringSettings[SETTINGS_WIFI_DHCPSERVER_ENDIP] = DEFAULT_WIFI_DHCPSERVER_ENDIP;
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
this.tetheringSettings[SETTINGS_DUN_REQUIRED] =
|
||||
libcutils.property_get("ro.tethering.dun_required") === "1";
|
||||
#endif
|
||||
},
|
||||
|
||||
_requestCount: 0,
|
||||
@ -674,22 +753,138 @@ NetworkManager.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
dunConnectTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
|
||||
/**
|
||||
* Callback when dun connection fails to connect within timeout.
|
||||
*/
|
||||
onDunConnectTimerTimeout: function() {
|
||||
while (this._pendingTetheringRequests.length > 0) {
|
||||
debug("onDunConnectTimerTimeout: callback without network info.");
|
||||
let callback = this._pendingTetheringRequests.shift();
|
||||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dunRetryTimes: 0,
|
||||
dunRetryTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
|
||||
setupDunConnection: function() {
|
||||
this.dunRetryTimer.cancel();
|
||||
let ril = this.mRil.getRadioInterface(this.gDataDefaultServiceId);
|
||||
|
||||
if (ril.rilContext && ril.rilContext.data &&
|
||||
ril.rilContext.data.state === "registered") {
|
||||
this.dunRetryTimes = 0;
|
||||
ril.setupDataCallByType("dun");
|
||||
this.dunConnectTimer.cancel();
|
||||
this.dunConnectTimer.
|
||||
initWithCallback(this.onDunConnectTimerTimeout.bind(this),
|
||||
MOBILE_DUN_CONNECT_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.dunRetryTimes++ >= this.MOBILE_DUN_MAX_RETRIES) {
|
||||
debug("setupDunConnection: max retries reached.");
|
||||
this.dunRetryTimes = 0;
|
||||
// same as dun connect timeout.
|
||||
this.onDunConnectTimerTimeout();
|
||||
return;
|
||||
}
|
||||
|
||||
debug("Data not ready, retry dun after " + MOBILE_DUN_RETRY_INTERVAL + " ms.");
|
||||
this.dunRetryTimer.
|
||||
initWithCallback(this.setupDunConnection.bind(this),
|
||||
MOBILE_DUN_RETRY_INTERVAL, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
_pendingTetheringRequests: [],
|
||||
_dunActiveUsers: 0,
|
||||
handleDunConnection: function(enable, callback) {
|
||||
debug("handleDunConnection: " + enable);
|
||||
let dun = this.getNetworkInterface(
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN);
|
||||
|
||||
if (!enable) {
|
||||
this._dunActiveUsers--;
|
||||
if (this._dunActiveUsers > 0) {
|
||||
debug("Dun still needed by others, do not disconnect.")
|
||||
return;
|
||||
}
|
||||
|
||||
this.dunRetryTimes = 0;
|
||||
this.dunRetryTimer.cancel();
|
||||
this.dunConnectTimer.cancel();
|
||||
this._pendingTetheringRequests = [];
|
||||
|
||||
if (dun && (dun.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED)) {
|
||||
this.mRil.getRadioInterface(this.gDataDefaultServiceId)
|
||||
.deactivateDataCallByType("dun");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this._dunActiveUsers++;
|
||||
if (!dun || (dun.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED)) {
|
||||
debug("DUN data call inactive, setup dun data call!")
|
||||
this._pendingTetheringRequests.push(callback);
|
||||
this.dunRetryTimes = 0;
|
||||
this.setupDunConnection();
|
||||
|
||||
return;
|
||||
}
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = dun.name;
|
||||
callback(dun);
|
||||
},
|
||||
#endif
|
||||
|
||||
handleUSBTetheringToggle: function(enable) {
|
||||
debug("handleUSBTetheringToggle: " + enable);
|
||||
if (enable &&
|
||||
(this._usbTetheringAction === TETHERING_STATE_ONGOING ||
|
||||
this._usbTetheringAction === TETHERING_STATE_ACTIVE)) {
|
||||
debug("Usb tethering already connecting/connected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enable &&
|
||||
this._usbTetheringAction === TETHERING_STATE_IDLE) {
|
||||
debug("Usb tethering already disconnected.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
this.tetheringSettings[SETTINGS_USB_ENABLED] = false;
|
||||
gNetworkService.enableUsbRndis(false, this.enableUsbRndisResult.bind(this));
|
||||
return;
|
||||
}
|
||||
|
||||
this.tetheringSettings[SETTINGS_USB_ENABLED] = true;
|
||||
this._usbTetheringAction = TETHERING_STATE_ONGOING;
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
|
||||
this.handleDunConnection(true, function(network) {
|
||||
if (!network){
|
||||
this.usbTetheringResultReport("Dun connection failed");
|
||||
return;
|
||||
}
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = network.name;
|
||||
gNetworkService.enableUsbRndis(true, this.enableUsbRndisResult.bind(this));
|
||||
}.bind(this));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this.active) {
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = this.active.name
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = this.active.name;
|
||||
} else {
|
||||
let mobile = this.getNetworkInterface(Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE);
|
||||
if (mobile) {
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = mobile.name;
|
||||
}
|
||||
}
|
||||
this.tetheringSettings[SETTINGS_USB_ENABLED] = true;
|
||||
gNetworkService.enableUsbRndis(true, this.enableUsbRndisResult.bind(this));
|
||||
},
|
||||
|
||||
@ -753,8 +948,28 @@ NetworkManager.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
enableWifiTethering: function(enable, config, callback) {
|
||||
// Fill in config's required fields.
|
||||
config.ifname = this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface;
|
||||
config.internalIfname = this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface;
|
||||
config.externalIfname = this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface;
|
||||
|
||||
gNetworkService.setWifiTethering(enable, config, (function(error) {
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// Disconnect dun on error or when wifi tethering is disabled.
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED] &&
|
||||
(!enable || error)) {
|
||||
this.handleDunConnection(false);
|
||||
}
|
||||
#endif
|
||||
let resetSettings = error;
|
||||
this.notifyError(resetSettings, callback, error);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
// Enable/disable WiFi tethering by sending commands to netd.
|
||||
setWifiTethering: function(enable, network, config, callback) {
|
||||
debug("setWifiTethering: " + enable);
|
||||
if (!network) {
|
||||
this.notifyError(true, callback, "invalid network information");
|
||||
return;
|
||||
@ -765,22 +980,34 @@ NetworkManager.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
this.enableWifiTethering(false, config, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface = network.name;
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
|
||||
this.handleDunConnection(true, function(config, callback, network) {
|
||||
if (!network) {
|
||||
this.notifyError(true, callback, "Dun connection failed");
|
||||
return;
|
||||
}
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface = network.name;
|
||||
this.enableWifiTethering(true, config, callback);
|
||||
}.bind(this, config, callback));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
let mobile = this.getNetworkInterface(Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE);
|
||||
// Update the real interface name
|
||||
if (mobile) {
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface = mobile.name;
|
||||
}
|
||||
|
||||
config.ifname = this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface;
|
||||
config.internalIfname = this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface;
|
||||
config.externalIfname = this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface;
|
||||
|
||||
gNetworkService.setWifiTethering(enable, config, (function(error) {
|
||||
let resetSettings = error;
|
||||
this.notifyError(resetSettings, callback, error);
|
||||
}).bind(this));
|
||||
this.enableWifiTethering(true, config, callback);
|
||||
},
|
||||
|
||||
// Enable/disable USB tethering by sending commands to netd.
|
||||
@ -816,7 +1043,11 @@ NetworkManager.prototype = {
|
||||
|
||||
enableUsbRndisResult: function(success, enable) {
|
||||
if (success) {
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].internalInterface = this.getUsbInterface();
|
||||
// If enable is false, don't find usb interface cause it is already down,
|
||||
// just use the internal interface in settings.
|
||||
if (enable) {
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].internalInterface = this.getUsbInterface();
|
||||
}
|
||||
this.setUSBTethering(enable,
|
||||
this._tetheringInterface[TETHERING_TYPE_USB],
|
||||
this.usbTetheringResultReport.bind(this));
|
||||
@ -829,14 +1060,29 @@ NetworkManager.prototype = {
|
||||
usbTetheringResultReport: function(error) {
|
||||
let settingsLock = gSettingsService.createLock();
|
||||
|
||||
this._usbTetheringAction = TETHERING_STATE_IDLE;
|
||||
// Disable tethering settings when fail to enable it.
|
||||
if (error) {
|
||||
this.tetheringSettings[SETTINGS_USB_ENABLED] = false;
|
||||
settingsLock.set("tethering.usb.enabled", false, null);
|
||||
// Skip others request when we found an error.
|
||||
this._requestCount = 0;
|
||||
this._usbTetheringAction = TETHERING_STATE_IDLE;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
|
||||
this.handleDunConnection(false);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (this.tetheringSettings[SETTINGS_USB_ENABLED]) {
|
||||
this._usbTetheringAction = TETHERING_STATE_ACTIVE;
|
||||
} else {
|
||||
this._usbTetheringAction = TETHERING_STATE_IDLE;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
|
||||
this.handleDunConnection(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
this.handleLastRequest();
|
||||
}
|
||||
},
|
||||
@ -857,11 +1103,43 @@ NetworkManager.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// We can not use network.type only to check if it's dun, cause if it is
|
||||
// shared with default, the returned type would always be default, see bug
|
||||
// 939046. In most cases, if dun is required, it should not be shared with
|
||||
// default.
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED] &&
|
||||
(network.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN ||
|
||||
this.mRil.getRadioInterface(this.gDataDefaultServiceId)
|
||||
.getDataCallStateByType("dun") ===
|
||||
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED)) {
|
||||
this.dunConnectTimer.cancel();
|
||||
debug("DUN data call connected, process callbacks.");
|
||||
while (this._pendingTetheringRequests.length > 0) {
|
||||
let callback = this._pendingTetheringRequests.shift();
|
||||
if (typeof callback === 'function') {
|
||||
callback(network);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!this.tetheringSettings[SETTINGS_USB_ENABLED]) {
|
||||
debug("Usb tethering settings is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED] &&
|
||||
network.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN &&
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface ===
|
||||
network.name) {
|
||||
debug("Dun required and dun interface is the same");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this._tetheringInterface[TETHERING_TYPE_USB].externalInterface ===
|
||||
this.active.name) {
|
||||
debug("The active interface is the same");
|
||||
@ -973,6 +1251,15 @@ let CaptivePortalDetectionHelper = (function() {
|
||||
XPCOMUtils.defineLazyServiceGetter(NetworkManager.prototype, "mRil",
|
||||
"@mozilla.org/ril;1",
|
||||
"nsIRadioInterfaceLayer");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(NetworkManager.prototype,
|
||||
"gDataDefaultServiceId", function() {
|
||||
try {
|
||||
return Services.prefs.getIntPref(PREF_DATA_DEFAULT_SERVICE_ID);
|
||||
} catch(e) {}
|
||||
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([NetworkManager]);
|
||||
|
@ -305,11 +305,12 @@ NetworkService.prototype = {
|
||||
this.setNetworkProxy(network);
|
||||
},
|
||||
|
||||
removeDefaultRoute: function(ifname) {
|
||||
if(DEBUG) debug("Remove default route for " + ifname);
|
||||
removeDefaultRoute: function(network) {
|
||||
if(DEBUG) debug("Remove default route for " + network.name);
|
||||
let options = {
|
||||
cmd: "removeDefaultRoute",
|
||||
ifname: ifname
|
||||
ifname: network.name,
|
||||
gateway: network.gateway
|
||||
};
|
||||
this.controlMessage(options, function() {});
|
||||
},
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include <limits>
|
||||
#include "mozilla/dom/network/NetUtils.h"
|
||||
|
||||
#include <sys/types.h> // struct addrinfo
|
||||
#include <sys/socket.h> // getaddrinfo(), freeaddrinfo()
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h> // inet_ntop()
|
||||
|
||||
#define _DEBUG 0
|
||||
|
||||
#define WARN(args...) __android_log_print(ANDROID_LOG_WARN, "NetworkUtils", ## args)
|
||||
@ -222,6 +227,24 @@ static uint32_t makeMask(const uint32_t prefixLength)
|
||||
return ntohl(mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get the network part of an ip from prefix.
|
||||
* param ip must be in network byte order.
|
||||
*/
|
||||
static char* getNetworkAddr(const uint32_t ip, const uint32_t prefix)
|
||||
{
|
||||
uint32_t mask = 0, subnet = 0;
|
||||
|
||||
mask = ~mask << (32 - prefix);
|
||||
mask = htonl(mask);
|
||||
subnet = ip & mask;
|
||||
|
||||
struct in_addr addr;
|
||||
addr.s_addr = subnet;
|
||||
|
||||
return inet_ntoa(addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to split string by seperator, store split result as an nsTArray.
|
||||
*/
|
||||
@ -285,6 +308,23 @@ static void getIFProperties(const char* ifname, IFProperties& prop)
|
||||
property_get(key, prop.dns2, "");
|
||||
}
|
||||
|
||||
static int getIpType(const char *aIp) {
|
||||
struct addrinfo hint, *ip_info = NULL;
|
||||
|
||||
memset(&hint, 0, sizeof(hint));
|
||||
hint.ai_family = AF_UNSPEC;
|
||||
hint.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo(aIp, NULL, &hint, &ip_info)) {
|
||||
return AF_UNSPEC;
|
||||
}
|
||||
|
||||
int type = ip_info->ai_family;
|
||||
freeaddrinfo(ip_info);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void postMessage(NetworkResultOptions& aResult)
|
||||
{
|
||||
MOZ_ASSERT(gNetworkUtils);
|
||||
@ -741,7 +781,20 @@ void NetworkUtils::enableNat(CommandChain* aChain,
|
||||
NetworkResultOptions& aResult)
|
||||
{
|
||||
char command[MAX_COMMAND_SIZE];
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1, "nat enable %s %s 0", GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
|
||||
|
||||
if (!GET_FIELD(mIp).IsEmpty() && !GET_FIELD(mPrefix).IsEmpty()) {
|
||||
uint32_t prefix = atoi(GET_CHAR(mPrefix));
|
||||
uint32_t ip = inet_addr(GET_CHAR(mIp));
|
||||
char* networkAddr = getNetworkAddr(ip, prefix);
|
||||
|
||||
// address/prefix will only take effect when secondary routing table exists.
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1, "nat enable %s %s 1 %s/%s",
|
||||
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname), networkAddr,
|
||||
GET_CHAR(mPrefix));
|
||||
} else {
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1, "nat enable %s %s 0",
|
||||
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
|
||||
}
|
||||
|
||||
doCommand(command, aChain, aCallback);
|
||||
}
|
||||
@ -751,7 +804,19 @@ void NetworkUtils::disableNat(CommandChain* aChain,
|
||||
NetworkResultOptions& aResult)
|
||||
{
|
||||
char command[MAX_COMMAND_SIZE];
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1, "nat disable %s %s 0", GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
|
||||
|
||||
if (!GET_FIELD(mIp).IsEmpty() && !GET_FIELD(mPrefix).IsEmpty()) {
|
||||
uint32_t prefix = atoi(GET_CHAR(mPrefix));
|
||||
uint32_t ip = inet_addr(GET_CHAR(mIp));
|
||||
char* networkAddr = getNetworkAddr(ip, prefix);
|
||||
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1, "nat disable %s %s 1 %s/%s",
|
||||
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname), networkAddr,
|
||||
GET_CHAR(mPrefix));
|
||||
} else {
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1, "nat disable %s %s 0",
|
||||
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
|
||||
}
|
||||
|
||||
doCommand(command, aChain, aCallback);
|
||||
}
|
||||
@ -1110,18 +1175,40 @@ bool NetworkUtils::setDNS(NetworkParams& aOptions)
|
||||
*/
|
||||
bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
char gateway[128];
|
||||
|
||||
if (aOptions.mGateway_str.IsEmpty()) {
|
||||
char key[PROPERTY_KEY_MAX];
|
||||
snprintf(key, sizeof key - 1, "net.%s.gw", autoIfname.get());
|
||||
property_get(key, gateway, "");
|
||||
} else {
|
||||
MOZ_ASSERT(strlen(GET_CHAR(mGateway_str)) < sizeof gateway);
|
||||
strncpy(gateway, GET_CHAR(mGateway_str), sizeof(gateway) - 1);
|
||||
}
|
||||
|
||||
int type = getIpType(gateway);
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == AF_INET6) {
|
||||
if (!aOptions.mOldIfname.IsEmpty()) {
|
||||
mNetUtils->do_ifc_remove_route(GET_CHAR(mOldIfname), "::", 0, NULL);
|
||||
}
|
||||
|
||||
mNetUtils->do_ifc_add_route(autoIfname.get(), "::", 0, gateway);
|
||||
|
||||
setDNS(aOptions);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* type == AF_INET */
|
||||
if (!aOptions.mOldIfname.IsEmpty()) {
|
||||
mNetUtils->do_ifc_remove_default_route(GET_CHAR(mOldIfname));
|
||||
}
|
||||
|
||||
IFProperties ifprops;
|
||||
getIFProperties(GET_CHAR(mIfname), ifprops);
|
||||
|
||||
if (aOptions.mGateway_str.IsEmpty()) {
|
||||
mNetUtils->do_ifc_set_default_route(GET_CHAR(mIfname), inet_addr(ifprops.gateway));
|
||||
} else {
|
||||
mNetUtils->do_ifc_set_default_route(GET_CHAR(mIfname), inet_addr(GET_CHAR(mGateway_str)));
|
||||
}
|
||||
mNetUtils->do_ifc_set_default_route(autoIfname.get(), inet_addr(gateway));
|
||||
|
||||
setDNS(aOptions);
|
||||
return true;
|
||||
@ -1132,7 +1219,17 @@ bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
|
||||
*/
|
||||
bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
|
||||
{
|
||||
mNetUtils->do_ifc_remove_default_route(GET_CHAR(mIfname));
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
|
||||
|
||||
int type = getIpType(autoGateway.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mNetUtils->do_ifc_remove_route(GET_CHAR(mIfname),
|
||||
type == AF_INET ? "0.0.0.0" : "::",
|
||||
0, autoGateway.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1141,9 +1238,22 @@ bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
|
||||
*/
|
||||
bool NetworkUtils::addHostRoute(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
|
||||
int type, prefix;
|
||||
|
||||
uint32_t length = aOptions.mHostnames.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
mNetUtils->do_ifc_add_route(GET_CHAR(mIfname), GET_CHAR(mHostnames[i]), 32, GET_CHAR(mGateway));
|
||||
NS_ConvertUTF16toUTF8 autoHostname(aOptions.mHostnames[i]);
|
||||
|
||||
type = getIpType(autoHostname.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
prefix = type == AF_INET ? 32 : 128;
|
||||
mNetUtils->do_ifc_add_route(autoIfname.get(), autoHostname.get(), prefix,
|
||||
autoGateway.get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1153,9 +1263,22 @@ bool NetworkUtils::addHostRoute(NetworkParams& aOptions)
|
||||
*/
|
||||
bool NetworkUtils::removeHostRoute(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
|
||||
int type, prefix;
|
||||
|
||||
uint32_t length = aOptions.mHostnames.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
mNetUtils->do_ifc_remove_route(GET_CHAR(mIfname), GET_CHAR(mHostnames[i]), 32, GET_CHAR(mGateway));
|
||||
NS_ConvertUTF16toUTF8 autoHostname(aOptions.mHostnames[i]);
|
||||
|
||||
type = getIpType(autoHostname.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
prefix = type == AF_INET ? 32 : 128;
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), autoHostname.get(), prefix,
|
||||
autoGateway.get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1171,8 +1294,48 @@ bool NetworkUtils::removeHostRoutes(NetworkParams& aOptions)
|
||||
|
||||
bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
||||
{
|
||||
uint32_t ip = inet_addr(GET_CHAR(mIp));
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
NS_ConvertUTF16toUTF8 autoIp(aOptions.mIp);
|
||||
|
||||
int type = getIpType(autoIp.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t prefixLength = GET_FIELD(mPrefixLength);
|
||||
|
||||
if (type == AF_INET6) {
|
||||
// Calculate subnet.
|
||||
struct in6_addr in6;
|
||||
if (inet_pton(AF_INET6, autoIp.get(), &in6) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t p, i, p1, mask;
|
||||
p = prefixLength;
|
||||
i = 0;
|
||||
while (i < 4) {
|
||||
p1 = p > 32 ? 32 : p;
|
||||
p -= p1;
|
||||
mask = p1 ? ~0x0 << (32 - p1) : 0;
|
||||
in6.s6_addr32[i++] &= htonl(mask);
|
||||
}
|
||||
|
||||
char subnetStr[INET6_ADDRSTRLEN];
|
||||
if (!inet_ntop(AF_INET6, &in6, subnetStr, sizeof subnetStr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove default route.
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), "::", 0, NULL);
|
||||
|
||||
// Remove subnet route.
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), subnetStr, prefixLength, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* type == AF_INET */
|
||||
uint32_t ip = inet_addr(autoIp.get());
|
||||
uint32_t netmask = makeMask(prefixLength);
|
||||
uint32_t subnet = ip & netmask;
|
||||
const char* gateway = "0.0.0.0";
|
||||
@ -1180,8 +1343,8 @@ bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
||||
addr.s_addr = subnet;
|
||||
const char* dst = inet_ntoa(addr);
|
||||
|
||||
mNetUtils->do_ifc_remove_default_route(GET_CHAR(mIfname));
|
||||
mNetUtils->do_ifc_remove_route(GET_CHAR(mIfname), dst, prefixLength, gateway);
|
||||
mNetUtils->do_ifc_remove_default_route(autoIfname.get());
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), dst, prefixLength, gateway);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4215,6 +4215,7 @@ RILNetworkInterface.prototype = {
|
||||
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
|
||||
NETWORK_TYPE_MOBILE_SUPL: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL,
|
||||
NETWORK_TYPE_MOBILE_IMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS,
|
||||
NETWORK_TYPE_MOBILE_DUN: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN,
|
||||
// The network manager should only need to add the host route for "other"
|
||||
// types, which is the same handling method as the supl type. So let the
|
||||
// definition of other types to be the same as the one of supl type.
|
||||
@ -4250,6 +4251,10 @@ RILNetworkInterface.prototype = {
|
||||
if (this.connectedTypes.indexOf("ims") != -1) {
|
||||
return this.NETWORK_TYPE_MOBILE_IMS;
|
||||
}
|
||||
if (this.connectedTypes.indexOf("dun") != -1) {
|
||||
return this.NETWORK_TYPE_MOBILE_DUN;
|
||||
}
|
||||
|
||||
return this.NETWORK_TYPE_MOBILE_OTHERS;
|
||||
},
|
||||
|
||||
|
@ -51,7 +51,6 @@ using namespace mozilla::system;
|
||||
namespace {
|
||||
|
||||
NS_DEFINE_CID(kWifiWorkerCID, NS_WIFIWORKER_CID);
|
||||
NS_DEFINE_CID(kNetworkServiceCID, NS_INETWORKSERVICE_IID);
|
||||
|
||||
// Doesn't carry a reference, we're owned by services.
|
||||
SystemWorkerManager *gInstance = nullptr;
|
||||
@ -242,7 +241,7 @@ SystemWorkerManager::RegisterNfcWorker(JS::Handle<JS::Value> aWorker,
|
||||
nsresult
|
||||
SystemWorkerManager::InitNetd(JSContext *cx)
|
||||
{
|
||||
nsCOMPtr<nsIWorkerHolder> worker = do_GetService(kNetworkServiceCID);
|
||||
nsCOMPtr<nsIWorkerHolder> worker = do_GetService("@mozilla.org/network/service;1");
|
||||
NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
|
||||
mNetdWorker = worker;
|
||||
return NS_OK;
|
||||
|
@ -20,12 +20,13 @@ interface nsINetworkInterfaceList : nsISupports
|
||||
nsINetworkInterface getInterface(in long interfaceIndex);
|
||||
};
|
||||
|
||||
[scriptable, uuid(e3cf9355-086e-46e3-bb3d-378bd58d578b)]
|
||||
[scriptable, uuid(ee0e7cd7-1baa-44fd-86cb-f70acb549163)]
|
||||
interface nsINetworkInterfaceListService : nsISupports
|
||||
{
|
||||
const long LIST_NOT_INCLUDE_MMS_INTERFACES = (1 << 0);
|
||||
const long LIST_NOT_INCLUDE_SUPL_INTERFACES = (1 << 1);
|
||||
const long LIST_NOT_INCLUDE_IMS_INTERFACES = (1 << 2);
|
||||
const long LIST_NOT_INCLUDE_DUN_INTERFACES = (1 << 3);
|
||||
|
||||
/**
|
||||
* Obtain a list of network interfaces that satisfy the specified condition.
|
||||
|
@ -9,7 +9,7 @@ interface nsIWifiTetheringCallback;
|
||||
/**
|
||||
* Information about networks that is exposed to network manager API consumers.
|
||||
*/
|
||||
[scriptable, uuid(4d738144-ac69-48ef-b97e-49cc627fae67)]
|
||||
[scriptable, uuid(0e5e8fca-0f46-416c-8bee-b3fea4bbdfd3)]
|
||||
interface nsINetworkInterface : nsISupports
|
||||
{
|
||||
const long NETWORK_STATE_UNKNOWN = -1;
|
||||
@ -33,6 +33,7 @@ interface nsINetworkInterface : nsISupports
|
||||
const long NETWORK_TYPE_MOBILE_SUPL = 3;
|
||||
const long NETWORK_TYPE_WIFI_P2P = 4;
|
||||
const long NETWORK_TYPE_MOBILE_IMS = 5;
|
||||
const long NETWORK_TYPE_MOBILE_DUN = 6;
|
||||
|
||||
/**
|
||||
* Network type. One of the NETWORK_TYPE_* constants.
|
||||
|
@ -104,7 +104,7 @@ interface nsIUpdateUpStreamCallback : nsISupports
|
||||
/**
|
||||
* Provide network services.
|
||||
*/
|
||||
[scriptable, uuid(baec696c-c78d-42db-8b44-603f8fbfafb4)]
|
||||
[scriptable, uuid(f96461fa-e844-45d2-a6c3-8cd23ab0916b)]
|
||||
interface nsINetworkService : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -246,10 +246,10 @@ interface nsINetworkService : nsISupports
|
||||
/**
|
||||
* Remove default route.
|
||||
*
|
||||
* @param interfaceName
|
||||
* @param networkInterface
|
||||
* The network interface we want remove from the default route.
|
||||
*/
|
||||
void removeDefaultRoute(in DOMString interfaceName);
|
||||
void removeDefaultRoute(in nsINetworkInterface networkInterface);
|
||||
|
||||
/**
|
||||
* Add host route.
|
||||
|
@ -90,6 +90,8 @@ interface GlobalEventHandlers {
|
||||
|
||||
// Pointer events handlers
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointercancel;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerdown;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerup;
|
||||
|
@ -20,7 +20,8 @@ dictionary NetworkCommandOptions
|
||||
DOMString dns2_str; // for "setDNS", "setDefaultRouteAndDNS".
|
||||
DOMString oldIfname; // for "setDefaultRouteAndDNS".
|
||||
DOMString gateway_str; // for "setDefaultRouteAndDNS".
|
||||
DOMString gateway; // for "addHostRoute", "removeHostRoute".
|
||||
DOMString gateway; // for "addHostRoute", "removeHostRoute",
|
||||
// "removeDefaultRoute".
|
||||
sequence<DOMString> hostnames; // for "addHostRoute", "removeHostRoute".
|
||||
DOMString mode; // for "setWifiOperationMode".
|
||||
boolean report; // for "setWifiOperationMode".
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
interface WindowProxy;
|
||||
|
||||
[Func="nsDOMTouchEvent::PrefEnabled"]
|
||||
[Func="mozilla::dom::TouchEvent::PrefEnabled"]
|
||||
interface TouchEvent : UIEvent {
|
||||
readonly attribute TouchList touches;
|
||||
readonly attribute TouchList targetTouches;
|
||||
|
@ -10,7 +10,7 @@
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Func="nsDOMTouchList::PrefEnabled"]
|
||||
[Func="mozilla::dom::TouchList::PrefEnabled"]
|
||||
interface TouchList {
|
||||
[Pure]
|
||||
readonly attribute unsigned long length;
|
||||
|
@ -148,7 +148,7 @@ namespace {
|
||||
|
||||
const uint32_t kNoIndex = uint32_t(-1);
|
||||
|
||||
const JS::ContextOptions kRequiredJSContextOptions =
|
||||
const JS::ContextOptions kRequiredContextOptions =
|
||||
JS::ContextOptions().setDontReportUncaught(true)
|
||||
.setNoScriptRval(true);
|
||||
|
||||
@ -300,7 +300,7 @@ GenerateSharedWorkerKey(const nsACString& aScriptSpec, const nsACString& aName,
|
||||
}
|
||||
|
||||
void
|
||||
LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
|
||||
LoadRuntimeAndContextOptions(const char* aPrefName, void* /* aClosure */)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
@ -330,51 +330,47 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Runtime options.
|
||||
JS::RuntimeOptions runtimeOptions;
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"))) {
|
||||
runtimeOptions.setAsmJS(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("typeinference"))) {
|
||||
runtimeOptions.setTypeInference(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit"))) {
|
||||
runtimeOptions.setBaseline(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion"))) {
|
||||
runtimeOptions.setIon(true);
|
||||
}
|
||||
|
||||
// Common options.
|
||||
JS::ContextOptions commonOptions = kRequiredJSContextOptions;
|
||||
JS::ContextOptions commonContextOptions = kRequiredContextOptions;
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict"))) {
|
||||
commonOptions.setExtraWarnings(true);
|
||||
commonContextOptions.setExtraWarnings(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror"))) {
|
||||
commonOptions.setWerror(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"))) {
|
||||
commonOptions.setAsmJS(true);
|
||||
commonContextOptions.setWerror(true);
|
||||
}
|
||||
|
||||
// Content options.
|
||||
JS::ContextOptions contentOptions = commonOptions;
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit.content"))) {
|
||||
contentOptions.setBaseline(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion.content"))) {
|
||||
contentOptions.setIon(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("typeinference.content"))) {
|
||||
contentOptions.setTypeInference(true);
|
||||
}
|
||||
JS::ContextOptions contentContextOptions = commonContextOptions;
|
||||
|
||||
// Chrome options.
|
||||
JS::ContextOptions chromeOptions = commonOptions;
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit.chrome"))) {
|
||||
chromeOptions.setBaseline(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion.chrome"))) {
|
||||
chromeOptions.setIon(true);
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("typeinference.chrome"))) {
|
||||
chromeOptions.setTypeInference(true);
|
||||
}
|
||||
JS::ContextOptions chromeContextOptions = commonContextOptions;
|
||||
#ifdef DEBUG
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict.debug"))) {
|
||||
chromeOptions.setExtraWarnings(true);
|
||||
chromeContextOptions.setExtraWarnings(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
RuntimeService::SetDefaultJSContextOptions(contentOptions, chromeOptions);
|
||||
RuntimeService::SetDefaultRuntimeAndContextOptions(runtimeOptions,
|
||||
contentContextOptions,
|
||||
chromeContextOptions);
|
||||
|
||||
if (rts) {
|
||||
rts->UpdateAllWorkerJSContextOptions();
|
||||
rts->UpdateAllWorkerRuntimeAndContextOptions();
|
||||
}
|
||||
}
|
||||
|
||||
@ -771,6 +767,8 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
|
||||
JSSettings settings;
|
||||
aWorkerPrivate->CopyJSSettings(settings);
|
||||
|
||||
JS::RuntimeOptionsRef(aRuntime) = settings.runtimeOptions;
|
||||
|
||||
JSSettings::JSGCSettingsArray& gcSettings = settings.gcSettings;
|
||||
|
||||
// This is the real place where we set the max memory for the runtime.
|
||||
@ -1614,10 +1612,11 @@ RuntimeService::Init()
|
||||
|
||||
// Initialize JSSettings.
|
||||
if (!sDefaultJSSettings.gcSettings[0].IsSet()) {
|
||||
sDefaultJSSettings.chrome.contextOptions = kRequiredJSContextOptions;
|
||||
sDefaultJSSettings.runtimeOptions = JS::RuntimeOptions();
|
||||
sDefaultJSSettings.chrome.contextOptions = kRequiredContextOptions;
|
||||
sDefaultJSSettings.chrome.maxScriptRuntime = -1;
|
||||
sDefaultJSSettings.chrome.compartmentOptions.setVersion(JSVERSION_LATEST);
|
||||
sDefaultJSSettings.content.contextOptions = kRequiredJSContextOptions;
|
||||
sDefaultJSSettings.content.contextOptions = kRequiredContextOptions;
|
||||
sDefaultJSSettings.content.maxScriptRuntime = MAX_SCRIPT_RUN_TIME_SEC;
|
||||
#ifdef JS_GC_ZEAL
|
||||
sDefaultJSSettings.gcZealFrequency = JS_DEFAULT_ZEAL_FREQ;
|
||||
@ -1692,13 +1691,13 @@ RuntimeService::Init()
|
||||
PREF_DOM_WINDOW_DUMP_ENABLED,
|
||||
reinterpret_cast<void *>(WORKERPREF_DUMP))) ||
|
||||
#endif
|
||||
NS_FAILED(Preferences::RegisterCallback(LoadJSContextOptions,
|
||||
NS_FAILED(Preferences::RegisterCallback(LoadRuntimeAndContextOptions,
|
||||
PREF_JS_OPTIONS_PREFIX,
|
||||
nullptr)) ||
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall(
|
||||
LoadJSContextOptions,
|
||||
PREF_WORKERS_OPTIONS_PREFIX,
|
||||
nullptr)) ||
|
||||
LoadRuntimeAndContextOptions,
|
||||
PREF_WORKERS_OPTIONS_PREFIX,
|
||||
nullptr)) ||
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall(
|
||||
JSVersionChanged,
|
||||
PREF_WORKERS_LATEST_JS_VERSION,
|
||||
@ -1845,10 +1844,10 @@ RuntimeService::Cleanup()
|
||||
if (NS_FAILED(Preferences::UnregisterCallback(JSVersionChanged,
|
||||
PREF_WORKERS_LATEST_JS_VERSION,
|
||||
nullptr)) ||
|
||||
NS_FAILED(Preferences::UnregisterCallback(LoadJSContextOptions,
|
||||
NS_FAILED(Preferences::UnregisterCallback(LoadRuntimeAndContextOptions,
|
||||
PREF_JS_OPTIONS_PREFIX,
|
||||
nullptr)) ||
|
||||
NS_FAILED(Preferences::UnregisterCallback(LoadJSContextOptions,
|
||||
NS_FAILED(Preferences::UnregisterCallback(LoadRuntimeAndContextOptions,
|
||||
PREF_WORKERS_OPTIONS_PREFIX,
|
||||
nullptr)) ||
|
||||
#if DUMP_CONTROLLED_BY_PREF
|
||||
@ -2230,9 +2229,10 @@ RuntimeService::NoteIdleThread(WorkerThread* aThread)
|
||||
}
|
||||
|
||||
void
|
||||
RuntimeService::UpdateAllWorkerJSContextOptions()
|
||||
RuntimeService::UpdateAllWorkerRuntimeAndContextOptions()
|
||||
{
|
||||
BROADCAST_ALL_WORKERS(UpdateJSContextOptions,
|
||||
BROADCAST_ALL_WORKERS(UpdateRuntimeAndContextOptions,
|
||||
sDefaultJSSettings.runtimeOptions,
|
||||
sDefaultJSSettings.content.contextOptions,
|
||||
sDefaultJSSettings.chrome.contextOptions);
|
||||
}
|
||||
|
@ -174,16 +174,19 @@ public:
|
||||
}
|
||||
|
||||
static void
|
||||
SetDefaultJSContextOptions(const JS::ContextOptions& aContentOptions,
|
||||
const JS::ContextOptions& aChromeOptions)
|
||||
SetDefaultRuntimeAndContextOptions(
|
||||
const JS::RuntimeOptions& aRuntimeOptions,
|
||||
const JS::ContextOptions& aContentCxOptions,
|
||||
const JS::ContextOptions& aChromeCxOptions)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
sDefaultJSSettings.content.contextOptions = aContentOptions;
|
||||
sDefaultJSSettings.chrome.contextOptions = aChromeOptions;
|
||||
sDefaultJSSettings.runtimeOptions = aRuntimeOptions;
|
||||
sDefaultJSSettings.content.contextOptions = aContentCxOptions;
|
||||
sDefaultJSSettings.chrome.contextOptions = aChromeCxOptions;
|
||||
}
|
||||
|
||||
void
|
||||
UpdateAllWorkerJSContextOptions();
|
||||
UpdateAllWorkerRuntimeAndContextOptions();
|
||||
|
||||
void
|
||||
UpdateAllWorkerPreference(WorkerPreference aPref, bool aValue);
|
||||
|
@ -1515,25 +1515,32 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateJSContextOptionsRunnable MOZ_FINAL : public WorkerControlRunnable
|
||||
class UpdateRuntimeAndContextOptionsRunnable MOZ_FINAL : public WorkerControlRunnable
|
||||
{
|
||||
JS::ContextOptions mContentOptions;
|
||||
JS::ContextOptions mChromeOptions;
|
||||
JS::RuntimeOptions mRuntimeOptions;
|
||||
JS::ContextOptions mContentCxOptions;
|
||||
JS::ContextOptions mChromeCxOptions;
|
||||
|
||||
public:
|
||||
UpdateJSContextOptionsRunnable(WorkerPrivate* aWorkerPrivate,
|
||||
const JS::ContextOptions& aContentOptions,
|
||||
const JS::ContextOptions& aChromeOptions)
|
||||
UpdateRuntimeAndContextOptionsRunnable(
|
||||
WorkerPrivate* aWorkerPrivate,
|
||||
const JS::RuntimeOptions& aRuntimeOptions,
|
||||
const JS::ContextOptions& aContentCxOptions,
|
||||
const JS::ContextOptions& aChromeCxOptions)
|
||||
: WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount),
|
||||
mContentOptions(aContentOptions), mChromeOptions(aChromeOptions)
|
||||
mRuntimeOptions(aRuntimeOptions),
|
||||
mContentCxOptions(aContentCxOptions),
|
||||
mChromeCxOptions(aChromeCxOptions)
|
||||
{ }
|
||||
|
||||
private:
|
||||
virtual bool
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) MOZ_OVERRIDE
|
||||
{
|
||||
aWorkerPrivate->UpdateJSContextOptionsInternal(aCx, mContentOptions,
|
||||
mChromeOptions);
|
||||
aWorkerPrivate->UpdateRuntimeAndContextOptionsInternal(aCx,
|
||||
mRuntimeOptions,
|
||||
mContentCxOptions,
|
||||
mChromeCxOptions);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@ -2835,22 +2842,26 @@ WorkerPrivateParent<Derived>::GetInnerWindowId()
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
WorkerPrivateParent<Derived>::UpdateJSContextOptions(
|
||||
JSContext* aCx,
|
||||
const JS::ContextOptions& aContentOptions,
|
||||
const JS::ContextOptions& aChromeOptions)
|
||||
WorkerPrivateParent<Derived>::UpdateRuntimeAndContextOptions(
|
||||
JSContext* aCx,
|
||||
const JS::RuntimeOptions& aRuntimeOptions,
|
||||
const JS::ContextOptions& aContentCxOptions,
|
||||
const JS::ContextOptions& aChromeCxOptions)
|
||||
{
|
||||
AssertIsOnParentThread();
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mJSSettings.content.contextOptions = aContentOptions;
|
||||
mJSSettings.chrome.contextOptions = aChromeOptions;
|
||||
mJSSettings.runtimeOptions = aRuntimeOptions;
|
||||
mJSSettings.content.contextOptions = aContentCxOptions;
|
||||
mJSSettings.chrome.contextOptions = aChromeCxOptions;
|
||||
}
|
||||
|
||||
nsRefPtr<UpdateJSContextOptionsRunnable> runnable =
|
||||
new UpdateJSContextOptionsRunnable(ParentAsWorkerPrivate(), aContentOptions,
|
||||
aChromeOptions);
|
||||
nsRefPtr<UpdateRuntimeAndContextOptionsRunnable> runnable =
|
||||
new UpdateRuntimeAndContextOptionsRunnable(ParentAsWorkerPrivate(),
|
||||
aRuntimeOptions,
|
||||
aContentCxOptions,
|
||||
aChromeCxOptions);
|
||||
if (!runnable->Dispatch(aCx)) {
|
||||
NS_WARNING("Failed to update worker context options!");
|
||||
JS_ClearPendingException(aCx);
|
||||
@ -5488,17 +5499,21 @@ WorkerPrivate::RescheduleTimeoutTimer(JSContext* aCx)
|
||||
}
|
||||
|
||||
void
|
||||
WorkerPrivate::UpdateJSContextOptionsInternal(JSContext* aCx,
|
||||
const JS::ContextOptions& aContentOptions,
|
||||
const JS::ContextOptions& aChromeOptions)
|
||||
WorkerPrivate::UpdateRuntimeAndContextOptionsInternal(
|
||||
JSContext* aCx,
|
||||
const JS::RuntimeOptions& aRuntimeOptions,
|
||||
const JS::ContextOptions& aContentCxOptions,
|
||||
const JS::ContextOptions& aChromeCxOptions)
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
|
||||
JS::ContextOptionsRef(aCx) = IsChromeWorker() ? aChromeOptions : aContentOptions;
|
||||
JS::RuntimeOptionsRef(aCx) = aRuntimeOptions;
|
||||
JS::ContextOptionsRef(aCx) = IsChromeWorker() ? aChromeCxOptions : aContentCxOptions;
|
||||
|
||||
for (uint32_t index = 0; index < mChildWorkers.Length(); index++) {
|
||||
mChildWorkers[index]->UpdateJSContextOptions(aCx, aContentOptions,
|
||||
aChromeOptions);
|
||||
mChildWorkers[index]->UpdateRuntimeAndContextOptions(aCx, aRuntimeOptions,
|
||||
aContentCxOptions,
|
||||
aChromeCxOptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,8 +389,10 @@ public:
|
||||
GetInnerWindowId();
|
||||
|
||||
void
|
||||
UpdateJSContextOptions(JSContext* aCx, const JS::ContextOptions& aChromeOptions,
|
||||
const JS::ContextOptions& aContentOptions);
|
||||
UpdateRuntimeAndContextOptions(JSContext* aCx,
|
||||
const JS::RuntimeOptions& aRuntimeOptions,
|
||||
const JS::ContextOptions& aContentCxOptions,
|
||||
const JS::ContextOptions& aChromeCxOptions);
|
||||
|
||||
void
|
||||
UpdatePreference(JSContext* aCx, WorkerPreference aPref, bool aValue);
|
||||
@ -906,8 +908,11 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
UpdateJSContextOptionsInternal(JSContext* aCx, const JS::ContextOptions& aContentOptions,
|
||||
const JS::ContextOptions& aChromeOptions);
|
||||
UpdateRuntimeAndContextOptionsInternal(
|
||||
JSContext* aCx,
|
||||
const JS::RuntimeOptions& aRuntimeOptions,
|
||||
const JS::ContextOptions& aContentCxOptions,
|
||||
const JS::ContextOptions& aChromeCxOptions);
|
||||
|
||||
void
|
||||
UpdatePreferenceInternal(JSContext* aCx, WorkerPreference aPref, bool aValue);
|
||||
|
@ -107,6 +107,7 @@ struct JSSettings
|
||||
JSContentChromeSettings chrome;
|
||||
JSContentChromeSettings content;
|
||||
JSGCSettingsArray gcSettings;
|
||||
JS::RuntimeOptions runtimeOptions;
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
uint8_t gcZeal;
|
||||
|
@ -3,6 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <initguid.h>
|
||||
#include "DrawTargetD2D.h"
|
||||
#include "SourceSurfaceD2D.h"
|
||||
#include "SourceSurfaceD2DTarget.h"
|
||||
|
@ -338,11 +338,12 @@ ContainerRender(ContainerT* aContainer,
|
||||
// Composer2D will compose this layer so skip GPU composition
|
||||
// this time & reset composition flag for next composition phase
|
||||
layerToRender->SetLayerComposited(false);
|
||||
if (layerToRender->GetClearFB()) {
|
||||
nsIntRect clearRect = layerToRender->GetClearRect();
|
||||
if (!clearRect.IsEmpty()) {
|
||||
// Clear layer's visible rect on FrameBuffer with transparent pixels
|
||||
gfx::Rect aRect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
||||
compositor->clearFBRect(&aRect);
|
||||
layerToRender->SetClearFB(false);
|
||||
gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.width, clearRect.height);
|
||||
compositor->clearFBRect(&fbRect);
|
||||
layerToRender->SetClearRect(nsIntRect(0, 0, 0, 0));
|
||||
}
|
||||
} else {
|
||||
layerToRender->RenderLayer(clipRect);
|
||||
|
@ -862,7 +862,6 @@ LayerComposite::LayerComposite(LayerManagerComposite *aManager)
|
||||
, mShadowTransformSetByAnimation(false)
|
||||
, mDestroyed(false)
|
||||
, mLayerComposited(false)
|
||||
, mClearFB(false)
|
||||
{ }
|
||||
|
||||
LayerComposite::~LayerComposite()
|
||||
|
@ -363,9 +363,9 @@ public:
|
||||
mLayerComposited = value;
|
||||
}
|
||||
|
||||
void SetClearFB(bool value)
|
||||
void SetClearRect(const nsIntRect& aRect)
|
||||
{
|
||||
mClearFB = value;
|
||||
mClearRect = aRect;
|
||||
}
|
||||
|
||||
// These getters can be used anytime.
|
||||
@ -375,7 +375,7 @@ public:
|
||||
const gfx::Matrix4x4& GetShadowTransform() { return mShadowTransform; }
|
||||
bool GetShadowTransformSetByAnimation() { return mShadowTransformSetByAnimation; }
|
||||
bool HasLayerBeenComposited() { return mLayerComposited; }
|
||||
bool GetClearFB() { return mClearFB; }
|
||||
nsIntRect GetClearRect() { return mClearRect; }
|
||||
|
||||
protected:
|
||||
gfx::Matrix4x4 mShadowTransform;
|
||||
@ -388,7 +388,7 @@ protected:
|
||||
bool mShadowTransformSetByAnimation;
|
||||
bool mDestroyed;
|
||||
bool mLayerComposited;
|
||||
bool mClearFB;
|
||||
nsIntRect mClearRect;
|
||||
};
|
||||
|
||||
|
||||
|
@ -626,6 +626,7 @@ CompositorOGL::clearFBRect(const gfx::Rect* aRect)
|
||||
return;
|
||||
}
|
||||
|
||||
ScopedGLState scopedScissorTestState(mGLContext, LOCAL_GL_SCISSOR_TEST, true);
|
||||
ScopedScissorRect autoScissorRect(mGLContext, aRect->x, aRect->y, aRect->width, aRect->height);
|
||||
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
|
||||
|
@ -4,6 +4,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "UnixFdWatcher.h"
|
||||
|
||||
#ifdef CHROMIUM_LOG
|
||||
@ -111,9 +112,17 @@ UnixFdWatcher::SetFd(int aFd)
|
||||
{
|
||||
MOZ_ASSERT(MessageLoopForIO::current() == mIOLoop);
|
||||
MOZ_ASSERT(!IsOpen());
|
||||
MOZ_ASSERT(FdIsNonBlocking(aFd));
|
||||
|
||||
mFd = aFd;
|
||||
}
|
||||
|
||||
bool
|
||||
UnixFdWatcher::FdIsNonBlocking(int aFd)
|
||||
{
|
||||
int flags = TEMP_FAILURE_RETRY(fcntl(aFd, F_GETFL));
|
||||
return (flags > 0) && (flags & O_NONBLOCK);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ protected:
|
||||
void SetFd(int aFd);
|
||||
|
||||
private:
|
||||
static bool FdIsNonBlocking(int aFd);
|
||||
|
||||
MessageLoop* mIOLoop;
|
||||
ScopedClose mFd;
|
||||
MessageLoopForIO::FileDescriptorWatcher mReadWatcher;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user