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

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

Issue 2829553002: Remove the dup function (Closed)
Patch Set: Created 3 years, 8 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // Update the HitTestResult as if the supplied node had been hit in normal 501 // Update the HitTestResult as if the supplied node had been hit in normal
502 // point-based hit-test. 502 // point-based hit-test.
503 // Note that we don't know the local point after a rect-based hit-test, but we 503 // Note that we don't know the local point after a rect-based hit-test, but we
504 // never use it so shouldn't bother with the cost of computing it. 504 // never use it so shouldn't bother with the cost of computing it.
505 resolved_inner_node->GetLayoutObject()->UpdateHitTestResult(*this, 505 resolved_inner_node->GetLayoutObject()->UpdateHitTestResult(*this,
506 LayoutPoint()); 506 LayoutPoint());
507 DCHECK(!IsRectBasedTest()); 507 DCHECK(!IsRectBasedTest());
508 } 508 }
509 509
510 Element* HitTestResult::InnerElement() const { 510 Element* HitTestResult::InnerElement() const {
511 for (Node* node = inner_node_.Get(); node; 511 if (!inner_node_)
512 node = FlatTreeTraversal::Parent(*node)) { 512 return nullptr;
513 if (node->IsElementNode()) 513 if (inner_node_->IsElementNode())
514 return ToElement(node); 514 return ToElement(inner_node_);
515 } 515 return FlatTreeTraversal::ParentElement(*inner_node_);
516
517 return nullptr;
518 } 516 }
519 517
520 Node* HitTestResult::InnerNodeOrImageMapImage() const { 518 Node* HitTestResult::InnerNodeOrImageMapImage() const {
521 if (!inner_node_) 519 if (!inner_node_)
522 return nullptr; 520 return nullptr;
523 521
524 HTMLImageElement* image_map_image_element = nullptr; 522 HTMLImageElement* image_map_image_element = nullptr;
525 if (isHTMLAreaElement(inner_node_)) 523 if (isHTMLAreaElement(inner_node_))
526 image_map_image_element = toHTMLAreaElement(inner_node_)->ImageElement(); 524 image_map_image_element = toHTMLAreaElement(inner_node_)->ImageElement();
527 else if (isHTMLMapElement(inner_node_)) 525 else if (isHTMLMapElement(inner_node_))
528 image_map_image_element = toHTMLMapElement(inner_node_)->ImageElement(); 526 image_map_image_element = toHTMLMapElement(inner_node_)->ImageElement();
529 527
530 if (!image_map_image_element) 528 if (!image_map_image_element)
531 return inner_node_.Get(); 529 return inner_node_.Get();
532 530
533 return image_map_image_element; 531 return image_map_image_element;
534 } 532 }
535 533
536 } // namespace blink 534 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/GestureManager.cpp ('k') | third_party/WebKit/Source/core/page/EventWithHitTestResults.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698