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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 457 |
458 HitTestResult::NodeSet& HitTestResult::mutableRectBasedTestResult() | 458 HitTestResult::NodeSet& HitTestResult::mutableRectBasedTestResult() |
459 { | 459 { |
460 if (!m_rectBasedTestResult) | 460 if (!m_rectBasedTestResult) |
461 m_rectBasedTestResult = adoptPtrWillBeNoop(new NodeSet); | 461 m_rectBasedTestResult = adoptPtrWillBeNoop(new NodeSet); |
462 return *m_rectBasedTestResult; | 462 return *m_rectBasedTestResult; |
463 } | 463 } |
464 | 464 |
465 void HitTestResult::resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPo
int& resolvedPointInMainFrame) | 465 void HitTestResult::resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPo
int& resolvedPointInMainFrame) |
466 { | 466 { |
467 // FIXME: For maximum fidelity with point-based hit tests we should probably
make use | |
468 // of RenderObject::updateHitTestResult here. See http://crbug.com/398914. | |
469 ASSERT(isRectBasedTest()); | 467 ASSERT(isRectBasedTest()); |
470 ASSERT(m_hitTestLocation.containsPoint(resolvedPointInMainFrame)); | 468 ASSERT(m_hitTestLocation.containsPoint(resolvedPointInMainFrame)); |
471 setInnerNode(resolvedInnerNode); | |
472 setInnerNonSharedNode(resolvedInnerNode); | |
473 m_hitTestLocation = HitTestLocation(resolvedPointInMainFrame); | 469 m_hitTestLocation = HitTestLocation(resolvedPointInMainFrame); |
474 m_pointInInnerNodeFrame = resolvedPointInMainFrame; | 470 m_pointInInnerNodeFrame = resolvedPointInMainFrame; |
| 471 m_innerNode = nullptr; |
| 472 m_innerNonSharedNode = nullptr; |
| 473 m_innerPossiblyPseudoNode = nullptr; |
475 m_rectBasedTestResult = nullptr; | 474 m_rectBasedTestResult = nullptr; |
| 475 |
| 476 // Update the HitTestResult as if the supplied node had been hit in normal p
oint-based hit-test. |
| 477 // Note that we don't know the local point after a rect-based hit-test, but
we never use |
| 478 // it so shouldn't bother with the cost of computing it. |
| 479 resolvedInnerNode->renderer()->updateHitTestResult(*this, LayoutPoint()); |
476 ASSERT(!isRectBasedTest()); | 480 ASSERT(!isRectBasedTest()); |
477 } | 481 } |
478 | 482 |
479 Element* HitTestResult::innerElement() const | 483 Element* HitTestResult::innerElement() const |
480 { | 484 { |
481 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) { | 485 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) { |
482 if (node->isElementNode()) | 486 if (node->isElementNode()) |
483 return toElement(node); | 487 return toElement(node); |
484 } | 488 } |
485 | 489 |
486 return 0; | 490 return 0; |
487 } | 491 } |
488 | 492 |
489 } // namespace blink | 493 } // namespace blink |
OLD | NEW |