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

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 338543003: Gesture event hit test refactoring and reduction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix release build Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 return *m_rectBasedTestResult; 477 return *m_rectBasedTestResult;
478 } 478 }
479 479
480 HitTestResult::NodeSet& HitTestResult::mutableRectBasedTestResult() 480 HitTestResult::NodeSet& HitTestResult::mutableRectBasedTestResult()
481 { 481 {
482 if (!m_rectBasedTestResult) 482 if (!m_rectBasedTestResult)
483 m_rectBasedTestResult = adoptPtrWillBeNoop(new NodeSet); 483 m_rectBasedTestResult = adoptPtrWillBeNoop(new NodeSet);
484 return *m_rectBasedTestResult; 484 return *m_rectBasedTestResult;
485 } 485 }
486 486
487 void HitTestResult::resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPo int& resolvedPointInMainFrame)
488 {
489 ASSERT(isRectBasedTest());
490 ASSERT(m_hitTestLocation.containsPoint(resolvedPointInMainFrame));
491 m_innerNode = resolvedInnerNode;
492 m_hitTestLocation = HitTestLocation(resolvedPointInMainFrame);
493 m_pointInInnerNodeFrame = resolvedPointInMainFrame;
494 m_rectBasedTestResult = nullptr;
495 ASSERT(!isRectBasedTest());
496 }
497
487 Node* HitTestResult::targetNode() const 498 Node* HitTestResult::targetNode() const
488 { 499 {
489 Node* node = innerNode(); 500 Node* node = innerNode();
490 if (!node) 501 if (!node)
491 return 0; 502 return 0;
492 if (node->inDocument()) 503 if (node->inDocument())
493 return node; 504 return node;
494 505
495 Element* element = node->parentElement(); 506 Element* element = node->parentElement();
496 if (element && element->inDocument()) 507 if (element && element->inDocument())
497 return element; 508 return element;
498 509
499 return node; 510 return node;
500 } 511 }
501 512
502 Element* HitTestResult::innerElement() const 513 Element* HitTestResult::innerElement() const
503 { 514 {
504 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { 515 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) {
505 if (node->isElementNode()) 516 if (node->isElementNode())
506 return toElement(node); 517 return toElement(node);
507 } 518 }
508 519
509 return 0; 520 return 0;
510 } 521 }
511 522
512 } // namespace WebCore 523 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698