From 12139918503c32ea46c8b25d789a38d229584c32 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:33:03 +0200 Subject: [PATCH] Bug 904541 - Don't #include Layers.h in nsPresContext.h. r=roc --- layout/base/FrameLayerBuilder.cpp | 2 +- layout/base/nsDisplayList.cpp | 6 ++---- layout/base/nsLayoutUtils.h | 1 + layout/base/nsPresContext.cpp | 25 +++++++++++++++++++++++++ layout/base/nsPresContext.h | 20 +++++++------------- layout/base/nsRefreshDriver.cpp | 1 + layout/generic/nsIFrame.h | 2 ++ layout/style/nsComputedDOMStyle.h | 1 + 8 files changed, 40 insertions(+), 18 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 3563960d24be..9f73a7535149 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2962,7 +2962,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, containerLayer->SetContentFlags(flags); mContainerLayerGeneration = oldGeneration; - containerLayer->SetUserData(&gNotifySubDocInvalidationData, nullptr); + nsPresContext::ClearNotifySubDocInvalidationData(containerLayer); return containerLayer.forget(); } diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 1b63d16a72ef..324141dc62c5 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3032,14 +3032,12 @@ already_AddRefed nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerParameters& aContainerParameters) { - nsRefPtr layer = aManager->GetLayerBuilder()-> + nsRefPtr layer = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList, aContainerParameters, nullptr); if (mFlags & GENERATE_SUBDOC_INVALIDATIONS) { - ContainerLayerPresContext* pres = new ContainerLayerPresContext; - pres->mPresContext = mFrame->PresContext(); - layer->SetUserData(&gNotifySubDocInvalidationData, pres); + mFrame->PresContext()->SetNotifySubDocInvalidationData(layer); } return layer.forget(); } diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 7da8306f94af..00b40b6c1943 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -35,6 +35,7 @@ class nsIImageLoadingContent; #include "nsHTMLReflowState.h" #include "nsIFrameLoader.h" #include "FrameMetrics.h" +#include "gfx3DMatrix.h" #include #include diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 93ec5adb68c2..2d313abea6c4 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -70,6 +70,7 @@ #include "mozilla/dom/TabChild.h" #include "RestyleManager.h" #include "nsRefreshDriver.h" +#include "Layers.h" #ifdef IBMBIDI #include "nsBidiPresUtils.h" @@ -95,6 +96,16 @@ using namespace mozilla::layers; uint8_t gNotifySubDocInvalidationData; +/** + * Layer UserData for ContainerLayers that want to be notified + * of local invalidations of them and their descendant layers. + * Pass a callback to ComputeDifferences to have these called. + */ +class ContainerLayerPresContext : public LayerUserData { +public: + nsPresContext* mPresContext; +}; + namespace { class CharSetChangingRunnable : public nsRunnable @@ -2352,6 +2363,20 @@ nsPresContext::NotifySubDocInvalidation(ContainerLayer* aContainer, } } +void +nsPresContext::SetNotifySubDocInvalidationData(ContainerLayer* aContainer) +{ + ContainerLayerPresContext* pres = new ContainerLayerPresContext; + pres->mPresContext = this; + aContainer->SetUserData(&gNotifySubDocInvalidationData, pres); +} + +/* static */ void +nsPresContext::ClearNotifySubDocInvalidationData(ContainerLayer* aContainer) +{ + aContainer->SetUserData(&gNotifySubDocInvalidationData, nullptr); +} + struct NotifyDidPaintSubdocumentCallbackClosure { uint32_t mFlags; bool mNeedsAnotherDidPaintNotification; diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 5f0174f7b7c4..8ec9b9f88cde 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -34,7 +34,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "prclist.h" -#include "Layers.h" +#include "nsThreadUtils.h" #ifdef IBMBIDI class nsBidiPresUtils; @@ -77,7 +77,10 @@ class nsRenderingContext; #endif namespace mozilla { - class RestyleManager; +class RestyleManager; +namespace layers { +class ContainerLayer; +} } // supported values for cached bool types @@ -125,17 +128,6 @@ public: nsTArray mRequests; }; -/** - * Layer UserData for ContainerLayers that want to be notified - * of local invalidations of them and their descendant layers. - * Pass a callback to ComputeDifferences to have these called. - */ -class ContainerLayerPresContext : public mozilla::layers::LayerUserData { -public: - nsPresContext* mPresContext; -}; -extern uint8_t gNotifySubDocInvalidationData; - /* Used by nsPresContext::HasAuthorSpecifiedRules */ #define NS_AUTHOR_SPECIFIED_BACKGROUND (1 << 0) #define NS_AUTHOR_SPECIFIED_BORDER (1 << 1) @@ -897,6 +889,8 @@ public: // Passed to LayerProperties::ComputeDifference static void NotifySubDocInvalidation(mozilla::layers::ContainerLayer* aContainer, const nsIntRegion& aRegion); + void SetNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer); + static void ClearNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer); bool IsDOMPaintEventPending(); void ClearMozAfterPaintEvents() { mInvalidateRequestsSinceLastPaint.mRequests.Clear(); diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 2c0555381c85..c5215d198008 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -49,6 +49,7 @@ typedef HRESULT (WINAPI*DwmGetCompositionTimingInfoProc)(HWND hWnd, DWM_TIMING_I #include "nsPerformance.h" #include "mozilla/dom/WindowBinding.h" #include "RestyleManager.h" +#include "Layers.h" using mozilla::TimeStamp; using mozilla::TimeDuration; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 1ef13e5e0b0e..06241eda8860 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -35,6 +35,8 @@ #include "nsDirection.h" #include #include "nsITheme.h" +#include "gfx3DMatrix.h" +#include "gfxASurface.h" #ifdef ACCESSIBILITY #include "mozilla/a11y/AccTypes.h" diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index dc77197daef9..6610af2f279a 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -30,6 +30,7 @@ class nsIPresShell; class nsDOMCSSValueList; class nsROCSSPrimitiveValue; class nsStyleContext; +class gfx3DMatrix; class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration {