| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 HitTestResult::~HitTestResult() | 96 HitTestResult::~HitTestResult() |
| 97 { | 97 { |
| 98 } | 98 } |
| 99 | 99 |
| 100 HitTestResult& HitTestResult::operator=(const HitTestResult& other) | 100 HitTestResult& HitTestResult::operator=(const HitTestResult& other) |
| 101 { | 101 { |
| 102 m_hitTestLocation = other.m_hitTestLocation; | 102 m_hitTestLocation = other.m_hitTestLocation; |
| 103 m_hitTestRequest = other.m_hitTestRequest; | 103 m_hitTestRequest = other.m_hitTestRequest; |
| 104 populateFromCachedResult(other); |
| 105 |
| 106 return *this; |
| 107 } |
| 108 |
| 109 bool HitTestResult::equalForCacheability(const HitTestResult& other) const |
| 110 { |
| 111 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest) |
| 112 && m_innerNode == other.innerNode() |
| 113 && m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode() |
| 114 && m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame |
| 115 && m_localPoint == other.localPoint() |
| 116 && m_innerURLElement == other.URLElement() |
| 117 && m_scrollbar == other.scrollbar() |
| 118 && m_isOverWidget == other.isOverWidget(); |
| 119 } |
| 120 |
| 121 void HitTestResult::cacheValues(const HitTestResult& other) |
| 122 { |
| 123 *this = other; |
| 124 m_hitTestRequest = other.m_hitTestRequest.type() & ~HitTestRequest::AvoidCac
he; |
| 125 } |
| 126 |
| 127 void HitTestResult::populateFromCachedResult(const HitTestResult& other) |
| 128 { |
| 104 m_innerNode = other.innerNode(); | 129 m_innerNode = other.innerNode(); |
| 105 m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); | 130 m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); |
| 106 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; | 131 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; |
| 107 m_localPoint = other.localPoint(); | 132 m_localPoint = other.localPoint(); |
| 108 m_innerURLElement = other.URLElement(); | 133 m_innerURLElement = other.URLElement(); |
| 109 m_scrollbar = other.scrollbar(); | 134 m_scrollbar = other.scrollbar(); |
| 110 m_isOverWidget = other.isOverWidget(); | 135 m_isOverWidget = other.isOverWidget(); |
| 136 m_validityRect = other.m_validityRect; |
| 111 | 137 |
| 112 // Only copy the NodeSet in case of list hit test. | 138 // Only copy the NodeSet in case of list hit test. |
| 113 m_listBasedTestResult = adoptPtrWillBeNoop(other.m_listBasedTestResult ? new
NodeSet(*other.m_listBasedTestResult) : 0); | 139 m_listBasedTestResult = adoptPtrWillBeNoop(other.m_listBasedTestResult ? new
NodeSet(*other.m_listBasedTestResult) : 0); |
| 114 | |
| 115 return *this; | |
| 116 } | 140 } |
| 117 | 141 |
| 118 DEFINE_TRACE(HitTestResult) | 142 DEFINE_TRACE(HitTestResult) |
| 119 { | 143 { |
| 120 visitor->trace(m_innerNode); | 144 visitor->trace(m_innerNode); |
| 121 visitor->trace(m_innerPossiblyPseudoNode); | 145 visitor->trace(m_innerPossiblyPseudoNode); |
| 122 visitor->trace(m_innerURLElement); | 146 visitor->trace(m_innerURLElement); |
| 123 visitor->trace(m_scrollbar); | 147 visitor->trace(m_scrollbar); |
| 124 #if ENABLE(OILPAN) | 148 #if ENABLE(OILPAN) |
| 125 visitor->trace(m_listBasedTestResult); | 149 visitor->trace(m_listBasedTestResult); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 bool HitTestResult::isSelected() const | 236 bool HitTestResult::isSelected() const |
| 213 { | 237 { |
| 214 if (!m_innerNode) | 238 if (!m_innerNode) |
| 215 return false; | 239 return false; |
| 216 | 240 |
| 217 if (LocalFrame* frame = m_innerNode->document().frame()) | 241 if (LocalFrame* frame = m_innerNode->document().frame()) |
| 218 return frame->selection().contains(m_hitTestLocation.point()); | 242 return frame->selection().contains(m_hitTestLocation.point()); |
| 219 return false; | 243 return false; |
| 220 } | 244 } |
| 221 | 245 |
| 246 void HitTestResult::setValidityRect(const LayoutRect& rect) |
| 247 { |
| 248 ASSERT(!rect.isEmpty()); |
| 249 m_validityRect = rect; |
| 250 } |
| 251 |
| 222 String HitTestResult::spellingToolTip(TextDirection& dir) const | 252 String HitTestResult::spellingToolTip(TextDirection& dir) const |
| 223 { | 253 { |
| 224 dir = LTR; | 254 dir = LTR; |
| 225 // Return the tool tip string associated with this point, if any. Only marke
rs associated with bad grammar | 255 // Return the tool tip string associated with this point, if any. Only marke
rs associated with bad grammar |
| 226 // currently supply strings, but maybe someday markers associated with missp
elled words will also. | 256 // currently supply strings, but maybe someday markers associated with missp
elled words will also. |
| 227 if (!m_innerNode) | 257 if (!m_innerNode) |
| 228 return String(); | 258 return String(); |
| 229 | 259 |
| 230 DocumentMarker* marker = m_innerNode->document().markers().markerContainingP
oint(m_hitTestLocation.point(), DocumentMarker::Grammar); | 260 DocumentMarker* marker = m_innerNode->document().markers().markerContainingP
oint(m_hitTestLocation.point(), DocumentMarker::Grammar); |
| 231 if (!marker) | 261 if (!marker) |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 else if (isHTMLMapElement(m_innerNode)) | 541 else if (isHTMLMapElement(m_innerNode)) |
| 512 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); | 542 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); |
| 513 | 543 |
| 514 if (!imageMapImageElement) | 544 if (!imageMapImageElement) |
| 515 return m_innerNode.get(); | 545 return m_innerNode.get(); |
| 516 | 546 |
| 517 return imageMapImageElement; | 547 return imageMapImageElement; |
| 518 } | 548 } |
| 519 | 549 |
| 520 } // namespace blink | 550 } // namespace blink |
| OLD | NEW |