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 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 575 |
576 // If node is null, return true so the hit test can continue. | 576 // If node is null, return true so the hit test can continue. |
577 if (!node) | 577 if (!node) |
578 return true; | 578 return true; |
579 | 579 |
580 if (m_shadowContentFilterPolicy == DoNotAllowShadowContent) | 580 if (m_shadowContentFilterPolicy == DoNotAllowShadowContent) |
581 node = node->shadowAncestorNode(); | 581 node = node->shadowAncestorNode(); |
582 | 582 |
583 mutableRectBasedTestResult().add(node); | 583 mutableRectBasedTestResult().add(node); |
584 | 584 |
585 if (node->renderer()->isInline()) { | 585 bool regionFilled = rect.contains(rectForPoint(pointInContainer)); |
| 586 // FIXME: This code (incorrectly) attempts to correct for culled inline node
s. See https://bugs.webkit.org/show_bug.cgi?id=85849. |
| 587 if (node->renderer()->isInline() && !regionFilled) { |
586 for (RenderObject* curr = node->renderer()->parent(); curr; curr = curr-
>parent()) { | 588 for (RenderObject* curr = node->renderer()->parent(); curr; curr = curr-
>parent()) { |
587 if (!curr->isRenderInline()) | 589 if (!curr->isRenderInline()) |
588 break; | 590 break; |
589 | 591 |
590 // We need to make sure the nodes for culled inlines get included. | 592 // We need to make sure the nodes for culled inlines get included. |
591 RenderInline* currInline = toRenderInline(curr); | 593 RenderInline* currInline = toRenderInline(curr); |
592 if (currInline->alwaysCreateLineBoxes()) | 594 if (currInline->alwaysCreateLineBoxes()) |
593 break; | 595 break; |
594 | 596 |
595 if (currInline->visibleToHitTesting() && currInline->node()) | 597 if (currInline->visibleToHitTesting() && currInline->node()) |
596 mutableRectBasedTestResult().add(currInline->node()->shadowAnces
torNode()); | 598 mutableRectBasedTestResult().add(currInline->node()->shadowAnces
torNode()); |
597 } | 599 } |
598 } | 600 } |
599 return !rect.contains(rectForPoint(pointInContainer)); | 601 return !regionFilled; |
600 } | 602 } |
601 | 603 |
602 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint&
pointInContainer, const FloatRect& rect) | 604 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint&
pointInContainer, const FloatRect& rect) |
603 { | 605 { |
604 // If it is not a rect-based hit test, this method has to be no-op. | 606 // If it is not a rect-based hit test, this method has to be no-op. |
605 // Return false, so the hit test stops. | 607 // Return false, so the hit test stops. |
606 if (!isRectBasedTest()) | 608 if (!isRectBasedTest()) |
607 return false; | 609 return false; |
608 | 610 |
609 // If node is null, return true so the hit test can continue. | 611 // If node is null, return true so the hit test can continue. |
610 if (!node) | 612 if (!node) |
611 return true; | 613 return true; |
612 | 614 |
613 if (m_shadowContentFilterPolicy == DoNotAllowShadowContent) | 615 if (m_shadowContentFilterPolicy == DoNotAllowShadowContent) |
614 node = node->shadowAncestorNode(); | 616 node = node->shadowAncestorNode(); |
615 | 617 |
616 mutableRectBasedTestResult().add(node); | 618 mutableRectBasedTestResult().add(node); |
617 | 619 |
618 if (node->renderer()->isInline()) { | 620 bool regionFilled = rect.contains(rectForPoint(pointInContainer)); |
| 621 // FIXME: This code (incorrectly) attempts to correct for culled inline node
s. See https://bugs.webkit.org/show_bug.cgi?id=85849. |
| 622 if (node->renderer()->isInline() && !regionFilled) { |
619 for (RenderObject* curr = node->renderer()->parent(); curr; curr = curr-
>parent()) { | 623 for (RenderObject* curr = node->renderer()->parent(); curr; curr = curr-
>parent()) { |
620 if (!curr->isRenderInline()) | 624 if (!curr->isRenderInline()) |
621 break; | 625 break; |
622 | 626 |
623 // We need to make sure the nodes for culled inlines get included. | 627 // We need to make sure the nodes for culled inlines get included. |
624 RenderInline* currInline = toRenderInline(curr); | 628 RenderInline* currInline = toRenderInline(curr); |
625 if (currInline->alwaysCreateLineBoxes()) | 629 if (currInline->alwaysCreateLineBoxes()) |
626 break; | 630 break; |
627 | 631 |
628 if (currInline->visibleToHitTesting() && currInline->node()) | 632 if (currInline->visibleToHitTesting() && currInline->node()) |
629 mutableRectBasedTestResult().add(currInline->node()->shadowAnces
torNode()); | 633 mutableRectBasedTestResult().add(currInline->node()->shadowAnces
torNode()); |
630 } | 634 } |
631 } | 635 } |
632 return !rect.contains(rectForPoint(pointInContainer)); | 636 return !regionFilled; |
633 } | 637 } |
634 | 638 |
635 void HitTestResult::append(const HitTestResult& other) | 639 void HitTestResult::append(const HitTestResult& other) |
636 { | 640 { |
637 ASSERT(isRectBasedTest() && other.isRectBasedTest()); | 641 ASSERT(isRectBasedTest() && other.isRectBasedTest()); |
638 | 642 |
639 if (!m_innerNode && other.innerNode()) { | 643 if (!m_innerNode && other.innerNode()) { |
640 m_innerNode = other.innerNode(); | 644 m_innerNode = other.innerNode(); |
641 m_innerNonSharedNode = other.innerNonSharedNode(); | 645 m_innerNonSharedNode = other.innerNonSharedNode(); |
642 m_localPoint = other.localPoint(); | 646 m_localPoint = other.localPoint(); |
(...skipping 29 matching lines...) Expand all Loading... |
672 } | 676 } |
673 | 677 |
674 HitTestResult::NodeSet& HitTestResult::mutableRectBasedTestResult() | 678 HitTestResult::NodeSet& HitTestResult::mutableRectBasedTestResult() |
675 { | 679 { |
676 if (!m_rectBasedTestResult) | 680 if (!m_rectBasedTestResult) |
677 m_rectBasedTestResult = adoptPtr(new NodeSet); | 681 m_rectBasedTestResult = adoptPtr(new NodeSet); |
678 return *m_rectBasedTestResult; | 682 return *m_rectBasedTestResult; |
679 } | 683 } |
680 | 684 |
681 } // namespace WebCore | 685 } // namespace WebCore |
OLD | NEW |