Bug 1444580: Devirtualize GetBoxObjectFor / ClearBoxObjectFor. r=smaug

MozReview-Commit-ID: KQJfJ43R0FI
This commit is contained in:
Emilio Cobos Álvarez 2018-03-11 14:25:10 +01:00
Родитель c88524fad4
Коммит 8722f6ee6a
3 изменённых файлов: 12 добавлений и 18 удалений

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

@ -1496,6 +1496,7 @@ nsIDocument::nsIDocument()
mAutoFocusFired(false),
mScrolledToRefAlready(false),
mChangeScrollPosWhenScrollingToRef(false),
mHasWarnedAboutBoxObjects(false),
mIsScopedStyleEnabled(eScopedStyle_Unknown),
mPendingFullscreenRequests(0),
mCompatMode(eCompatibility_FullStandards),
@ -1536,6 +1537,7 @@ nsIDocument::nsIDocument()
mSubDocuments(nullptr),
mHeaderData(nullptr),
mFlashClassification(FlashClassification::Unclassified),
mBoxObjectTable(nullptr),
mServoRestyleRootDirtyBits(0),
mThrowOnDynamicMarkupInsertionCounter(0),
mIgnoreOpensDuringUnloadCounter(0)
@ -1548,7 +1550,6 @@ nsIDocument::nsIDocument()
nsDocument::nsDocument(const char* aContentType)
: nsIDocument()
, mHasWarnedAboutBoxObjects(false)
, mDelayFrameLoaderInitialization(false)
, mSynchronousDOMContentLoaded(false)
, mParserAborted(false)
@ -1556,7 +1557,6 @@ nsDocument::nsDocument(const char* aContentType)
, mCurrentOrientationType(OrientationType::Portrait_primary)
, mReportedUseCounters(false)
, mXMLDeclarationBits(0)
, mBoxObjectTable(nullptr)
, mOnloadBlockCount(0)
, mAsyncOnloadBlockCount(0)
, mValidWidth(false)
@ -6487,7 +6487,7 @@ nsIDocument::DoNotifyPossibleTitleChange()
}
already_AddRefed<BoxObject>
nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
nsIDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
{
if (!aElement) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@ -6556,7 +6556,7 @@ nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
}
void
nsDocument::ClearBoxObjectFor(nsIContent* aContent)
nsIDocument::ClearBoxObjectFor(nsIContent* aContent)
{
if (mBoxObjectTable) {
if (auto entry = mBoxObjectTable->Lookup(aContent)) {

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

@ -484,12 +484,6 @@ public:
virtual void BlockOnload() override;
virtual void UnblockOnload(bool aFireSync) override;
virtual void ClearBoxObjectFor(nsIContent* aContent) override;
virtual already_AddRefed<mozilla::dom::BoxObject>
GetBoxObjectFor(mozilla::dom::Element* aElement,
mozilla::ErrorResult& aRv) override;
virtual Element*
GetAnonymousElementByAttribute(nsIContent* aElement,
nsAtom* aAttrName,
@ -664,8 +658,6 @@ public:
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
bool mHasWarnedAboutBoxObjects:1;
bool mDelayFrameLoaderInitialization:1;
bool mSynchronousDOMContentLoaded:1;
@ -693,8 +685,6 @@ public:
uint8_t mXMLDeclarationBits;
nsRefPtrHashtable<nsPtrHashKey<nsIContent>, mozilla::dom::BoxObject>* mBoxObjectTable;
// A document "without a browsing context" that owns the content of
// HTMLTemplateElement.
nsCOMPtr<nsIDocument> mTemplateContentsOwner;

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

@ -2207,15 +2207,14 @@ public:
*
* @param aElement canonical nsIContent pointer of the box object's element
*/
virtual void ClearBoxObjectFor(nsIContent *aContent) = 0;
void ClearBoxObjectFor(nsIContent* aContent);
/**
* Get the box object for an element. This is not exposed through a
* scriptable interface except for XUL documents.
*/
virtual already_AddRefed<mozilla::dom::BoxObject>
GetBoxObjectFor(mozilla::dom::Element* aElement,
mozilla::ErrorResult& aRv) = 0;
already_AddRefed<mozilla::dom::BoxObject>
GetBoxObjectFor(mozilla::dom::Element* aElement, mozilla::ErrorResult& aRv);
/**
* Support for window.matchMedia()
@ -3888,6 +3887,8 @@ protected:
bool mScrolledToRefAlready : 1;
bool mChangeScrollPosWhenScrollingToRef : 1;
bool mHasWarnedAboutBoxObjects: 1;
// Whether <style scoped> support is enabled in this document.
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
unsigned int mIsScopedStyleEnabled : 2;
@ -4175,6 +4176,9 @@ protected:
RefPtr<mozilla::dom::ScriptLoader> mScriptLoader;
nsRefPtrHashtable<nsPtrHashKey<nsIContent>, mozilla::dom::BoxObject>*
mBoxObjectTable;
public:
js::ExpandoAndGeneration mExpandoAndGeneration;