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