Bug 1444580: Devirtualize pointer lock and screen orientation stuff. r=smaug

MozReview-Commit-ID: HzJcrHFCsOK
This commit is contained in:
Emilio Cobos Álvarez 2018-03-11 15:14:55 +01:00
Родитель b7609d9cce
Коммит 6fe64ed9a5
3 изменённых файлов: 34 добавлений и 56 удалений

Просмотреть файл

@ -1538,6 +1538,8 @@ nsIDocument::nsIDocument()
mHeaderData(nullptr),
mFlashClassification(FlashClassification::Unclassified),
mBoxObjectTable(nullptr),
mCurrentOrientationAngle(0),
mCurrentOrientationType(OrientationType::Portrait_primary),
mServoRestyleRootDirtyBits(0),
mThrowOnDynamicMarkupInsertionCounter(0),
mIgnoreOpensDuringUnloadCounter(0)
@ -1553,8 +1555,6 @@ nsDocument::nsDocument(const char* aContentType)
, mDelayFrameLoaderInitialization(false)
, mSynchronousDOMContentLoaded(false)
, mParserAborted(false)
, mCurrentOrientationAngle(0)
, mCurrentOrientationType(OrientationType::Portrait_primary)
, mReportedUseCounters(false)
, mXMLDeclarationBits(0)
, mOnloadBlockCount(0)
@ -11405,34 +11405,8 @@ nsIDocument::FullscreenEnabled(CallerType aCallerType)
return !GetFullscreenError(this, aCallerType == CallerType::System);
}
uint16_t
nsDocument::CurrentOrientationAngle() const
{
return mCurrentOrientationAngle;
}
OrientationType
nsDocument::CurrentOrientationType() const
{
return mCurrentOrientationType;
}
void
nsDocument::SetCurrentOrientation(mozilla::dom::OrientationType aType,
uint16_t aAngle)
{
mCurrentOrientationType = aType;
mCurrentOrientationAngle = aAngle;
}
Promise*
nsDocument::GetOrientationPendingPromise() const
{
return mOrientationPendingPromise;
}
void
nsDocument::SetOrientationPendingPromise(Promise* aPromise)
nsIDocument::SetOrientationPendingPromise(Promise* aPromise)
{
mOrientationPendingPromise = aPromise;
}
@ -11624,7 +11598,7 @@ PointerLockRequest::Run()
}
void
nsDocument::RequestPointerLock(Element* aElement, CallerType aCallerType)
nsIDocument::RequestPointerLock(Element* aElement, CallerType aCallerType)
{
NS_ASSERTION(aElement,
"Must pass non-null element to nsDocument::RequestPointerLock");
@ -11649,7 +11623,7 @@ nsDocument::RequestPointerLock(Element* aElement, CallerType aCallerType)
}
bool
nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
nsIDocument::SetPointerLock(Element* aElement, int aCursorStyle)
{
MOZ_ASSERT(!aElement || aElement->OwnerDoc() == this,
"We should be either unlocking pointer (aElement is nullptr), "

Просмотреть файл

@ -376,18 +376,8 @@ public:
//
already_AddRefed<nsSimpleContentList> BlockedTrackingNodes() const;
void RequestPointerLock(Element* aElement,
mozilla::dom::CallerType aCallerType) override;
bool SetPointerLock(Element* aElement, int aCursorStyle);
static void UnlockPointer(nsIDocument* aDoc = nullptr);
void SetCurrentOrientation(mozilla::dom::OrientationType aType,
uint16_t aAngle) override;
uint16_t CurrentOrientationAngle() const override;
mozilla::dom::OrientationType CurrentOrientationType() const override;
void SetOrientationPendingPromise(mozilla::dom::Promise* aPromise) override;
mozilla::dom::Promise* GetOrientationPendingPromise() const override;
virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override;
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
@ -458,13 +448,6 @@ public:
friend class nsCallRequestFullScreen;
// ScreenOrientation "pending promise" as described by
// http://www.w3.org/TR/screen-orientation/
RefPtr<mozilla::dom::Promise> mOrientationPendingPromise;
uint16_t mCurrentOrientationAngle;
mozilla::dom::OrientationType mCurrentOrientationType;
// Whether we have reported use counters for this document with Telemetry yet.
// Normally this is only done at document destruction time, but for image
// documents (SVG documents) that are not guaranteed to be destroyed, we

Просмотреть файл

@ -1967,19 +1967,33 @@ public:
*/
void DispatchFullscreenError(const char* aMessage);
virtual void RequestPointerLock(Element* aElement,
mozilla::dom::CallerType aCallerType) = 0;
void RequestPointerLock(Element* aElement, mozilla::dom::CallerType);
bool SetPointerLock(Element* aElement, int aCursorStyle);
static void UnlockPointer(nsIDocument* aDoc = nullptr);
// ScreenOrientation related APIs
virtual void SetCurrentOrientation(mozilla::dom::OrientationType aType,
uint16_t aAngle) = 0;
virtual uint16_t CurrentOrientationAngle() const = 0;
virtual mozilla::dom::OrientationType CurrentOrientationType() const = 0;
virtual void SetOrientationPendingPromise(mozilla::dom::Promise* aPromise) = 0;
virtual mozilla::dom::Promise* GetOrientationPendingPromise() const = 0;
void SetCurrentOrientation(mozilla::dom::OrientationType aType,
uint16_t aAngle)
{
mCurrentOrientationType = aType;
mCurrentOrientationAngle = aAngle;
}
uint16_t CurrentOrientationAngle() const
{
return mCurrentOrientationAngle;
}
mozilla::dom::OrientationType CurrentOrientationType() const
{
return mCurrentOrientationType;
}
void SetOrientationPendingPromise(mozilla::dom::Promise* aPromise);
mozilla::dom::Promise* GetOrientationPendingPromise() const
{
return mOrientationPendingPromise;
}
//----------------------------------------------------------------------
@ -4370,6 +4384,13 @@ protected:
nsExternalResourceMap mExternalResourceMap;
// ScreenOrientation "pending promise" as described by
// http://www.w3.org/TR/screen-orientation/
RefPtr<mozilla::dom::Promise> mOrientationPendingPromise;
uint16_t mCurrentOrientationAngle;
mozilla::dom::OrientationType mCurrentOrientationType;
public:
js::ExpandoAndGeneration mExpandoAndGeneration;