Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: third_party/WebKit/Source/core/layout/HitTestResult.cpp

Issue 2229743003: add HitTestCanvasResult Class instend of std::pair<Element*, String> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 , m_hitTestRequest(otherRequest) 76 , m_hitTestRequest(otherRequest)
77 , m_cacheable(true) 77 , m_cacheable(true)
78 , m_pointInInnerNodeFrame(m_hitTestLocation.point()) 78 , m_pointInInnerNodeFrame(m_hitTestLocation.point())
79 , m_isOverWidget(false) 79 , m_isOverWidget(false)
80 { 80 {
81 } 81 }
82 82
83 HitTestResult::HitTestResult(const HitTestResult& other) 83 HitTestResult::HitTestResult(const HitTestResult& other)
84 : m_hitTestLocation(other.m_hitTestLocation) 84 : m_hitTestLocation(other.m_hitTestLocation)
85 , m_hitTestRequest(other.m_hitTestRequest) 85 , m_hitTestRequest(other.m_hitTestRequest)
86 , m_hitTestCanvasResult(other.m_hitTestCanvasResult)
86 , m_cacheable(other.m_cacheable) 87 , m_cacheable(other.m_cacheable)
87 , m_innerNode(other.innerNode()) 88 , m_innerNode(other.innerNode())
88 , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode) 89 , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode)
89 , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame) 90 , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame)
90 , m_localPoint(other.localPoint()) 91 , m_localPoint(other.localPoint())
91 , m_innerURLElement(other.URLElement()) 92 , m_innerURLElement(other.URLElement())
92 , m_scrollbar(other.scrollbar()) 93 , m_scrollbar(other.scrollbar())
93 , m_isOverWidget(other.isOverWidget()) 94 , m_isOverWidget(other.isOverWidget())
94 { 95 {
95 // Only copy the NodeSet in case of list hit test. 96 // Only copy the NodeSet in case of list hit test.
96 m_listBasedTestResult = other.m_listBasedTestResult ? new NodeSet(*other.m_l istBasedTestResult) : nullptr; 97 m_listBasedTestResult = other.m_listBasedTestResult ? new NodeSet(*other.m_l istBasedTestResult) : nullptr;
97 } 98 }
98 99
99 HitTestResult::~HitTestResult() 100 HitTestResult::~HitTestResult()
100 { 101 {
101 } 102 }
102 103
103 HitTestResult& HitTestResult::operator=(const HitTestResult& other) 104 HitTestResult& HitTestResult::operator=(const HitTestResult& other)
104 { 105 {
105 m_hitTestLocation = other.m_hitTestLocation; 106 m_hitTestLocation = other.m_hitTestLocation;
106 m_hitTestRequest = other.m_hitTestRequest; 107 m_hitTestRequest = other.m_hitTestRequest;
108 m_hitTestCanvasResult = other.m_hitTestCanvasResult;
107 populateFromCachedResult(other); 109 populateFromCachedResult(other);
108 110
109 return *this; 111 return *this;
110 } 112 }
111 113
112 bool HitTestResult::equalForCacheability(const HitTestResult& other) const 114 bool HitTestResult::equalForCacheability(const HitTestResult& other) const
113 { 115 {
114 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest) 116 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest)
115 && m_innerNode == other.innerNode() 117 && m_innerNode == other.innerNode()
116 && m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode() 118 && m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode()
(...skipping 25 matching lines...) Expand all
142 m_listBasedTestResult = other.m_listBasedTestResult ? new NodeSet(*other.m_l istBasedTestResult) : nullptr; 144 m_listBasedTestResult = other.m_listBasedTestResult ? new NodeSet(*other.m_l istBasedTestResult) : nullptr;
143 } 145 }
144 146
145 DEFINE_TRACE(HitTestResult) 147 DEFINE_TRACE(HitTestResult)
146 { 148 {
147 visitor->trace(m_innerNode); 149 visitor->trace(m_innerNode);
148 visitor->trace(m_innerPossiblyPseudoNode); 150 visitor->trace(m_innerPossiblyPseudoNode);
149 visitor->trace(m_innerURLElement); 151 visitor->trace(m_innerURLElement);
150 visitor->trace(m_scrollbar); 152 visitor->trace(m_scrollbar);
151 visitor->trace(m_listBasedTestResult); 153 visitor->trace(m_listBasedTestResult);
154 visitor->trace(m_hitTestCanvasResult);
152 } 155 }
153 156
154 PositionWithAffinity HitTestResult::position() const 157 PositionWithAffinity HitTestResult::position() const
155 { 158 {
156 if (!m_innerPossiblyPseudoNode) 159 if (!m_innerPossiblyPseudoNode)
157 return PositionWithAffinity(); 160 return PositionWithAffinity();
158 LayoutObject* layoutObject = this->layoutObject(); 161 LayoutObject* layoutObject = this->layoutObject();
159 if (!layoutObject) 162 if (!layoutObject)
160 return PositionWithAffinity(); 163 return PositionWithAffinity();
161 if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNod e->getPseudoId() == PseudoIdBefore) 164 if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNod e->getPseudoId() == PseudoIdBefore)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void HitTestResult::setURLElement(Element* n) 219 void HitTestResult::setURLElement(Element* n)
217 { 220 {
218 m_innerURLElement = n; 221 m_innerURLElement = n;
219 } 222 }
220 223
221 void HitTestResult::setScrollbar(Scrollbar* s) 224 void HitTestResult::setScrollbar(Scrollbar* s)
222 { 225 {
223 m_scrollbar = s; 226 m_scrollbar = s;
224 } 227 }
225 228
229 void HitTestResult::setHitCanvasRegion(HitTestCanvasResult* n)
zino 2016/08/19 18:00:07 You are saving HitTestCanvasResult to HitTestResul
Hwanseung Lee 2016/08/20 06:03:54 Done.
230 {
231 m_hitTestCanvasResult = n;
232 }
233
226 LocalFrame* HitTestResult::innerNodeFrame() const 234 LocalFrame* HitTestResult::innerNodeFrame() const
227 { 235 {
228 if (m_innerNode) 236 if (m_innerNode)
229 return m_innerNode->document().frame(); 237 return m_innerNode->document().frame();
230 return nullptr; 238 return nullptr;
231 } 239 }
232 240
233 bool HitTestResult::isSelected() const 241 bool HitTestResult::isSelected() const
234 { 242 {
235 if (!m_innerNode) 243 if (!m_innerNode)
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 else if (isHTMLMapElement(m_innerNode)) 521 else if (isHTMLMapElement(m_innerNode))
514 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); 522 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement();
515 523
516 if (!imageMapImageElement) 524 if (!imageMapImageElement)
517 return m_innerNode.get(); 525 return m_innerNode.get();
518 526
519 return imageMapImageElement; 527 return imageMapImageElement;
520 } 528 }
521 529
522 } // namespace blink 530 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698