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

Side by Side Diff: third_party/WebKit/Source/core/editing/SelectionEditor.cpp

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Fix typo Created 4 years, 9 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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 return granularity == LineBoundary || granularity == ParagraphBoundary || gr anularity == DocumentBoundary; 579 return granularity == LineBoundary || granularity == ParagraphBoundary || gr anularity == DocumentBoundary;
580 } 580 }
581 581
582 bool SelectionEditor::modify(EAlteration alter, SelectionDirection direction, Te xtGranularity granularity, EUserTriggered userTriggered) 582 bool SelectionEditor::modify(EAlteration alter, SelectionDirection direction, Te xtGranularity granularity, EUserTriggered userTriggered)
583 { 583 {
584 if (userTriggered == UserTriggered) { 584 if (userTriggered == UserTriggered) {
585 OwnPtrWillBeRawPtr<FrameSelection> trialFrameSelection = FrameSelection: :create(); 585 OwnPtrWillBeRawPtr<FrameSelection> trialFrameSelection = FrameSelection: :create();
586 trialFrameSelection->setSelection(m_selection); 586 trialFrameSelection->setSelection(m_selection);
587 trialFrameSelection->modify(alter, direction, granularity, NotUserTrigge red); 587 trialFrameSelection->modify(alter, direction, granularity, NotUserTrigge red);
588 588
589 if (trialFrameSelection->selection().isRange() && m_selection.isCaret() && !dispatchSelectStart()) 589 if (trialFrameSelection->selection().isRange() && m_selection.isCaret() && dispatchSelectStart() != DispatchEventResult::NotCanceled)
590 return false; 590 return false;
591 } 591 }
592 592
593 willBeModified(alter, direction); 593 willBeModified(alter, direction);
594 594
595 bool wasRange = m_selection.isRange(); 595 bool wasRange = m_selection.isRange();
596 VisiblePosition originalStartPosition = m_selection.visibleStart(); 596 VisiblePosition originalStartPosition = m_selection.visibleStart();
597 VisiblePosition position; 597 VisiblePosition position;
598 switch (direction) { 598 switch (direction) {
599 case DirectionRight: 599 case DirectionRight:
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 return true; 850 return true;
851 } 851 }
852 852
853 PassRefPtrWillBeRawPtr<Range> SelectionEditor::firstRange() const 853 PassRefPtrWillBeRawPtr<Range> SelectionEditor::firstRange() const
854 { 854 {
855 if (m_logicalRange) 855 if (m_logicalRange)
856 return m_logicalRange->cloneRange(); 856 return m_logicalRange->cloneRange();
857 return firstRangeOf(m_selection); 857 return firstRangeOf(m_selection);
858 } 858 }
859 859
860 bool SelectionEditor::dispatchSelectStart() 860 DispatchEventResult SelectionEditor::dispatchSelectStart()
861 { 861 {
862 Node* selectStartTarget = m_selection.extent().computeContainerNode(); 862 Node* selectStartTarget = m_selection.extent().computeContainerNode();
863 if (!selectStartTarget) 863 if (!selectStartTarget)
864 return true; 864 return DispatchEventResult::NotCanceled;
865 865
866 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart)); 866 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart));
867 } 867 }
868 868
869 void SelectionEditor::didChangeVisibleSelection() 869 void SelectionEditor::didChangeVisibleSelection()
870 { 870 {
871 ASSERT(m_observingVisibleSelection); 871 ASSERT(m_observingVisibleSelection);
872 // Invalidate the logical range when the underlying VisibleSelection has cha nged. 872 // Invalidate the logical range when the underlying VisibleSelection has cha nged.
873 if (m_logicalRange) { 873 if (m_logicalRange) {
874 m_logicalRange->dispose(); 874 m_logicalRange->dispose();
(...skipping 27 matching lines...) Expand all
902 DEFINE_TRACE(SelectionEditor) 902 DEFINE_TRACE(SelectionEditor)
903 { 903 {
904 visitor->trace(m_frameSelection); 904 visitor->trace(m_frameSelection);
905 visitor->trace(m_selection); 905 visitor->trace(m_selection);
906 visitor->trace(m_selectionInFlatTree); 906 visitor->trace(m_selectionInFlatTree);
907 visitor->trace(m_logicalRange); 907 visitor->trace(m_logicalRange);
908 VisibleSelectionChangeObserver::trace(visitor); 908 VisibleSelectionChangeObserver::trace(visitor);
909 } 909 }
910 910
911 } // namespace blink 911 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionEditor.h ('k') | third_party/WebKit/Source/core/events/DragEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698