diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 1c7bd0b14b4d..c3dac98a3b52 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -768,8 +768,80 @@ PresShell::AccessibleCaretEnabled(nsIDocShell* aDocShell) return false; } +nsIPresShell::nsIPresShell() + : mFrameConstructor(nullptr) + , mViewManager(nullptr) + , mFrameManager(nullptr) + , mHiddenInvalidationObserverRefreshDriver(nullptr) +#ifdef ACCESSIBILITY + , mDocAccessible(nullptr) +#endif +#ifdef DEBUG + , mDrawEventTargetFrame(nullptr) +#endif + , mPaintCount(0) + , mWeakFrames(nullptr) + , mCanvasBackgroundColor(NS_RGBA(0,0,0,0)) + , mSelectionFlags(0) + , mRenderFlags(0) + , mStylesHaveChanged(false) + , mDidInitialize(false) + , mIsDestroying(false) + , mIsReflowing(false) + , mPaintingSuppressed(false) + , mIsThemeSupportDisabled(false) + , mIsActive(false) + , mFrozen(false) + , mIsFirstPaint(false) + , mObservesMutationsForPrint(false) + , mReflowScheduled(false) + , mSuppressInterruptibleReflows(false) + , mScrollPositionClampingScrollPortSizeSet(false) + , mPresShellId(0) + , mFontSizeInflationEmPerLine(0) + , mFontSizeInflationMinTwips(0) + , mFontSizeInflationLineThreshold(0) + , mFontSizeInflationForceEnabled(false) + , mFontSizeInflationDisabledInMasterProcess(false) + , mFontSizeInflationEnabled(false) + , mPaintingIsFrozen(false) + , mFontSizeInflationEnabledIsDirty(false) + , mIsNeverPainting(false) + {} + PresShell::PresShell() - : mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) + : mCaretEnabled(false) +#ifdef DEBUG + , mInVerifyReflow(false) + , mCurrentReflowRoot(nullptr) + , mUpdateCount(0) +#endif +#ifdef MOZ_REFLOW_PERF + , mReflowCountMgr(nullptr) +#endif + , mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) + , mCurrentEventFrame(nullptr) + , mFirstCallbackEventRequest(nullptr) + , mLastCallbackEventRequest(nullptr) + , mLastReflowStart(0.0) + , mLastAnchorScrollPositionY(0) + , mChangeNestCount(0) + , mDocumentLoading(false) + , mIgnoreFrameDestruction(false) + , mHaveShutDown(false) + , mLastRootReflowHadUnconstrainedBSize(false) + , mNoDelayedMouseEvents(false) + , mNoDelayedKeyEvents(false) + , mIsDocumentGone(false) + , mShouldUnsuppressPainting(false) + , mAsyncResizeTimerIsActive(false) + , mInResize(false) + , mApproximateFrameVisibilityVisited(false) + , mNextPaintCompressed(false) + , mHasCSSBackgroundColor(false) + , mScaleToResolution(false) + , mIsLastChromeOnlyEscapeKeyConsumed(false) + , mHasReceivedPaintMessage(false) { #ifdef MOZ_REFLOW_PERF mReflowCountMgr = new ReflowCountMgr(); diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index d30e211e7e45..491eb855d3fe 100644 --- a/layout/base/PresShell.h +++ b/layout/base/PresShell.h @@ -84,8 +84,6 @@ class PresShell final : public nsIPresShell, public: PresShell(); - NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW - // nsISupports NS_DECL_ISUPPORTS diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index a72fecc2608f..a4239eeda2f8 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -225,8 +225,6 @@ class nsDocumentViewer final : public nsIContentViewer, public: nsDocumentViewer(); - NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW - // nsISupports interface... NS_DECL_ISUPPORTS @@ -506,14 +504,36 @@ void nsDocumentViewer::PrepareToStartLoad() #endif // NS_PRINTING } -// Note: operator new zeros our memory, so no need to init things to null. nsDocumentViewer::nsDocumentViewer() - : mTextZoom(1.0), mPageZoom(1.0), mOverrideDPPX(0.0), mMinFontSize(0), + : mParentWidget(nullptr), + mAttachedToParent(false), + mTextZoom(1.0), + mPageZoom(1.0), + mOverrideDPPX(0.0), + mMinFontSize(0), + mNumURLStarts(0), + mDestroyRefCount(0), + mStopped(false), + mLoaded(false), + mDeferredWindowClose(false), mIsSticky(true), -#ifdef NS_PRINT_PREVIEW + mInPermitUnload(false), + mInPermitUnloadPrompt(false), +#ifdef NS_PRINTING + mClosingWhilePrinting(false), +#if NS_PRINT_PREVIEW + mPrintPreviewZoomed(false), + mPrintIsPending(false), + mPrintDocIsFullyLoaded(false), + mOriginalPrintPreviewScale(0.0), mPrintPreviewZoom(1.0), -#endif +#endif // NS_PRINT_PREVIEW +#ifdef DEBUG + mDebugFile(nullptr), +#endif // DEBUG +#endif // NS_PRINTING mHintCharsetSource(kCharsetUninitialized), + mIsPageMode(false), mInitializedForPrintPreview(false), mHidden(false) { diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 65fb35e9d551..934ac6c1b52b 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -194,6 +194,8 @@ protected: typedef uint8_t RenderFlags; // for storing the above flags public: + nsIPresShell(); + /** * All callers are responsible for calling |Destroy| after calling * |EndObservingDocument|. It needs to be separate only because form diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 3b469d59e0c3..49ecd938daaf 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -202,21 +202,98 @@ IsVisualCharset(const nsCString& aCharset) } } - // NOTE! nsPresContext::operator new() zeroes out all members, so don't - // bother initializing members to 0. - nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType) - : mType(aType), mDocument(aDocument), mBaseMinFontSize(0), - mTextZoom(1.0), mFullZoom(1.0), mOverrideDPPX(0.0), + : mType(aType), + mShell(nullptr), + mDocument(aDocument), + mMedium(nullptr), + mLinkHandler(nullptr), + mInflationDisabledForShrinkWrap(false), + mBaseMinFontSize(0), + mTextZoom(1.0), + mFullZoom(1.0), + mOverrideDPPX(0.0), mLastFontInflationScreenSize(gfxSize(-1.0, -1.0)), - mPageSize(-1, -1), mPPScale(1.0f), + mCurAppUnitsPerDevPixel(0), + mAutoQualityMinFontSizePixelsPref(0), + mPageSize(-1, -1), + mPageScale(0.0), + mPPScale(1.0f), + mDefaultColor(NS_RGBA(0,0,0,0)), + mBackgroundColor(NS_RGBA(0,0,0,0)), + mLinkColor(NS_RGBA(0,0,0,0)), + mActiveLinkColor(NS_RGBA(0,0,0,0)), + mVisitedLinkColor(NS_RGBA(0,0,0,0)), + mFocusBackgroundColor(NS_RGBA(0,0,0,0)), + mFocusTextColor(NS_RGBA(0,0,0,0)), + mBodyTextColor(NS_RGBA(0,0,0,0)), mViewportStyleScrollbar(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO), + mFocusRingWidth(0), + mExistThrottledUpdates(false), + mImageAnimationMode(0), mImageAnimationModePref(imgIContainer::kNormalAnimMode), + mInterruptChecksToSkip(0), + mElementsRestyled(0), + mFramesConstructed(0), + mFramesReflowed(0), + mInteractionTimeEnabled(false), + mHasPendingInterrupt(false), + mPendingInterruptFromTest(false), + mInterruptsEnabled(false), + mUseDocumentFonts(false), + mUseDocumentColors(false), + mUnderlineLinks(false), + mSendAfterPaintToContent(false), + mUseFocusColors(false), + mFocusRingOnAnything(false), + mFocusRingStyle(false), + mDrawImageBackground(false), + mDrawColorBackground(false), + mNeverAnimate(false), + mIsRenderingOnlySelection(false), + mPaginated(false), + mCanPaginatedScroll(false), + mDoScaledTwips(false), + mIsRootPaginatedDocument(false), + mPrefBidiDirection(false), + mPrefScrollbarSide(0), + mPendingSysColorChanged(false), + mPendingThemeChanged(false), + mPendingUIResolutionChanged(false), + mPendingMediaFeatureValuesChanged(false), + mPrefChangePendingNeedsReflow(false), + mIsEmulatingMedia(false), mAllInvalidated(false), - mPaintFlashing(false), mPaintFlashingInitialized(false) + mIsGlyph(false), + mUsesRootEMUnits(false), + mUsesExChUnits(false), + mUsesViewportUnits(false), + mPendingViewportChange(false), + mCounterStylesDirty(false), + mPostedFlushCounterStyles(false), + mSuppressResizeReflow(false), + mIsVisual(false), + mFireAfterPaintEvents(false), + mIsChrome(false), + mIsChromeOriginImage(false), + mPaintFlashing(false), + mPaintFlashingInitialized(false), + mHasWarnedAboutPositionedTableParts(false), + mHasWarnedAboutTooLargeDashedOrDottedRadius(false), + mQuirkSheetAdded(false), + mNeedsPrefUpdate(false), + mHadNonBlankPaint(false) +#ifdef RESTYLE_LOGGING + , mRestyleLoggingEnabled(false) +#endif +#ifdef DEBUG + , mInitialized(false) +#endif { - // NOTE! nsPresContext::operator new() zeroes out all members, so don't - // bother initializing members to 0. + PodZero(&mBorderWidthTable); +#ifdef DEBUG + PodZero(&mLayoutPhaseCount); +#endif mDoScaledTwips = true; diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 398f209550b6..690a1b98ff39 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -147,7 +147,6 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_NSIOBSERVER - NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_CYCLE_COLLECTION_CLASS(nsPresContext) MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsPresContext)