Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: Source/core/rendering/HitTestLocation.cpp

Issue 338543003: Gesture event hit test refactoring and reduction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix release build Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/HitTestLocation.h ('k') | Source/core/rendering/HitTestResult.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool HitTestLocation::intersects(const FloatRect& rect) const 145 bool HitTestLocation::intersects(const FloatRect& rect) const
146 { 146 {
147 return intersectsRect(rect); 147 return intersectsRect(rect);
148 } 148 }
149 149
150 bool HitTestLocation::intersects(const RoundedRect& rect) const 150 bool HitTestLocation::intersects(const RoundedRect& rect) const
151 { 151 {
152 return rect.intersectsQuad(m_transformedRect); 152 return rect.intersectsQuad(m_transformedRect);
153 } 153 }
154 154
155 bool HitTestLocation::containsPoint(const FloatPoint& point) const
156 {
157 return m_transformedRect.containsPoint(point);
158 }
159
155 IntRect HitTestLocation::rectForPoint(const LayoutPoint& point, unsigned topPadd ing, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) 160 IntRect HitTestLocation::rectForPoint(const LayoutPoint& point, unsigned topPadd ing, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
156 { 161 {
157 IntPoint actualPoint(flooredIntPoint(point)); 162 IntPoint actualPoint(flooredIntPoint(point));
158 actualPoint -= IntSize(leftPadding, topPadding); 163 actualPoint -= IntSize(leftPadding, topPadding);
159 164
160 IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding ); 165 IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding );
161 // As IntRect is left inclusive and right exclusive (seeing IntRect::contain s(x, y)), adding "1". 166 // As IntRect is left inclusive and right exclusive (seeing IntRect::contain s(x, y)), adding "1".
162 // FIXME: Remove this once non-rect based hit-detection stops using IntRect: intersects. 167 // FIXME: Remove this once non-rect based hit-detection stops using IntRect: intersects.
163 actualPadding += IntSize(1, 1); 168 actualPadding += IntSize(1, 1);
164 169
165 return IntRect(actualPoint, actualPadding); 170 return IntRect(actualPoint, actualPadding);
166 } 171 }
167 172
168 } // namespace WebCore 173 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/HitTestLocation.h ('k') | Source/core/rendering/HitTestResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698