Bug 570620, part b: Fix a hidden header depedency and add a PresShell::GetLayerManager() helper. r=tn

This commit is contained in:
Chris Jones 2010-08-05 17:11:23 -05:00
Родитель f16c7feac5
Коммит 1014dfe1fe
4 изменённых файлов: 52 добавлений и 15 удалений

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

@ -109,6 +109,10 @@ namespace mozilla {
namespace dom {
class Element;
} // namespace dom
namespace layers{
class LayerManager;
} // namespace layers
} // namespace mozilla
// Flags to pass to SetCapturingContent
@ -133,8 +137,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0x318f7b6c, 0x56be, 0x4256, \
{ 0xa3, 0x09, 0xff, 0xdc, 0xde, 0x04, 0x63, 0xf6 } }
{ 0xb2d3df3b, 0x54ba, 0x44cf, \
{ 0x8c, 0xfd, 0x24, 0x84, 0x3e, 0xac, 0x27, 0x96 } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -187,6 +191,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell_base, NS_IPRESSHELL_IID)
class nsIPresShell : public nsIPresShell_base
{
protected:
typedef mozilla::layers::LayerManager LayerManager;
public:
virtual NS_HIDDEN_(nsresult) Init(nsIDocument* aDocument,
nsPresContext* aPresContext,
@ -1024,6 +1031,12 @@ public:
*/
virtual already_AddRefed<nsPIDOMWindow> GetRootWindow() = 0;
/**
* Get the layer manager for the widget of the root view, if it has
* one.
*/
virtual LayerManager* GetLayerManager() = 0;
/**
* Refresh observer management.
*/

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

@ -747,6 +747,24 @@ nsLayoutUtils::GetNearestScrollableFrame(nsIFrame* aFrame)
return nsnull;
}
//static
PRBool
nsLayoutUtils::HasPseudoStyle(nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
nsPresContext* aPresContext)
{
NS_PRECONDITION(aPresContext, "Must have a prescontext");
nsRefPtr<nsStyleContext> pseudoContext;
if (aContent) {
pseudoContext = aPresContext->StyleSet()->
ProbePseudoElementStyle(aContent->AsElement(), aPseudoElement,
aStyleContext);
}
return pseudoContext != nsnull;
}
nsPoint
nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(nsIDOMEvent* aDOMEvent, nsIFrame* aFrame)
{

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

@ -357,18 +357,7 @@ public:
static PRBool HasPseudoStyle(nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
nsPresContext* aPresContext)
{
NS_PRECONDITION(aPresContext, "Must have a prescontext");
nsRefPtr<nsStyleContext> pseudoContext;
if (aContent) {
pseudoContext = aPresContext->StyleSet()->
ProbePseudoElementStyle(aContent->AsElement(), aPseudoElement,
aStyleContext);
}
return pseudoContext != nsnull;
}
nsPresContext* aPresContext);
/**
* If this frame is a placeholder for a float, then return the float,

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

@ -207,6 +207,8 @@
#include "mozilla/FunctionTimer.h"
#include "Layers.h"
#ifdef NS_FUNCTION_TIMER
#define NS_TIME_FUNCTION_DECLARE_DOCURL \
nsCAutoString docURL__("N/A"); \
@ -228,8 +230,8 @@ static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
#include "nsIMemoryReporter.h"
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::dom;
using namespace mozilla::layers;
PRBool nsIPresShell::gIsAccessibilityActive = PR_FALSE;
CapturingContentInfo nsIPresShell::gCaptureInfo;
@ -810,6 +812,8 @@ public:
virtual already_AddRefed<nsPIDOMWindow> GetRootWindow();
virtual LayerManager* GetLayerManager();
//nsIViewObserver interface
NS_IMETHOD Paint(nsIView* aDisplayRoot,
@ -5836,6 +5840,19 @@ struct PaintParams {
nscolor mBackgroundColor;
};
LayerManager* PresShell::GetLayerManager()
{
NS_ASSERTION(mViewManager, "Should have view manager");
nsIView* rootView;
if (NS_SUCCEEDED(mViewManager->GetRootView(rootView)) && rootView) {
if (nsIWidget* widget = rootView->GetWidget()) {
return widget->GetLayerManager();
}
}
return nsnull;
}
static void DrawThebesLayer(ThebesLayer* aLayer,
gfxContext* aContext,
const nsIntRegion& aRegionToDraw,