Bug 681192. Part 0.3: Add FrameLayerBuilder::GetThebesLayerResolutionForFrame. r=mattwoodrow

--HG--
extra : rebase_source : eea4dee6d081de5c288e295f3549fc88b10e6c39
This commit is contained in:
Robert O'Callahan 2012-05-10 17:24:18 +12:00
parent 14f22692ee
commit 5943f7cf5b
2 changed files with 51 additions and 0 deletions

View File

@ -2266,6 +2266,46 @@ FrameLayerBuilder::GetDedicatedLayer(nsIFrame* aFrame, PRUint32 aDisplayItemKey)
return nsnull;
}
bool
FrameLayerBuilder::GetThebesLayerResolutionForFrame(nsIFrame* aFrame,
double* aXres, double* aYres,
gfxPoint* aPoint)
{
nsTArray<DisplayItemData> *array = GetDisplayItemDataArrayForFrame(aFrame);
if (array) {
for (PRUint32 i = 0; i < array->Length(); ++i) {
Layer* layer = array->ElementAt(i).mLayer;
if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
ThebesDisplayItemLayerUserData* data =
static_cast<ThebesDisplayItemLayerUserData*>
(layer->GetUserData(&gThebesDisplayItemLayerUserData));
*aXres = data->mXScale;
*aYres = data->mYScale;
*aPoint = data->mActiveScrolledRootPosition;
return true;
}
}
}
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
if (lists.CurrentID() == nsIFrame::kPopupList ||
lists.CurrentID() == nsIFrame::kSelectPopupList) {
continue;
}
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
if (GetThebesLayerResolutionForFrame(childFrames.get(),
aXres, aYres, aPoint)) {
return true;
}
}
}
return false;
}
#ifdef MOZ_DUMP_PAINTING
static void DebugPaintItem(nsRenderingContext* aDest, nsDisplayItem *aItem, nsDisplayListBuilder* aBuilder)
{

View File

@ -346,6 +346,17 @@ public:
*/
nsIntPoint GetLastPaintOffset(ThebesLayer* aLayer);
/**
* Return resolution and scroll offset of ThebesLayer content associated
* with aFrame's subtree.
* Returns true if some ThebesLayer was found.
* This just looks for the first ThebesLayer and returns its data. There
* could be other ThebesLayers with different resolution and offsets.
*/
static bool GetThebesLayerResolutionForFrame(nsIFrame* aFrame,
double* aXRes, double* aYRes,
gfxPoint* aPoint);
/**
* Clip represents the intersection of an optional rectangle with a
* list of rounded rectangles.