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

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

Issue 1675163002: Rename ComposedTree to FlatTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 10 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "core/layout/HitTestResult.h" 22 #include "core/layout/HitTestResult.h"
23 23
24 #include "core/HTMLNames.h" 24 #include "core/HTMLNames.h"
25 #include "core/dom/PseudoElement.h" 25 #include "core/dom/PseudoElement.h"
26 #include "core/dom/shadow/ComposedTreeTraversal.h" 26 #include "core/dom/shadow/FlatTreeTraversal.h"
27 #include "core/dom/shadow/ShadowRoot.h" 27 #include "core/dom/shadow/ShadowRoot.h"
28 #include "core/editing/FrameSelection.h" 28 #include "core/editing/FrameSelection.h"
29 #include "core/editing/VisibleUnits.h" 29 #include "core/editing/VisibleUnits.h"
30 #include "core/editing/markers/DocumentMarkerController.h" 30 #include "core/editing/markers/DocumentMarkerController.h"
31 #include "core/fetch/ImageResource.h" 31 #include "core/fetch/ImageResource.h"
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/html/HTMLAnchorElement.h" 33 #include "core/html/HTMLAnchorElement.h"
34 #include "core/html/HTMLAreaElement.h" 34 #include "core/html/HTMLAreaElement.h"
35 #include "core/html/HTMLImageElement.h" 35 #include "core/html/HTMLImageElement.h"
36 #include "core/html/HTMLInputElement.h" 36 #include "core/html/HTMLInputElement.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return marker->description(); 268 return marker->description();
269 } 269 }
270 270
271 String HitTestResult::title(TextDirection& dir) const 271 String HitTestResult::title(TextDirection& dir) const
272 { 272 {
273 dir = LTR; 273 dir = LTR;
274 // Find the title in the nearest enclosing DOM node. 274 // Find the title in the nearest enclosing DOM node.
275 // For <area> tags in image maps, walk the tree for the <area>, not the <img > using it. 275 // For <area> tags in image maps, walk the tree for the <area>, not the <img > using it.
276 if (m_innerNode.get()) 276 if (m_innerNode.get())
277 m_innerNode->updateDistribution(); 277 m_innerNode->updateDistribution();
278 for (Node* titleNode = m_innerNode.get(); titleNode; titleNode = ComposedTre eTraversal::parent(*titleNode)) { 278 for (Node* titleNode = m_innerNode.get(); titleNode; titleNode = FlatTreeTra versal::parent(*titleNode)) {
279 if (titleNode->isElementNode()) { 279 if (titleNode->isElementNode()) {
280 String title = toElement(titleNode)->title(); 280 String title = toElement(titleNode)->title();
281 if (!title.isNull()) { 281 if (!title.isNull()) {
282 if (LayoutObject* layoutObject = titleNode->layoutObject()) 282 if (LayoutObject* layoutObject = titleNode->layoutObject())
283 dir = layoutObject->style()->direction(); 283 dir = layoutObject->style()->direction();
284 return title; 284 return title;
285 } 285 }
286 } 286 }
287 } 287 }
288 return String(); 288 return String();
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 515
516 // Update the HitTestResult as if the supplied node had been hit in normal p oint-based hit-test. 516 // Update the HitTestResult as if the supplied node had been hit in normal p oint-based hit-test.
517 // Note that we don't know the local point after a rect-based hit-test, but we never use 517 // Note that we don't know the local point after a rect-based hit-test, but we never use
518 // it so shouldn't bother with the cost of computing it. 518 // it so shouldn't bother with the cost of computing it.
519 resolvedInnerNode->layoutObject()->updateHitTestResult(*this, LayoutPoint()) ; 519 resolvedInnerNode->layoutObject()->updateHitTestResult(*this, LayoutPoint()) ;
520 ASSERT(!isRectBasedTest()); 520 ASSERT(!isRectBasedTest());
521 } 521 }
522 522
523 Element* HitTestResult::innerElement() const 523 Element* HitTestResult::innerElement() const
524 { 524 {
525 for (Node* node = m_innerNode.get(); node; node = ComposedTreeTraversal::par ent(*node)) { 525 for (Node* node = m_innerNode.get(); node; node = FlatTreeTraversal::parent( *node)) {
526 if (node->isElementNode()) 526 if (node->isElementNode())
527 return toElement(node); 527 return toElement(node);
528 } 528 }
529 529
530 return nullptr; 530 return nullptr;
531 } 531 }
532 532
533 Node* HitTestResult::innerNodeOrImageMapImage() const 533 Node* HitTestResult::innerNodeOrImageMapImage() const
534 { 534 {
535 if (!m_innerNode) 535 if (!m_innerNode)
536 return nullptr; 536 return nullptr;
537 537
538 HTMLImageElement* imageMapImageElement = nullptr; 538 HTMLImageElement* imageMapImageElement = nullptr;
539 if (isHTMLAreaElement(m_innerNode)) 539 if (isHTMLAreaElement(m_innerNode))
540 imageMapImageElement = toHTMLAreaElement(m_innerNode)->imageElement(); 540 imageMapImageElement = toHTMLAreaElement(m_innerNode)->imageElement();
541 else if (isHTMLMapElement(m_innerNode)) 541 else if (isHTMLMapElement(m_innerNode))
542 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); 542 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement();
543 543
544 if (!imageMapImageElement) 544 if (!imageMapImageElement)
545 return m_innerNode.get(); 545 return m_innerNode.get();
546 546
547 return imageMapImageElement; 547 return imageMapImageElement;
548 } 548 }
549 549
550 } // namespace blink 550 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698