Bug 1168630. Part 4. Rename AsyncPanZoomController::IsRootForLayersId to HasNoParentWithSameLayersId. r=botond

The function did not tell you if the APZC was the root for the layers id. It just told you if it had no parent. Which are different things.

Since IsRootForLayersId didn't do what it was expected to, the users of HasNoParentWithSameLayersId will be audited and then removed or changed to be correct by bug 1158424.
This commit is contained in:
Timothy Nikkel 2015-05-31 14:44:41 -05:00
Родитель 17048184a5
Коммит 3670812937
3 изменённых файлов: 12 добавлений и 11 удалений

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

@ -453,9 +453,9 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
// we are logging about APZCs is the scroll id, and otherwise we could // we are logging about APZCs is the scroll id, and otherwise we could
// confuse APZCs from different layer trees with the same scroll id. // confuse APZCs from different layer trees with the same scroll id.
if (aLayersId == aState.mOriginatingLayersId) { if (aLayersId == aState.mOriginatingLayersId) {
if (apzc->IsRootForLayersId()) { if (apzc->HasNoParentWithSameLayersId()) {
aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(), aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(),
"isRootForLayersId", true); "hasNoParentWithSameLayersId", true);
} else { } else {
MOZ_ASSERT(apzc->GetParent()); MOZ_ASSERT(apzc->GetParent());
aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(), aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(),
@ -464,7 +464,7 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
} }
if (newApzc) { if (newApzc) {
if (apzc->IsRootForLayersId()) { if (apzc->HasNoParentWithSameLayersId()) {
// If we just created a new apzc that is the root for its layers ID, then // If we just created a new apzc that is the root for its layers ID, then
// we need to update its zoom constraints which might have arrived before this // we need to update its zoom constraints which might have arrived before this
// was created // was created
@ -1040,7 +1040,7 @@ APZCTreeManager::UpdateZoomConstraints(const ScrollableLayerGuid& aGuid,
// For a given layers id, non-root APZCs inherit the zoom constraints // For a given layers id, non-root APZCs inherit the zoom constraints
// of their root. // of their root.
if (node && node->GetApzc()->IsRootForLayersId()) { if (node && node->GetApzc()->HasNoParentWithSameLayersId()) {
UpdateZoomConstraintsRecursively(node.get(), aConstraints); UpdateZoomConstraintsRecursively(node.get(), aConstraints);
} }
} }
@ -1057,7 +1057,7 @@ APZCTreeManager::UpdateZoomConstraintsRecursively(HitTestingTreeNode* aNode,
} }
for (HitTestingTreeNode* child = aNode->GetLastChild(); child; child = child->GetPrevSibling()) { for (HitTestingTreeNode* child = aNode->GetLastChild(); child; child = child->GetPrevSibling()) {
// We can have subtrees with their own layers id - leave those alone. // We can have subtrees with their own layers id - leave those alone.
if (child->GetApzc() && child->GetApzc()->IsRootForLayersId()) { if (child->GetApzc() && child->GetApzc()->HasNoParentWithSameLayersId()) {
continue; continue;
} }
UpdateZoomConstraintsRecursively(child, aConstraints); UpdateZoomConstraintsRecursively(child, aConstraints);
@ -1344,7 +1344,7 @@ APZCTreeManager::BuildOverscrollHandoffChain(const nsRefPtr<AsyncPanZoomControll
result->Add(apzc); result->Add(apzc);
if (apzc->GetScrollHandoffParentId() == FrameMetrics::NULL_SCROLL_ID) { if (apzc->GetScrollHandoffParentId() == FrameMetrics::NULL_SCROLL_ID) {
if (!apzc->IsRootForLayersId()) { if (!apzc->HasNoParentWithSameLayersId()) {
// This probably indicates a bug or missed case in layout code // This probably indicates a bug or missed case in layout code
NS_WARNING("Found a non-root APZ with no handoff parent"); NS_WARNING("Found a non-root APZ with no handoff parent");
} }
@ -1362,7 +1362,7 @@ APZCTreeManager::BuildOverscrollHandoffChain(const nsRefPtr<AsyncPanZoomControll
// scroll id. // scroll id.
AsyncPanZoomController* scrollParent = nullptr; AsyncPanZoomController* scrollParent = nullptr;
AsyncPanZoomController* parent = apzc; AsyncPanZoomController* parent = apzc;
while (!parent->IsRootForLayersId()) { while (!parent->HasNoParentWithSameLayersId()) {
parent = parent->GetParent(); parent = parent->GetParent();
// While walking up to find the root of the subtree, if we encounter the // While walking up to find the root of the subtree, if we encounter the
// handoff parent, we don't actually need to do the search so we can // handoff parent, we don't actually need to do the search so we can
@ -1705,7 +1705,7 @@ APZCTreeManager::RootAPZCForLayersId(AsyncPanZoomController* aApzc) const
{ {
MonitorAutoLock lock(mTreeLock); MonitorAutoLock lock(mTreeLock);
nsRefPtr<AsyncPanZoomController> apzc = aApzc; nsRefPtr<AsyncPanZoomController> apzc = aApzc;
while (apzc && !apzc->IsRootForLayersId()) { while (apzc && !apzc->HasNoParentWithSameLayersId()) {
apzc = apzc->GetParent(); apzc = apzc->GetParent();
} }
return apzc.forget(); return apzc.forget();

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

@ -899,9 +899,10 @@ public:
} }
/* Returns true if there is no APZC higher in the tree with the same /* Returns true if there is no APZC higher in the tree with the same
* layers id. * layers id. Deprecated. New code shouldn't use this. Old code should be
* updated to not use this.
*/ */
bool IsRootForLayersId() const { bool HasNoParentWithSameLayersId() const {
return !mParent || (mParent->mLayersId != mLayersId); return !mParent || (mParent->mLayersId != mLayersId);
} }

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

@ -91,7 +91,7 @@ function buildApzcTree(paint) {
// This 'root' does not correspond to an APZC. // This 'root' does not correspond to an APZC.
var root = makeNode(-1); var root = makeNode(-1);
for (var scrollId in paint) { for (var scrollId in paint) {
if ("isRootForLayersId" in paint[scrollId]) { if ("hasNoParentWithSameLayersId" in paint[scrollId]) {
addRoot(root, scrollId); addRoot(root, scrollId);
} else if ("parentScrollId" in paint[scrollId]) { } else if ("parentScrollId" in paint[scrollId]) {
addLink(root, scrollId, paint[scrollId]["parentScrollId"]); addLink(root, scrollId, paint[scrollId]["parentScrollId"]);