Bug 1444580: Devirtualize the scroll to ref stuff. r=smaug

MozReview-Commit-ID: AhtY8Y684A9
This commit is contained in:
Emilio Cobos Álvarez 2018-03-11 13:58:01 +01:00
Родитель 5c084a2cca
Коммит 50b16abb7e
3 изменённых файлов: 20 добавлений и 29 удалений

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

@ -1494,6 +1494,8 @@ nsIDocument::nsIDocument()
mDOMInteractiveSet(false), mDOMInteractiveSet(false),
mDOMCompleteSet(false), mDOMCompleteSet(false),
mAutoFocusFired(false), mAutoFocusFired(false),
mScrolledToRefAlready(false),
mChangeScrollPosWhenScrollingToRef(false),
mIsScopedStyleEnabled(eScopedStyle_Unknown), mIsScopedStyleEnabled(eScopedStyle_Unknown),
mPendingFullscreenRequests(0), mPendingFullscreenRequests(0),
mCompatMode(eCompatibility_FullStandards), mCompatMode(eCompatibility_FullStandards),
@ -1557,8 +1559,6 @@ nsDocument::nsDocument(const char* aContentType)
, mOnloadBlockCount(0) , mOnloadBlockCount(0)
, mAsyncOnloadBlockCount(0) , mAsyncOnloadBlockCount(0)
, mPreloadPictureDepth(0) , mPreloadPictureDepth(0)
, mScrolledToRefAlready(0)
, mChangeScrollPosWhenScrollingToRef(0)
, mValidWidth(false) , mValidWidth(false)
, mValidHeight(false) , mValidHeight(false)
, mAutoSize(false) , mAutoSize(false)
@ -9434,7 +9434,7 @@ nsIDocument::TriggerAutoFocus()
} }
void void
nsDocument::SetScrollToRef(nsIURI *aDocumentURI) nsIDocument::SetScrollToRef(nsIURI* aDocumentURI)
{ {
if (!aDocumentURI) { if (!aDocumentURI) {
return; return;
@ -9466,7 +9466,7 @@ nsDocument::SetScrollToRef(nsIURI *aDocumentURI)
} }
void void
nsDocument::ScrollToRef() nsIDocument::ScrollToRef()
{ {
if (mScrolledToRefAlready) { if (mScrolledToRefAlready) {
nsCOMPtr<nsIPresShell> shell = GetShell(); nsCOMPtr<nsIPresShell> shell = GetShell();
@ -9525,18 +9525,6 @@ nsDocument::ScrollToRef()
} }
} }
void
nsDocument::ResetScrolledToRefAlready()
{
mScrolledToRefAlready = false;
}
void
nsDocument::SetChangeScrollPosWhenScrollingToRef(bool aValue)
{
mChangeScrollPosWhenScrollingToRef = aValue;
}
void void
nsIDocument::RegisterActivityObserver(nsISupports* aSupports) nsIDocument::RegisterActivityObserver(nsISupports* aSupports)
{ {

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

@ -591,11 +591,6 @@ public:
// Only BlockOnload should call this! // Only BlockOnload should call this!
void AsyncBlockOnload(); void AsyncBlockOnload();
virtual void SetScrollToRef(nsIURI *aDocumentURI) override;
virtual void ScrollToRef() override;
virtual void ResetScrolledToRefAlready() override;
virtual void SetChangeScrollPosWhenScrollingToRef(bool aValue) override;
// Returns the size of the mBlockedTrackingNodes array. (nsIDocument.h) // Returns the size of the mBlockedTrackingNodes array. (nsIDocument.h)
// //
// This array contains nodes that have been blocked to prevent // This array contains nodes that have been blocked to prevent
@ -792,10 +787,6 @@ private:
// Set if we've found a URL for the current picture // Set if we've found a URL for the current picture
nsString mPreloadPictureFoundSource; nsString mPreloadPictureFoundSource;
nsCString mScrollToRef;
uint8_t mScrolledToRefAlready : 1;
uint8_t mChangeScrollPosWhenScrollingToRef : 1;
// These member variables cache information about the viewport so we don't have to // These member variables cache information about the viewport so we don't have to
// recalculate it each time. // recalculate it each time.
bool mValidWidth, mValidHeight; bool mValidWidth, mValidHeight;

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

@ -2769,10 +2769,17 @@ public:
void SetAutoFocusElement(Element* aAutoFocusElement); void SetAutoFocusElement(Element* aAutoFocusElement);
void TriggerAutoFocus(); void TriggerAutoFocus();
virtual void SetScrollToRef(nsIURI *aDocumentURI) = 0; void SetScrollToRef(nsIURI* aDocumentURI);
virtual void ScrollToRef() = 0; void ScrollToRef();
virtual void ResetScrolledToRefAlready() = 0; void ResetScrolledToRefAlready()
virtual void SetChangeScrollPosWhenScrollingToRef(bool aValue) = 0; {
mScrolledToRefAlready = false;
}
void SetChangeScrollPosWhenScrollingToRef(bool aValue)
{
mChangeScrollPosWhenScrollingToRef = aValue;
}
using mozilla::dom::DocumentOrShadowRoot::GetElementById; using mozilla::dom::DocumentOrShadowRoot::GetElementById;
using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagName; using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagName;
@ -3874,6 +3881,9 @@ protected:
bool mDOMCompleteSet: 1; bool mDOMCompleteSet: 1;
bool mAutoFocusFired: 1; bool mAutoFocusFired: 1;
bool mScrolledToRefAlready : 1;
bool mChangeScrollPosWhenScrollingToRef : 1;
// Whether <style scoped> support is enabled in this document. // Whether <style scoped> support is enabled in this document.
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled }; enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
unsigned int mIsScopedStyleEnabled : 2; unsigned int mIsScopedStyleEnabled : 2;
@ -4106,6 +4116,8 @@ protected:
nsWeakPtr mAutoFocusElement; nsWeakPtr mAutoFocusElement;
nsCString mScrollToRef;
// Weak reference to the scope object (aka the script global object) // Weak reference to the scope object (aka the script global object)
// that, unlike mScriptGlobalObject, is never unset once set. This // that, unlike mScriptGlobalObject, is never unset once set. This
// is a weak reference to avoid leaks due to circular references. // is a weak reference to avoid leaks due to circular references.