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 24 matching lines...) Expand all Loading... | |
35 #include "core/html/HTMLImageElement.h" | 35 #include "core/html/HTMLImageElement.h" |
36 #include "core/html/HTMLInputElement.h" | 36 #include "core/html/HTMLInputElement.h" |
37 #include "core/html/HTMLMapElement.h" | 37 #include "core/html/HTMLMapElement.h" |
38 #include "core/html/HTMLMediaElement.h" | 38 #include "core/html/HTMLMediaElement.h" |
39 #include "core/html/HTMLTextAreaElement.h" | 39 #include "core/html/HTMLTextAreaElement.h" |
40 #include "core/html/parser/HTMLParserIdioms.h" | 40 #include "core/html/parser/HTMLParserIdioms.h" |
41 #include "core/layout/LayoutImage.h" | 41 #include "core/layout/LayoutImage.h" |
42 #include "core/layout/LayoutTextFragment.h" | 42 #include "core/layout/LayoutTextFragment.h" |
43 #include "core/page/FrameTree.h" | 43 #include "core/page/FrameTree.h" |
44 #include "core/svg/SVGElement.h" | 44 #include "core/svg/SVGElement.h" |
45 #include "platform/geometry/Region.h" | |
45 #include "platform/scroll/Scrollbar.h" | 46 #include "platform/scroll/Scrollbar.h" |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
49 using namespace HTMLNames; | 50 using namespace HTMLNames; |
50 | 51 |
51 HitTestResult::HitTestResult() | 52 HitTestResult::HitTestResult() |
52 : m_hitTestRequest(HitTestRequest::ReadOnly | HitTestRequest::Active) | 53 : m_hitTestRequest(HitTestRequest::ReadOnly | HitTestRequest::Active) |
53 , m_cacheable(true) | 54 , m_cacheable(true) |
54 , m_isOverWidget(false) | 55 , m_isOverWidget(false) |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 return !toHTMLTextAreaElement(*m_innerNode).isDisabledOrReadOnly(); | 424 return !toHTMLTextAreaElement(*m_innerNode).isDisabledOrReadOnly(); |
424 | 425 |
425 if (isHTMLInputElement(*m_innerNode)) { | 426 if (isHTMLInputElement(*m_innerNode)) { |
426 HTMLInputElement& inputElement = toHTMLInputElement(*m_innerNode); | 427 HTMLInputElement& inputElement = toHTMLInputElement(*m_innerNode); |
427 return !inputElement.isDisabledOrReadOnly() && inputElement.isTextField( ); | 428 return !inputElement.isDisabledOrReadOnly() && inputElement.isTextField( ); |
428 } | 429 } |
429 | 430 |
430 return m_innerNode->hasEditableStyle(); | 431 return m_innerNode->hasEditableStyle(); |
431 } | 432 } |
432 | 433 |
433 bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocati on& locationInContainer, const LayoutRect& rect) | 434 ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& location, const LayoutRect& rect) |
434 { | 435 { |
435 // If not a list-based test, this function should be a no-op. | 436 // If not a list-based test, stop testing because the hit has been found. |
436 if (!hitTestRequest().listBased()) | 437 if (!hitTestRequest().listBased()) |
437 return false; | 438 return StopHitTesting; |
438 | 439 |
439 // If node is null, return true so the hit test can continue. | 440 // If node is null, continue hit testing. |
440 if (!node) | 441 if (!node) |
441 return true; | 442 return ContinueHitTesting; |
442 | 443 |
443 mutableListBasedTestResult().add(node); | 444 mutableListBasedTestResult().add(node); |
444 | 445 |
445 if (hitTestRequest().penetratingList()) | 446 if (hitTestRequest().penetratingList()) |
446 return true; | 447 return ContinueHitTesting; |
447 | 448 |
448 bool regionFilled = rect.contains(LayoutRect(locationInContainer.boundingBox ())); | 449 bool regionFilled = rect.contains(LayoutRect(location.boundingBox())); |
449 return !regionFilled; | 450 return regionFilled ? StopHitTesting : ContinueHitTesting; |
451 } | |
452 | |
453 ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& location, const Region& region) | |
454 { | |
Rick Byers
2016/01/25 21:50:05
Seems a shame to copy/paste this entire function.
pdr.
2016/01/25 23:47:36
Good idea.
This isn't possible due to the default
| |
455 // If not a list-based test, stop testing because the hit has been found. | |
456 if (!hitTestRequest().listBased()) | |
457 return StopHitTesting; | |
458 | |
459 // If node is null, continue hit testing. | |
460 if (!node) | |
461 return ContinueHitTesting; | |
462 | |
463 mutableListBasedTestResult().add(node); | |
464 | |
465 if (hitTestRequest().penetratingList()) | |
466 return ContinueHitTesting; | |
467 | |
468 bool regionFilled = region.contains(location.boundingBox()); | |
469 return regionFilled ? StopHitTesting : ContinueHitTesting; | |
450 } | 470 } |
451 | 471 |
452 void HitTestResult::append(const HitTestResult& other) | 472 void HitTestResult::append(const HitTestResult& other) |
453 { | 473 { |
454 ASSERT(hitTestRequest().listBased()); | 474 ASSERT(hitTestRequest().listBased()); |
455 | 475 |
456 if (!m_scrollbar && other.scrollbar()) { | 476 if (!m_scrollbar && other.scrollbar()) { |
457 setScrollbar(other.scrollbar()); | 477 setScrollbar(other.scrollbar()); |
458 } | 478 } |
459 | 479 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 else if (isHTMLMapElement(m_innerNode)) | 545 else if (isHTMLMapElement(m_innerNode)) |
526 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); | 546 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); |
527 | 547 |
528 if (!imageMapImageElement) | 548 if (!imageMapImageElement) |
529 return m_innerNode.get(); | 549 return m_innerNode.get(); |
530 | 550 |
531 return imageMapImageElement; | 551 return imageMapImageElement; |
532 } | 552 } |
533 | 553 |
534 } // namespace blink | 554 } // namespace blink |
OLD | NEW |