OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 #include "platform/geometry/Region.h" | 41 #include "platform/geometry/Region.h" |
42 #include "platform/scroll/Scrollbar.h" | 42 #include "platform/scroll/Scrollbar.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
47 | 47 |
48 HitTestResult::HitTestResult() | 48 HitTestResult::HitTestResult() |
49 : m_hitTestRequest(HitTestRequest::ReadOnly | HitTestRequest::Active), | 49 : m_hitTestRequest(HitTestRequest::ReadOnly | HitTestRequest::Active), |
50 m_cacheable(true), | 50 m_cacheable(true), |
51 m_isOverWidget(false) {} | 51 m_isOverFrameViewBase(false) {} |
52 | 52 |
53 HitTestResult::HitTestResult(const HitTestRequest& request, | 53 HitTestResult::HitTestResult(const HitTestRequest& request, |
54 const LayoutPoint& point) | 54 const LayoutPoint& point) |
55 : m_hitTestLocation(point), | 55 : m_hitTestLocation(point), |
56 m_hitTestRequest(request), | 56 m_hitTestRequest(request), |
57 m_cacheable(true), | 57 m_cacheable(true), |
58 m_pointInInnerNodeFrame(point), | 58 m_pointInInnerNodeFrame(point), |
59 m_isOverWidget(false) {} | 59 m_isOverFrameViewBase(false) {} |
60 | 60 |
61 HitTestResult::HitTestResult(const HitTestRequest& request, | 61 HitTestResult::HitTestResult(const HitTestRequest& request, |
62 const LayoutPoint& centerPoint, | 62 const LayoutPoint& centerPoint, |
63 unsigned topPadding, | 63 unsigned topPadding, |
64 unsigned rightPadding, | 64 unsigned rightPadding, |
65 unsigned bottomPadding, | 65 unsigned bottomPadding, |
66 unsigned leftPadding) | 66 unsigned leftPadding) |
67 : m_hitTestLocation(centerPoint, | 67 : m_hitTestLocation(centerPoint, |
68 topPadding, | 68 topPadding, |
69 rightPadding, | 69 rightPadding, |
70 bottomPadding, | 70 bottomPadding, |
71 leftPadding), | 71 leftPadding), |
72 m_hitTestRequest(request), | 72 m_hitTestRequest(request), |
73 m_cacheable(true), | 73 m_cacheable(true), |
74 m_pointInInnerNodeFrame(centerPoint), | 74 m_pointInInnerNodeFrame(centerPoint), |
75 m_isOverWidget(false) {} | 75 m_isOverFrameViewBase(false) {} |
76 | 76 |
77 HitTestResult::HitTestResult(const HitTestRequest& otherRequest, | 77 HitTestResult::HitTestResult(const HitTestRequest& otherRequest, |
78 const HitTestLocation& other) | 78 const HitTestLocation& other) |
79 : m_hitTestLocation(other), | 79 : m_hitTestLocation(other), |
80 m_hitTestRequest(otherRequest), | 80 m_hitTestRequest(otherRequest), |
81 m_cacheable(true), | 81 m_cacheable(true), |
82 m_pointInInnerNodeFrame(m_hitTestLocation.point()), | 82 m_pointInInnerNodeFrame(m_hitTestLocation.point()), |
83 m_isOverWidget(false) {} | 83 m_isOverFrameViewBase(false) {} |
84 | 84 |
85 HitTestResult::HitTestResult(const HitTestResult& other) | 85 HitTestResult::HitTestResult(const HitTestResult& other) |
86 : m_hitTestLocation(other.m_hitTestLocation), | 86 : m_hitTestLocation(other.m_hitTestLocation), |
87 m_hitTestRequest(other.m_hitTestRequest), | 87 m_hitTestRequest(other.m_hitTestRequest), |
88 m_cacheable(other.m_cacheable), | 88 m_cacheable(other.m_cacheable), |
89 m_innerNode(other.innerNode()), | 89 m_innerNode(other.innerNode()), |
90 m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode), | 90 m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode), |
91 m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame), | 91 m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame), |
92 m_localPoint(other.localPoint()), | 92 m_localPoint(other.localPoint()), |
93 m_innerURLElement(other.URLElement()), | 93 m_innerURLElement(other.URLElement()), |
94 m_scrollbar(other.scrollbar()), | 94 m_scrollbar(other.scrollbar()), |
95 m_isOverWidget(other.isOverWidget()), | 95 m_isOverFrameViewBase(other.isOverFrameViewBase()), |
96 m_canvasRegionId(other.canvasRegionId()) { | 96 m_canvasRegionId(other.canvasRegionId()) { |
97 // Only copy the NodeSet in case of list hit test. | 97 // Only copy the NodeSet in case of list hit test. |
98 m_listBasedTestResult = other.m_listBasedTestResult | 98 m_listBasedTestResult = other.m_listBasedTestResult |
99 ? new NodeSet(*other.m_listBasedTestResult) | 99 ? new NodeSet(*other.m_listBasedTestResult) |
100 : nullptr; | 100 : nullptr; |
101 } | 101 } |
102 | 102 |
103 HitTestResult::~HitTestResult() {} | 103 HitTestResult::~HitTestResult() {} |
104 | 104 |
105 HitTestResult& HitTestResult::operator=(const HitTestResult& other) { | 105 HitTestResult& HitTestResult::operator=(const HitTestResult& other) { |
106 m_hitTestLocation = other.m_hitTestLocation; | 106 m_hitTestLocation = other.m_hitTestLocation; |
107 m_hitTestRequest = other.m_hitTestRequest; | 107 m_hitTestRequest = other.m_hitTestRequest; |
108 populateFromCachedResult(other); | 108 populateFromCachedResult(other); |
109 | 109 |
110 return *this; | 110 return *this; |
111 } | 111 } |
112 | 112 |
113 bool HitTestResult::equalForCacheability(const HitTestResult& other) const { | 113 bool HitTestResult::equalForCacheability(const HitTestResult& other) const { |
114 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest) && | 114 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest) && |
115 m_innerNode == other.innerNode() && | 115 m_innerNode == other.innerNode() && |
116 m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode() && | 116 m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode() && |
117 m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame && | 117 m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame && |
118 m_localPoint == other.localPoint() && | 118 m_localPoint == other.localPoint() && |
119 m_innerURLElement == other.URLElement() && | 119 m_innerURLElement == other.URLElement() && |
120 m_scrollbar == other.scrollbar() && | 120 m_scrollbar == other.scrollbar() && |
121 m_isOverWidget == other.isOverWidget(); | 121 m_isOverFrameViewBase == other.isOverFrameViewBase(); |
122 } | 122 } |
123 | 123 |
124 void HitTestResult::cacheValues(const HitTestResult& other) { | 124 void HitTestResult::cacheValues(const HitTestResult& other) { |
125 *this = other; | 125 *this = other; |
126 m_hitTestRequest = | 126 m_hitTestRequest = |
127 other.m_hitTestRequest.type() & ~HitTestRequest::AvoidCache; | 127 other.m_hitTestRequest.type() & ~HitTestRequest::AvoidCache; |
128 } | 128 } |
129 | 129 |
130 void HitTestResult::populateFromCachedResult(const HitTestResult& other) { | 130 void HitTestResult::populateFromCachedResult(const HitTestResult& other) { |
131 m_innerNode = other.innerNode(); | 131 m_innerNode = other.innerNode(); |
132 m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); | 132 m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); |
133 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; | 133 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; |
134 m_localPoint = other.localPoint(); | 134 m_localPoint = other.localPoint(); |
135 m_innerURLElement = other.URLElement(); | 135 m_innerURLElement = other.URLElement(); |
136 m_scrollbar = other.scrollbar(); | 136 m_scrollbar = other.scrollbar(); |
137 m_isOverWidget = other.isOverWidget(); | 137 m_isOverFrameViewBase = other.isOverFrameViewBase(); |
138 m_cacheable = other.m_cacheable; | 138 m_cacheable = other.m_cacheable; |
139 m_canvasRegionId = other.canvasRegionId(); | 139 m_canvasRegionId = other.canvasRegionId(); |
140 | 140 |
141 // Only copy the NodeSet in case of list hit test. | 141 // Only copy the NodeSet in case of list hit test. |
142 m_listBasedTestResult = other.m_listBasedTestResult | 142 m_listBasedTestResult = other.m_listBasedTestResult |
143 ? new NodeSet(*other.m_listBasedTestResult) | 143 ? new NodeSet(*other.m_listBasedTestResult) |
144 : nullptr; | 144 : nullptr; |
145 } | 145 } |
146 | 146 |
147 DEFINE_TRACE(HitTestResult) { | 147 DEFINE_TRACE(HitTestResult) { |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 if (!m_scrollbar && other.scrollbar()) { | 432 if (!m_scrollbar && other.scrollbar()) { |
433 setScrollbar(other.scrollbar()); | 433 setScrollbar(other.scrollbar()); |
434 } | 434 } |
435 | 435 |
436 if (!m_innerNode && other.innerNode()) { | 436 if (!m_innerNode && other.innerNode()) { |
437 m_innerNode = other.innerNode(); | 437 m_innerNode = other.innerNode(); |
438 m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); | 438 m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); |
439 m_localPoint = other.localPoint(); | 439 m_localPoint = other.localPoint(); |
440 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; | 440 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; |
441 m_innerURLElement = other.URLElement(); | 441 m_innerURLElement = other.URLElement(); |
442 m_isOverWidget = other.isOverWidget(); | 442 m_isOverFrameViewBase = other.isOverFrameViewBase(); |
443 m_canvasRegionId = other.canvasRegionId(); | 443 m_canvasRegionId = other.canvasRegionId(); |
444 } | 444 } |
445 | 445 |
446 if (other.m_listBasedTestResult) { | 446 if (other.m_listBasedTestResult) { |
447 NodeSet& set = mutableListBasedTestResult(); | 447 NodeSet& set = mutableListBasedTestResult(); |
448 for (NodeSet::const_iterator it = other.m_listBasedTestResult->begin(), | 448 for (NodeSet::const_iterator it = other.m_listBasedTestResult->begin(), |
449 last = other.m_listBasedTestResult->end(); | 449 last = other.m_listBasedTestResult->end(); |
450 it != last; ++it) | 450 it != last; ++it) |
451 set.insert(it->get()); | 451 set.insert(it->get()); |
452 } | 452 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 else if (isHTMLMapElement(m_innerNode)) | 503 else if (isHTMLMapElement(m_innerNode)) |
504 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); | 504 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); |
505 | 505 |
506 if (!imageMapImageElement) | 506 if (!imageMapImageElement) |
507 return m_innerNode.get(); | 507 return m_innerNode.get(); |
508 | 508 |
509 return imageMapImageElement; | 509 return imageMapImageElement; |
510 } | 510 } |
511 | 511 |
512 } // namespace blink | 512 } // namespace blink |
OLD | NEW |