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

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

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 13 matching lines...) Expand all
24 24
25 #include "HTMLNames.h" 25 #include "HTMLNames.h"
26 #include "SVGNames.h" 26 #include "SVGNames.h"
27 #include "XLinkNames.h" 27 #include "XLinkNames.h"
28 28
29 namespace WebCore { 29 namespace WebCore {
30 30
31 using namespace HTMLNames; 31 using namespace HTMLNames;
32 32
33 HitTestLocation::HitTestLocation() 33 HitTestLocation::HitTestLocation()
34 : m_region(0) 34 : m_isRectBased(false)
35 , m_isRectBased(false)
36 , m_isRectilinear(true) 35 , m_isRectilinear(true)
37 { 36 {
38 } 37 }
39 38
40 HitTestLocation::HitTestLocation(const LayoutPoint& point) 39 HitTestLocation::HitTestLocation(const LayoutPoint& point)
41 : m_point(point) 40 : m_point(point)
42 , m_boundingBox(rectForPoint(point, 0, 0, 0, 0)) 41 , m_boundingBox(rectForPoint(point, 0, 0, 0, 0))
43 , m_transformedPoint(point) 42 , m_transformedPoint(point)
44 , m_transformedRect(m_boundingBox) 43 , m_transformedRect(m_boundingBox)
45 , m_region(0)
46 , m_isRectBased(false) 44 , m_isRectBased(false)
47 , m_isRectilinear(true) 45 , m_isRectilinear(true)
48 { 46 {
49 } 47 }
50 48
51 HitTestLocation::HitTestLocation(const FloatPoint& point) 49 HitTestLocation::HitTestLocation(const FloatPoint& point)
52 : m_point(flooredLayoutPoint(point)) 50 : m_point(flooredLayoutPoint(point))
53 , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0)) 51 , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0))
54 , m_transformedPoint(point) 52 , m_transformedPoint(point)
55 , m_transformedRect(m_boundingBox) 53 , m_transformedRect(m_boundingBox)
56 , m_region(0)
57 , m_isRectBased(false) 54 , m_isRectBased(false)
58 , m_isRectilinear(true) 55 , m_isRectilinear(true)
59 { 56 {
60 } 57 }
61 58
62 HitTestLocation::HitTestLocation(const FloatPoint& point, const FloatQuad& quad) 59 HitTestLocation::HitTestLocation(const FloatPoint& point, const FloatQuad& quad)
63 : m_transformedPoint(point) 60 : m_transformedPoint(point)
64 , m_transformedRect(quad) 61 , m_transformedRect(quad)
65 , m_region(0)
66 , m_isRectBased(true) 62 , m_isRectBased(true)
67 { 63 {
68 m_point = flooredLayoutPoint(point); 64 m_point = flooredLayoutPoint(point);
69 m_boundingBox = enclosingIntRect(quad.boundingBox()); 65 m_boundingBox = enclosingIntRect(quad.boundingBox());
70 m_isRectilinear = quad.isRectilinear(); 66 m_isRectilinear = quad.isRectilinear();
71 } 67 }
72 68
73 HitTestLocation::HitTestLocation(const LayoutPoint& centerPoint, unsigned topPad ding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) 69 HitTestLocation::HitTestLocation(const LayoutPoint& centerPoint, unsigned topPad ding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
74 : m_point(centerPoint) 70 : m_point(centerPoint)
75 , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPa dding, leftPadding)) 71 , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPa dding, leftPadding))
76 , m_transformedPoint(centerPoint) 72 , m_transformedPoint(centerPoint)
77 , m_region(0)
78 , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding) 73 , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding)
79 , m_isRectilinear(true) 74 , m_isRectilinear(true)
80 { 75 {
81 m_transformedRect = FloatQuad(m_boundingBox); 76 m_transformedRect = FloatQuad(m_boundingBox);
82 } 77 }
83 78
84 HitTestLocation::HitTestLocation(const HitTestLocation& other, const LayoutSize& offset, RenderRegion* region) 79 HitTestLocation::HitTestLocation(const HitTestLocation& other, const LayoutSize& offset)
85 : m_point(other.m_point) 80 : m_point(other.m_point)
86 , m_boundingBox(other.m_boundingBox) 81 , m_boundingBox(other.m_boundingBox)
87 , m_transformedPoint(other.m_transformedPoint) 82 , m_transformedPoint(other.m_transformedPoint)
88 , m_transformedRect(other.m_transformedRect) 83 , m_transformedRect(other.m_transformedRect)
89 , m_region(region ? region : other.m_region)
90 , m_isRectBased(other.m_isRectBased) 84 , m_isRectBased(other.m_isRectBased)
91 , m_isRectilinear(other.m_isRectilinear) 85 , m_isRectilinear(other.m_isRectilinear)
92 { 86 {
93 move(offset); 87 move(offset);
94 } 88 }
95 89
96 HitTestLocation::HitTestLocation(const HitTestLocation& other) 90 HitTestLocation::HitTestLocation(const HitTestLocation& other)
97 : m_point(other.m_point) 91 : m_point(other.m_point)
98 , m_boundingBox(other.m_boundingBox) 92 , m_boundingBox(other.m_boundingBox)
99 , m_transformedPoint(other.m_transformedPoint) 93 , m_transformedPoint(other.m_transformedPoint)
100 , m_transformedRect(other.m_transformedRect) 94 , m_transformedRect(other.m_transformedRect)
101 , m_region(other.m_region)
102 , m_isRectBased(other.m_isRectBased) 95 , m_isRectBased(other.m_isRectBased)
103 , m_isRectilinear(other.m_isRectilinear) 96 , m_isRectilinear(other.m_isRectilinear)
104 { 97 {
105 } 98 }
106 99
107 HitTestLocation::~HitTestLocation() 100 HitTestLocation::~HitTestLocation()
108 { 101 {
109 } 102 }
110 103
111 HitTestLocation& HitTestLocation::operator=(const HitTestLocation& other) 104 HitTestLocation& HitTestLocation::operator=(const HitTestLocation& other)
112 { 105 {
113 m_point = other.m_point; 106 m_point = other.m_point;
114 m_boundingBox = other.m_boundingBox; 107 m_boundingBox = other.m_boundingBox;
115 m_transformedPoint = other.m_transformedPoint; 108 m_transformedPoint = other.m_transformedPoint;
116 m_transformedRect = other.m_transformedRect; 109 m_transformedRect = other.m_transformedRect;
117 m_region = other.m_region;
118 m_isRectBased = other.m_isRectBased; 110 m_isRectBased = other.m_isRectBased;
119 m_isRectilinear = other.m_isRectilinear; 111 m_isRectilinear = other.m_isRectilinear;
120 112
121 return *this; 113 return *this;
122 } 114 }
123 115
124 void HitTestLocation::move(const LayoutSize& offset) 116 void HitTestLocation::move(const LayoutSize& offset)
125 { 117 {
126 m_point.move(offset); 118 m_point.move(offset);
127 m_transformedPoint.move(offset); 119 m_transformedPoint.move(offset);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 165
174 IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding ); 166 IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding );
175 // As IntRect is left inclusive and right exclusive (seeing IntRect::contain s(x, y)), adding "1". 167 // As IntRect is left inclusive and right exclusive (seeing IntRect::contain s(x, y)), adding "1".
176 // FIXME: Remove this once non-rect based hit-detection stops using IntRect: intersects. 168 // FIXME: Remove this once non-rect based hit-detection stops using IntRect: intersects.
177 actualPadding += IntSize(1, 1); 169 actualPadding += IntSize(1, 1);
178 170
179 return IntRect(actualPoint, actualPadding); 171 return IntRect(actualPoint, actualPadding);
180 } 172 }
181 173
182 } // namespace WebCore 174 } // 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