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

Side by Side Diff: Source/core/layout/svg/line/SVGInlineTextBox.cpp

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 8 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
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2007 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 FloatRectWillBeLayoutRect fragmentRect(fragment.x, fragment.y - baseline , fragment.width, fragment.height); 255 FloatRectWillBeLayoutRect fragmentRect(fragment.x, fragment.y - baseline , fragment.width, fragment.height);
256 fragment.buildFragmentTransform(fragmentTransform); 256 fragment.buildFragmentTransform(fragmentTransform);
257 fragmentRect = fragmentTransform.mapRect(fragmentRect.toFloatRect()); 257 fragmentRect = fragmentTransform.mapRect(fragmentRect.toFloatRect());
258 258
259 textRect.unite(fragmentRect); 259 textRect.unite(fragmentRect);
260 } 260 }
261 261
262 return textRect; 262 return textRect;
263 } 263 }
264 264
265 bool SVGInlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumula tedOffset, LayoutUnit, LayoutUnit) 265 bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUn it)
266 { 266 {
267 // FIXME: integrate with InlineTextBox::nodeAtPoint better. 267 // FIXME: integrate with InlineTextBox::nodeAtPoint better.
268 ASSERT(!isLineBreak()); 268 ASSERT(!isLineBreak());
269 269
270 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, r equest, layoutObject().style()->pointerEvents()); 270 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, r esult.hitTestRequest(), layoutObject().style()->pointerEvents());
271 bool isVisible = layoutObject().style()->visibility() == VISIBLE; 271 bool isVisible = layoutObject().style()->visibility() == VISIBLE;
272 if (isVisible || !hitRules.requireVisible) { 272 if (isVisible || !hitRules.requireVisible) {
273 if (hitRules.canHitBoundingBox 273 if (hitRules.canHitBoundingBox
274 || (hitRules.canHitStroke && (layoutObject().style()->svgStyle().has Stroke() || !hitRules.requireStroke)) 274 || (hitRules.canHitStroke && (layoutObject().style()->svgStyle().has Stroke() || !hitRules.requireStroke))
275 || (hitRules.canHitFill && (layoutObject().style()->svgStyle().hasFi ll() || !hitRules.requireFill))) { 275 || (hitRules.canHitFill && (layoutObject().style()->svgStyle().hasFi ll() || !hitRules.requireFill))) {
276 FloatPointWillBeLayoutPoint boxOrigin(x(), y()); 276 FloatPointWillBeLayoutPoint boxOrigin(x(), y());
277 boxOrigin.moveBy(accumulatedOffset); 277 boxOrigin.moveBy(accumulatedOffset);
278 FloatRectWillBeLayoutRect rect(boxOrigin, size()); 278 FloatRectWillBeLayoutRect rect(boxOrigin, size());
279 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition 279 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition
280 // to LayoutUnit-based types is complete (crbug.com/321237) 280 // to LayoutUnit-based types is complete (crbug.com/321237)
281 if (locationInContainer.intersects(rect.rawValue())) { 281 if (locationInContainer.intersects(rect.rawValue())) {
282 layoutObject().updateHitTestResult(result, locationInContainer.p oint() - toLayoutSize(accumulatedOffset)); 282 layoutObject().updateHitTestResult(result, locationInContainer.p oint() - toLayoutSize(accumulatedOffset));
283 if (!result.addNodeToListBasedTestResult(layoutObject().node(), request, locationInContainer, rect.rawValue())) 283 if (!result.addNodeToListBasedTestResult(layoutObject().node(), locationInContainer, rect.rawValue()))
284 return true; 284 return true;
285 } 285 }
286 } 286 }
287 } 287 }
288 return false; 288 return false;
289 } 289 }
290 290
291 } // namespace blink 291 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/line/SVGInlineTextBox.h ('k') | Source/core/page/ContextMenuController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698