Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 | 468 |
| 469 return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSe lectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity); | 469 return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSe lectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity); |
| 470 } | 470 } |
| 471 | 471 |
| 472 static int textDistance(const Position& start, const Position& end) | 472 static int textDistance(const Position& start, const Position& end) |
| 473 { | 473 { |
| 474 RefPtrWillBeRawPtr<Range> range = Range::create(*start.document(), start, en d); | 474 RefPtrWillBeRawPtr<Range> range = Range::create(*start.document(), start, en d); |
| 475 return TextIterator::rangeLength(range.get(), true); | 475 return TextIterator::rangeLength(range.get(), true); |
| 476 } | 476 } |
| 477 | 477 |
| 478 static bool isInteractiveNode(Node* node) | |
| 479 { | |
| 480 if (!node) | |
| 481 return false; | |
| 482 // Editable nodes are always interactive. | |
| 483 if (node->rendererIsEditable()) | |
| 484 return true; | |
| 485 // TODO(donnd): check for other indications of interactivity, including cont rol elements and ARIA roles. | |
| 486 return false; | |
| 487 } | |
| 488 | |
| 478 bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR esults& event) | 489 bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR esults& event) |
| 479 { | 490 { |
| 480 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventSingleClick"); | 491 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventSingleClick"); |
| 481 | 492 |
| 482 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 493 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 483 Node* innerNode = event.targetNode(); | 494 Node* innerNode = event.targetNode(); |
| 484 if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect)) | 495 if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect)) |
| 485 return false; | 496 return false; |
| 486 | 497 |
| 487 // Extend the selection if the Shift key is down, unless the click is in a l ink. | 498 // Extend the selection if the Shift key is down, unless the click is in a l ink. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 newSelection.setExtent(pos); | 542 newSelection.setExtent(pos); |
| 532 | 543 |
| 533 if (m_frame->selection().granularity() != CharacterGranularity) { | 544 if (m_frame->selection().granularity() != CharacterGranularity) { |
| 534 granularity = m_frame->selection().granularity(); | 545 granularity = m_frame->selection().granularity(); |
| 535 newSelection.expandUsingGranularity(m_frame->selection().granularity ()); | 546 newSelection.expandUsingGranularity(m_frame->selection().granularity ()); |
| 536 } | 547 } |
| 537 } else { | 548 } else { |
| 538 newSelection = expandSelectionToRespectUserSelectAll(innerNode, VisibleS election(visiblePos)); | 549 newSelection = expandSelectionToRespectUserSelectAll(innerNode, VisibleS election(visiblePos)); |
| 539 } | 550 } |
| 540 | 551 |
| 541 bool handled = updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, granularity); | 552 updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, g ranularity); |
|
Rick Byers
2014/05/28 17:36:57
I think this is fine for addressing the original p
donnd
2014/05/31 03:22:55
Done.
| |
| 542 return handled; | 553 |
| 554 // If the target node is editable, then it handles the click, either directl y or through a handler. | |
|
Rick Byers
2014/05/28 17:36:57
Hmm, it seems wrong / error-prone to have this log
donnd
2014/05/31 03:22:55
For now, we just always return false. That should
| |
| 555 return isInteractiveNode(event.targetNode()); | |
| 543 } | 556 } |
| 544 | 557 |
| 545 static inline bool canMouseDownStartSelect(Node* node) | 558 static inline bool canMouseDownStartSelect(Node* node) |
| 546 { | 559 { |
| 547 if (!node || !node->renderer()) | 560 if (!node || !node->renderer()) |
| 548 return true; | 561 return true; |
| 549 | 562 |
| 550 if (!node->canStartSelection()) | 563 if (!node->canStartSelection()) |
| 551 return false; | 564 return false; |
| 552 | 565 |
| (...skipping 3176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3729 unsigned EventHandler::accessKeyModifiers() | 3742 unsigned EventHandler::accessKeyModifiers() |
| 3730 { | 3743 { |
| 3731 #if OS(MACOSX) | 3744 #if OS(MACOSX) |
| 3732 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3745 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3733 #else | 3746 #else |
| 3734 return PlatformEvent::AltKey; | 3747 return PlatformEvent::AltKey; |
| 3735 #endif | 3748 #endif |
| 3736 } | 3749 } |
| 3737 | 3750 |
| 3738 } // namespace WebCore | 3751 } // namespace WebCore |
| OLD | NEW |