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

Side by Side Diff: Source/core/layout/svg/LayoutSVGImage.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
« no previous file with comments | « Source/core/layout/svg/LayoutSVGImage.h ('k') | Source/core/layout/svg/LayoutSVGModelObject.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 Alexander Kellett <lypanov@kde.org> 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org>
6 * Copyright (C) 2009 Google, Inc. 6 * Copyright (C) 2009 Google, Inc.
7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public 11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either 12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version. 13 * version 2 of the License, or (at your option) any later version.
14 * 14 *
15 * This library is distributed in the hope that it will be useful, 15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details. 18 * Library General Public License for more details.
19 * 19 *
20 * You should have received a copy of the GNU Library General Public License 20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB. If not, write to 21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "core/layout/svg/LayoutSVGImage.h" 28 #include "core/layout/svg/LayoutSVGImage.h"
29 29
30 #include "core/layout/HitTestResult.h"
30 #include "core/layout/ImageQualityController.h" 31 #include "core/layout/ImageQualityController.h"
31 #include "core/layout/LayoutAnalyzer.h" 32 #include "core/layout/LayoutAnalyzer.h"
32 #include "core/layout/LayoutImageResource.h" 33 #include "core/layout/LayoutImageResource.h"
33 #include "core/layout/PointerEventsHitRules.h" 34 #include "core/layout/PointerEventsHitRules.h"
34 #include "core/layout/svg/LayoutSVGResourceContainer.h" 35 #include "core/layout/svg/LayoutSVGResourceContainer.h"
35 #include "core/layout/svg/SVGLayoutSupport.h" 36 #include "core/layout/svg/SVGLayoutSupport.h"
36 #include "core/layout/svg/SVGResources.h" 37 #include "core/layout/svg/SVGResources.h"
37 #include "core/layout/svg/SVGResourcesCache.h" 38 #include "core/layout/svg/SVGResourcesCache.h"
38 #include "core/paint/SVGImagePainter.h" 39 #include "core/paint/SVGImagePainter.h"
39 #include "core/svg/SVGImageElement.h" 40 #include "core/svg/SVGImageElement.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 LayoutSVGModelObject::setNeedsBoundariesUpdate(); 147 LayoutSVGModelObject::setNeedsBoundariesUpdate();
147 148
148 clearNeedsLayout(); 149 clearNeedsLayout();
149 } 150 }
150 151
151 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) 152 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&)
152 { 153 {
153 SVGImagePainter(*this).paint(paintInfo); 154 SVGImagePainter(*this).paint(paintInfo);
154 } 155 }
155 156
156 bool LayoutSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) 157 bool LayoutSVGImage::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& p ointInParent, HitTestAction hitTestAction)
157 { 158 {
158 // We only draw in the forground phase, so we only hit-test then. 159 // We only draw in the forground phase, so we only hit-test then.
159 if (hitTestAction != HitTestForeground) 160 if (hitTestAction != HitTestForeground)
160 return false; 161 return false;
161 162
162 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_IMAGE_HITTESTING, request, style()->pointerEvents()); 163 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_IMAGE_HITTESTING, result.hitTestRequest(), style()->pointerEvents());
163 bool isVisible = (style()->visibility() == VISIBLE); 164 bool isVisible = (style()->visibility() == VISIBLE);
164 if (isVisible || !hitRules.requireVisible) { 165 if (isVisible || !hitRules.requireVisible) {
165 FloatPoint localPoint; 166 FloatPoint localPoint;
166 if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping(this, localT oParentTransform(), pointInParent, localPoint)) 167 if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping(this, localT oParentTransform(), pointInParent, localPoint))
167 return false; 168 return false;
168 169
169 if (hitRules.canHitFill || hitRules.canHitBoundingBox) { 170 if (hitRules.canHitFill || hitRules.canHitBoundingBox) {
170 if (m_objectBoundingBox.contains(localPoint)) { 171 if (m_objectBoundingBox.contains(localPoint)) {
171 updateHitTestResult(result, roundedLayoutPoint(localPoint)); 172 updateHitTestResult(result, roundedLayoutPoint(localPoint));
172 return true; 173 return true;
(...skipping 26 matching lines...) Expand all
199 200
200 void LayoutSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo int&) const 201 void LayoutSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo int&) const
201 { 202 {
202 // this is called from paint() after the localTransform has already been app lied 203 // this is called from paint() after the localTransform has already been app lied
203 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates( )); 204 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates( ));
204 if (!contentRect.isEmpty()) 205 if (!contentRect.isEmpty())
205 rects.append(contentRect); 206 rects.append(contentRect);
206 } 207 }
207 208
208 } // namespace blink 209 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGImage.h ('k') | Source/core/layout/svg/LayoutSVGModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698