| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/html/HTMLMediaElement.h" | 36 #include "core/html/HTMLMediaElement.h" |
| 37 #include "core/html/HTMLTextAreaElement.h" | 37 #include "core/html/HTMLTextAreaElement.h" |
| 38 #include "core/html/HTMLVideoElement.h" | 38 #include "core/html/HTMLVideoElement.h" |
| 39 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
| 40 #include "core/loader/cache/CachedImage.h" | 40 #include "core/loader/cache/CachedImage.h" |
| 41 #include "core/page/Frame.h" | 41 #include "core/page/Frame.h" |
| 42 #include "core/page/FrameTree.h" | 42 #include "core/page/FrameTree.h" |
| 43 #include "core/platform/Scrollbar.h" | 43 #include "core/platform/Scrollbar.h" |
| 44 #include "core/rendering/HitTestLocation.h" | 44 #include "core/rendering/HitTestLocation.h" |
| 45 #include "core/rendering/RenderImage.h" | 45 #include "core/rendering/RenderImage.h" |
| 46 #include "core/rendering/RenderTextFragment.h" |
| 46 | 47 |
| 47 namespace WebCore { | 48 namespace WebCore { |
| 48 | 49 |
| 49 using namespace HTMLNames; | 50 using namespace HTMLNames; |
| 50 | 51 |
| 51 HitTestResult::HitTestResult() | 52 HitTestResult::HitTestResult() |
| 52 : m_isOverWidget(false) | 53 : m_isFirstLetter(false) |
| 54 , m_isOverWidget(false) |
| 53 { | 55 { |
| 54 } | 56 } |
| 55 | 57 |
| 56 HitTestResult::HitTestResult(const LayoutPoint& point) | 58 HitTestResult::HitTestResult(const LayoutPoint& point) |
| 57 : m_hitTestLocation(point) | 59 : m_hitTestLocation(point) |
| 58 , m_pointInInnerNodeFrame(point) | 60 , m_pointInInnerNodeFrame(point) |
| 61 , m_isFirstLetter(false) |
| 59 , m_isOverWidget(false) | 62 , m_isOverWidget(false) |
| 60 { | 63 { |
| 61 } | 64 } |
| 62 | 65 |
| 63 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding
, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) | 66 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding
, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) |
| 64 : m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, le
ftPadding) | 67 : m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, le
ftPadding) |
| 65 , m_pointInInnerNodeFrame(centerPoint) | 68 , m_pointInInnerNodeFrame(centerPoint) |
| 69 , m_isFirstLetter(false) |
| 66 , m_isOverWidget(false) | 70 , m_isOverWidget(false) |
| 67 { | 71 { |
| 68 } | 72 } |
| 69 | 73 |
| 70 HitTestResult::HitTestResult(const HitTestLocation& other) | 74 HitTestResult::HitTestResult(const HitTestLocation& other) |
| 71 : m_hitTestLocation(other) | 75 : m_hitTestLocation(other) |
| 72 , m_pointInInnerNodeFrame(m_hitTestLocation.point()) | 76 , m_pointInInnerNodeFrame(m_hitTestLocation.point()) |
| 77 , m_isFirstLetter(false) |
| 73 , m_isOverWidget(false) | 78 , m_isOverWidget(false) |
| 74 { | 79 { |
| 75 } | 80 } |
| 76 | 81 |
| 77 HitTestResult::HitTestResult(const HitTestResult& other) | 82 HitTestResult::HitTestResult(const HitTestResult& other) |
| 78 : m_hitTestLocation(other.m_hitTestLocation) | 83 : m_hitTestLocation(other.m_hitTestLocation) |
| 79 , m_innerNode(other.innerNode()) | 84 , m_innerNode(other.innerNode()) |
| 80 , m_innerNonSharedNode(other.innerNonSharedNode()) | 85 , m_innerNonSharedNode(other.innerNonSharedNode()) |
| 81 , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame) | 86 , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame) |
| 82 , m_localPoint(other.localPoint()) | 87 , m_localPoint(other.localPoint()) |
| 83 , m_innerURLElement(other.URLElement()) | 88 , m_innerURLElement(other.URLElement()) |
| 84 , m_scrollbar(other.scrollbar()) | 89 , m_scrollbar(other.scrollbar()) |
| 90 , m_isFirstLetter(other.m_isFirstLetter) |
| 85 , m_isOverWidget(other.isOverWidget()) | 91 , m_isOverWidget(other.isOverWidget()) |
| 86 { | 92 { |
| 87 // Only copy the NodeSet in case of rect hit test. | 93 // Only copy the NodeSet in case of rect hit test. |
| 88 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*
other.m_rectBasedTestResult) : 0); | 94 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*
other.m_rectBasedTestResult) : 0); |
| 89 } | 95 } |
| 90 | 96 |
| 91 HitTestResult::~HitTestResult() | 97 HitTestResult::~HitTestResult() |
| 92 { | 98 { |
| 93 } | 99 } |
| 94 | 100 |
| 95 HitTestResult& HitTestResult::operator=(const HitTestResult& other) | 101 HitTestResult& HitTestResult::operator=(const HitTestResult& other) |
| 96 { | 102 { |
| 97 m_hitTestLocation = other.m_hitTestLocation; | 103 m_hitTestLocation = other.m_hitTestLocation; |
| 98 m_innerNode = other.innerNode(); | 104 m_innerNode = other.innerNode(); |
| 99 m_innerNonSharedNode = other.innerNonSharedNode(); | 105 m_innerNonSharedNode = other.innerNonSharedNode(); |
| 100 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; | 106 m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame; |
| 101 m_localPoint = other.localPoint(); | 107 m_localPoint = other.localPoint(); |
| 102 m_innerURLElement = other.URLElement(); | 108 m_innerURLElement = other.URLElement(); |
| 103 m_scrollbar = other.scrollbar(); | 109 m_scrollbar = other.scrollbar(); |
| 110 m_isFirstLetter = other.m_isFirstLetter; |
| 104 m_isOverWidget = other.isOverWidget(); | 111 m_isOverWidget = other.isOverWidget(); |
| 105 | 112 |
| 106 // Only copy the NodeSet in case of rect hit test. | 113 // Only copy the NodeSet in case of rect hit test. |
| 107 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*
other.m_rectBasedTestResult) : 0); | 114 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*
other.m_rectBasedTestResult) : 0); |
| 108 | 115 |
| 109 return *this; | 116 return *this; |
| 110 } | 117 } |
| 111 | 118 |
| 119 RenderObject* HitTestResult::renderer() const |
| 120 { |
| 121 if (!m_innerNode) |
| 122 return 0; |
| 123 RenderObject* renderer = m_innerNode->renderer(); |
| 124 if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(re
nderer)->isTextFragment()) |
| 125 return renderer; |
| 126 return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter(); |
| 127 } |
| 128 |
| 112 void HitTestResult::setToNodesInDocumentTreeScope() | 129 void HitTestResult::setToNodesInDocumentTreeScope() |
| 113 { | 130 { |
| 114 if (Node* node = innerNode()) { | 131 if (Node* node = innerNode()) { |
| 115 node = node->document()->ancestorInThisScope(node); | 132 node = node->document()->ancestorInThisScope(node); |
| 116 setInnerNode(node); | 133 setInnerNode(node); |
| 117 } | 134 } |
| 118 | 135 |
| 119 if (Node* node = innerNonSharedNode()) { | 136 if (Node* node = innerNonSharedNode()) { |
| 120 node = node->document()->ancestorInThisScope(node); | 137 node = node->document()->ancestorInThisScope(node); |
| 121 setInnerNonSharedNode(node); | 138 setInnerNonSharedNode(node); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 Element* HitTestResult::innerElement() const | 505 Element* HitTestResult::innerElement() const |
| 489 { | 506 { |
| 490 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) | 507 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) |
| 491 if (node->isElementNode()) | 508 if (node->isElementNode()) |
| 492 return toElement(node); | 509 return toElement(node); |
| 493 | 510 |
| 494 return 0; | 511 return 0; |
| 495 } | 512 } |
| 496 | 513 |
| 497 } // namespace WebCore | 514 } // namespace WebCore |
| OLD | NEW |