diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 18:16:19 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 18:16:19 +0000 |
commit | 0152773a7e8c07b7c8bc3b536a1fbaf444402445 (patch) | |
tree | 30a30afea17612699281006296db9050b8e653bd | |
parent | 68464aacf997a60d7abe1b2d1c4873349827757a (diff) | |
download | chromium_src-0152773a7e8c07b7c8bc3b536a1fbaf444402445.zip chromium_src-0152773a7e8c07b7c8bc3b536a1fbaf444402445.tar.gz chromium_src-0152773a7e8c07b7c8bc3b536a1fbaf444402445.tar.bz2 |
cc: Rename viewportPoint to screenSpacePoint to be more precise in the hit-testing code.
The point given to these functions is meant to be applied to the inverse
screenSpaceTransform. That point must be in the device-viewport, ie.
screen space.
The current name makes it sound like the point is in logical pixels rather than
device pixels, which is incorrect.
Just renaming variables, no new tests.
R=enne
Review URL: https://codereview.chromium.org/11191076
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163027 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/layer_impl.cc | 4 | ||||
-rw-r--r-- | cc/layer_tree_host_common.cc | 18 | ||||
-rw-r--r-- | cc/layer_tree_host_common.h | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index 3ee5405..f71cbca 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -191,7 +191,7 @@ FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) return unscrolled; } -CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType type) const +CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& screenSpacePoint, CCInputHandlerClient::ScrollInputType type) const { if (shouldScrollOnMainThread()) { TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThread"); @@ -205,7 +205,7 @@ CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo if (!nonFastScrollableRegion().isEmpty()) { bool clipped = false; - FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(viewportPoint), clipped); + FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped); if (!clipped && nonFastScrollableRegion().contains(flooredIntPoint(hitTestPointInLocalSpace))) { TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed nonFastScrollableRegion"); return CCInputHandlerClient::ScrollOnMainThread; diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc index bf5ec34..43c98ee 100644 --- a/cc/layer_tree_host_common.cc +++ b/cc/layer_tree_host_common.cc @@ -790,7 +790,7 @@ void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect); } -static bool pointHitsRect(const IntPoint& viewportPoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect) +static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect) { // If the transform is not invertible, then assume that this point doesn't hit this rect. if (!localSpaceToScreenSpaceTransform.isInvertible()) @@ -798,7 +798,7 @@ static bool pointHitsRect(const IntPoint& viewportPoint, const WebTransformation // Transform the hit test point from screen space to the local space of the given rect. bool clipped = false; - FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), FloatPoint(viewportPoint), clipped); + FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), FloatPoint(screenSpacePoint), clipped); // If projectPoint could not project to a valid value, then we assume that this point doesn't hit this rect. if (clipped) @@ -807,19 +807,19 @@ static bool pointHitsRect(const IntPoint& viewportPoint, const WebTransformation return localSpaceRect.contains(hitTestPointInLocalSpace); } -static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& viewportPoint, CCLayerImpl* layer) +static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, CCLayerImpl* layer) { CCLayerImpl* currentLayer = layer; // Walk up the layer tree and hit-test any renderSurfaces and any layer clipRects that are active. while (currentLayer) { - if (currentLayer->renderSurface() && !pointHitsRect(viewportPoint, currentLayer->renderSurface()->screenSpaceTransform(), currentLayer->renderSurface()->contentRect())) + if (currentLayer->renderSurface() && !pointHitsRect(screenSpacePoint, currentLayer->renderSurface()->screenSpaceTransform(), currentLayer->renderSurface()->contentRect())) return true; // Note that drawableContentRects are actually in targetSurface space, so the transform we // have to provide is the target surface's screenSpaceTransform. CCLayerImpl* renderTarget = currentLayer->renderTarget(); - if (layerClipsSubtree(currentLayer) && !pointHitsRect(viewportPoint, renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->drawableContentRect())) + if (layerClipsSubtree(currentLayer) && !pointHitsRect(screenSpacePoint, renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->drawableContentRect())) return true; currentLayer = currentLayer->parent(); @@ -829,7 +829,7 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& viewportPoint, CCL return false; } -CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& viewportPoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList) +CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerImpl* foundLayer = 0; @@ -844,20 +844,20 @@ CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& vi CCLayerImpl* currentLayer = (*it); FloatRect contentRect(FloatPoint::zero(), currentLayer->contentBounds()); - if (!pointHitsRect(viewportPoint, currentLayer->screenSpaceTransform(), contentRect)) + if (!pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform(), contentRect)) continue; // At this point, we think the point does hit the layer, but we need to walk up // the parents to ensure that the layer was not clipped in such a way that the // hit point actually should not hit the layer. - if (pointIsClippedBySurfaceOrClipRect(viewportPoint, currentLayer)) + if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer)) continue; foundLayer = currentLayer; break; } - // This can potentially return 0, which means the viewportPoint did not successfully hit test any layers, not even the root layer. + // This can potentially return 0, which means the screenSpacePoint did not successfully hit test any layers, not even the root layer. return foundLayer; } diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h index 01dc41e..238dd8d 100644 --- a/cc/layer_tree_host_common.h +++ b/cc/layer_tree_host_common.h @@ -26,7 +26,7 @@ public: static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList); // Performs hit testing for a given renderSurfaceLayerList. - static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList); + static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList); template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID); |