| 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 29 matching lines...) Expand all  Loading... | 
| 40 #include "core/rendering/RenderTextFragment.h" | 40 #include "core/rendering/RenderTextFragment.h" | 
| 41 #include "core/svg/SVGElement.h" | 41 #include "core/svg/SVGElement.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_isOverWidget(false) | 49     : m_isOverWidget(false) | 
| 50     , m_isFirstLetter(false) |  | 
| 51 { | 50 { | 
| 52 } | 51 } | 
| 53 | 52 | 
| 54 HitTestResult::HitTestResult(const LayoutPoint& point) | 53 HitTestResult::HitTestResult(const LayoutPoint& point) | 
| 55     : m_hitTestLocation(point) | 54     : m_hitTestLocation(point) | 
| 56     , m_pointInInnerNodeFrame(point) | 55     , m_pointInInnerNodeFrame(point) | 
| 57     , m_isOverWidget(false) | 56     , m_isOverWidget(false) | 
| 58     , m_isFirstLetter(false) |  | 
| 59 { | 57 { | 
| 60 } | 58 } | 
| 61 | 59 | 
| 62 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding
     , unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) | 60 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding
     , unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) | 
| 63     : m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, le
     ftPadding) | 61     : m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, le
     ftPadding) | 
| 64     , m_pointInInnerNodeFrame(centerPoint) | 62     , m_pointInInnerNodeFrame(centerPoint) | 
| 65     , m_isOverWidget(false) | 63     , m_isOverWidget(false) | 
| 66     , m_isFirstLetter(false) |  | 
| 67 { | 64 { | 
| 68 } | 65 } | 
| 69 | 66 | 
| 70 HitTestResult::HitTestResult(const HitTestLocation& other) | 67 HitTestResult::HitTestResult(const HitTestLocation& other) | 
| 71     : m_hitTestLocation(other) | 68     : m_hitTestLocation(other) | 
| 72     , m_pointInInnerNodeFrame(m_hitTestLocation.point()) | 69     , m_pointInInnerNodeFrame(m_hitTestLocation.point()) | 
| 73     , m_isOverWidget(false) | 70     , m_isOverWidget(false) | 
| 74     , m_isFirstLetter(false) |  | 
| 75 { | 71 { | 
| 76 } | 72 } | 
| 77 | 73 | 
| 78 HitTestResult::HitTestResult(const HitTestResult& other) | 74 HitTestResult::HitTestResult(const HitTestResult& other) | 
| 79     : m_hitTestLocation(other.m_hitTestLocation) | 75     : m_hitTestLocation(other.m_hitTestLocation) | 
| 80     , m_innerNode(other.innerNode()) | 76     , m_innerNode(other.innerNode()) | 
| 81     , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode) | 77     , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode) | 
| 82     , m_innerNonSharedNode(other.innerNonSharedNode()) | 78     , m_innerNonSharedNode(other.innerNonSharedNode()) | 
| 83     , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame) | 79     , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame) | 
| 84     , m_localPoint(other.localPoint()) | 80     , m_localPoint(other.localPoint()) | 
| 85     , m_innerURLElement(other.URLElement()) | 81     , m_innerURLElement(other.URLElement()) | 
| 86     , m_scrollbar(other.scrollbar()) | 82     , m_scrollbar(other.scrollbar()) | 
| 87     , m_isOverWidget(other.isOverWidget()) | 83     , m_isOverWidget(other.isOverWidget()) | 
| 88     , m_isFirstLetter(other.m_isFirstLetter) |  | 
| 89 { | 84 { | 
| 90     // Only copy the NodeSet in case of rect hit test. | 85     // Only copy the NodeSet in case of rect hit test. | 
| 91     m_rectBasedTestResult = adoptPtrWillBeNoop(other.m_rectBasedTestResult ? new
      NodeSet(*other.m_rectBasedTestResult) : 0); | 86     m_rectBasedTestResult = adoptPtrWillBeNoop(other.m_rectBasedTestResult ? new
      NodeSet(*other.m_rectBasedTestResult) : 0); | 
| 92 } | 87 } | 
| 93 | 88 | 
| 94 HitTestResult::~HitTestResult() | 89 HitTestResult::~HitTestResult() | 
| 95 { | 90 { | 
| 96 } | 91 } | 
| 97 | 92 | 
| 98 HitTestResult& HitTestResult::operator=(const HitTestResult& other) | 93 HitTestResult& HitTestResult::operator=(const HitTestResult& other) | 
| 99 { | 94 { | 
| 100     m_hitTestLocation = other.m_hitTestLocation; | 95     m_hitTestLocation = other.m_hitTestLocation; | 
| 101     m_innerNode = other.innerNode(); | 96     m_innerNode = other.innerNode(); | 
| 102     m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); | 97     m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode(); | 
| 103     m_innerNonSharedNode = other.innerNonSharedNode(); | 98     m_innerNonSharedNode = other.innerNonSharedNode(); | 
| 104     m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; | 99     m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; | 
| 105     m_localPoint = other.localPoint(); | 100     m_localPoint = other.localPoint(); | 
| 106     m_innerURLElement = other.URLElement(); | 101     m_innerURLElement = other.URLElement(); | 
| 107     m_scrollbar = other.scrollbar(); | 102     m_scrollbar = other.scrollbar(); | 
| 108     m_isFirstLetter = other.m_isFirstLetter; |  | 
| 109     m_isOverWidget = other.isOverWidget(); | 103     m_isOverWidget = other.isOverWidget(); | 
| 110 | 104 | 
| 111     // Only copy the NodeSet in case of rect hit test. | 105     // Only copy the NodeSet in case of rect hit test. | 
| 112     m_rectBasedTestResult = adoptPtrWillBeNoop(other.m_rectBasedTestResult ? new
      NodeSet(*other.m_rectBasedTestResult) : 0); | 106     m_rectBasedTestResult = adoptPtrWillBeNoop(other.m_rectBasedTestResult ? new
      NodeSet(*other.m_rectBasedTestResult) : 0); | 
| 113 | 107 | 
| 114     return *this; | 108     return *this; | 
| 115 } | 109 } | 
| 116 | 110 | 
| 117 void HitTestResult::trace(Visitor* visitor) | 111 void HitTestResult::trace(Visitor* visitor) | 
| 118 { | 112 { | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 133     RenderObject* renderer = this->renderer(); | 127     RenderObject* renderer = this->renderer(); | 
| 134     if (!renderer) | 128     if (!renderer) | 
| 135         return PositionWithAffinity(); | 129         return PositionWithAffinity(); | 
| 136     if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNod
     e->pseudoId() == BEFORE) | 130     if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNod
     e->pseudoId() == BEFORE) | 
| 137         return Position(m_innerNode, Position::PositionIsBeforeChildren).downstr
     eam(); | 131         return Position(m_innerNode, Position::PositionIsBeforeChildren).downstr
     eam(); | 
| 138     return renderer->positionForPoint(localPoint()); | 132     return renderer->positionForPoint(localPoint()); | 
| 139 } | 133 } | 
| 140 | 134 | 
| 141 RenderObject* HitTestResult::renderer() const | 135 RenderObject* HitTestResult::renderer() const | 
| 142 { | 136 { | 
| 143     if (!m_innerNode) | 137     return m_innerNode ? m_innerNode->renderer() : 0; | 
| 144         return 0; |  | 
| 145     RenderObject* renderer = m_innerNode->renderer(); |  | 
| 146     if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(re
     nderer)->isTextFragment()) |  | 
| 147         return renderer; |  | 
| 148     return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter(); |  | 
| 149 } | 138 } | 
| 150 | 139 | 
| 151 void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() | 140 void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() | 
| 152 { | 141 { | 
| 153     if (Node* node = innerNode()) { | 142     if (Node* node = innerNode()) { | 
| 154         if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { | 143         if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { | 
| 155             if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) | 144             if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) | 
| 156                 setInnerNode(node->shadowHost()); | 145                 setInnerNode(node->shadowHost()); | 
| 157         } | 146         } | 
| 158     } | 147     } | 
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 477 { | 466 { | 
| 478     for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
     rent(node)) { | 467     for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
     rent(node)) { | 
| 479         if (node->isElementNode()) | 468         if (node->isElementNode()) | 
| 480             return toElement(node); | 469             return toElement(node); | 
| 481     } | 470     } | 
| 482 | 471 | 
| 483     return 0; | 472     return 0; | 
| 484 } | 473 } | 
| 485 | 474 | 
| 486 } // namespace blink | 475 } // namespace blink | 
| OLD | NEW | 
|---|