mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1056155 - Follow-up to bug 1051985 to not assume only ContainerLayers have FrameMetrics. r=mattwoodrow
This commit is contained in:
parent
6fda146273
commit
c6ff8a9edf
@ -62,21 +62,20 @@ LayerManager::GetPrimaryScrollableLayer()
|
||||
nsTArray<Layer*> queue;
|
||||
queue.AppendElement(mRoot);
|
||||
while (queue.Length()) {
|
||||
ContainerLayer* containerLayer = queue[0]->AsContainerLayer();
|
||||
Layer* layer = queue[0];
|
||||
queue.RemoveElementAt(0);
|
||||
if (!containerLayer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const FrameMetrics& frameMetrics = containerLayer->GetFrameMetrics();
|
||||
const FrameMetrics& frameMetrics = layer->GetFrameMetrics();
|
||||
if (frameMetrics.IsScrollable()) {
|
||||
return containerLayer;
|
||||
return layer;
|
||||
}
|
||||
|
||||
Layer* child = containerLayer->GetFirstChild();
|
||||
while (child) {
|
||||
queue.AppendElement(child);
|
||||
child = child->GetNextSibling();
|
||||
if (ContainerLayer* containerLayer = layer->AsContainerLayer()) {
|
||||
Layer* child = containerLayer->GetFirstChild();
|
||||
while (child) {
|
||||
queue.AppendElement(child);
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,22 +92,21 @@ LayerManager::GetScrollableLayers(nsTArray<Layer*>& aArray)
|
||||
nsTArray<Layer*> queue;
|
||||
queue.AppendElement(mRoot);
|
||||
while (!queue.IsEmpty()) {
|
||||
ContainerLayer* containerLayer = queue.LastElement()->AsContainerLayer();
|
||||
Layer* layer = queue.LastElement();
|
||||
queue.RemoveElementAt(queue.Length() - 1);
|
||||
if (!containerLayer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const FrameMetrics& frameMetrics = containerLayer->GetFrameMetrics();
|
||||
const FrameMetrics& frameMetrics = layer->GetFrameMetrics();
|
||||
if (frameMetrics.IsScrollable()) {
|
||||
aArray.AppendElement(containerLayer);
|
||||
aArray.AppendElement(layer);
|
||||
continue;
|
||||
}
|
||||
|
||||
Layer* child = containerLayer->GetFirstChild();
|
||||
while (child) {
|
||||
queue.AppendElement(child);
|
||||
child = child->GetNextSibling();
|
||||
if (ContainerLayer* containerLayer = layer->AsContainerLayer()) {
|
||||
Layer* child = containerLayer->GetFirstChild();
|
||||
while (child) {
|
||||
queue.AppendElement(child);
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -343,7 +343,8 @@ public:
|
||||
|
||||
/**
|
||||
* Returns a list of all descendant layers for which
|
||||
* GetFrameMetrics().IsScrollable() is true.
|
||||
* GetFrameMetrics().IsScrollable() is true and that
|
||||
* do not already have an ancestor in the return list.
|
||||
*/
|
||||
void GetScrollableLayers(nsTArray<Layer*>& aArray);
|
||||
|
||||
|
@ -690,11 +690,7 @@ LayerTransactionParent::RecvSetAsyncScrollOffset(PLayerParent* aLayer,
|
||||
if (!layer) {
|
||||
return false;
|
||||
}
|
||||
ContainerLayer* containerLayer = layer->AsContainerLayer();
|
||||
if (!containerLayer) {
|
||||
return false;
|
||||
}
|
||||
AsyncPanZoomController* controller = containerLayer->GetAsyncPanZoomController();
|
||||
AsyncPanZoomController* controller = layer->GetAsyncPanZoomController();
|
||||
if (!controller) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user