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