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

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

Issue 2374183004: Make non-null VisibleSelections creatable only by createVisibleSelection[Deprecated] (Closed)
Patch Set: Fix mac compile error Created 4 years, 2 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, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 // Some of the above operations set an xPosForVerticalArrowNavigation. 581 // Some of the above operations set an xPosForVerticalArrowNavigation.
582 // Setting a selection will clear it, so save it to possibly restore later. 582 // Setting a selection will clear it, so save it to possibly restore later.
583 // Note: the START position type is arbitrary because it is unused, it would be 583 // Note: the START position type is arbitrary because it is unused, it would be
584 // the requested position type if there were no xPosForVerticalArrowNavigati on set. 584 // the requested position type if there were no xPosForVerticalArrowNavigati on set.
585 LayoutUnit x = lineDirectionPointForBlockDirectionNavigation(START); 585 LayoutUnit x = lineDirectionPointForBlockDirectionNavigation(START);
586 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) || alter == FrameSelection::AlterationExtend); 586 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) || alter == FrameSelection::AlterationExtend);
587 587
588 switch (alter) { 588 switch (alter) {
589 case FrameSelection::AlterationMove: 589 case FrameSelection::AlterationMove:
590 m_selection = VisibleSelection(position, m_selection.isDirectional()); 590 m_selection = createVisibleSelectionDeprecated(position, m_selection.isD irectional());
591 break; 591 break;
592 case FrameSelection::AlterationExtend: 592 case FrameSelection::AlterationExtend:
593 593
594 if (!m_selection.isCaret() 594 if (!m_selection.isCaret()
595 && (granularity == WordGranularity || granularity == ParagraphGranul arity || granularity == LineGranularity) 595 && (granularity == WordGranularity || granularity == ParagraphGranul arity || granularity == LineGranularity)
596 && frame() && !frame()->editor().behavior().shouldExtendSelectionByW ordOrLineAcrossCaret()) { 596 && frame() && !frame()->editor().behavior().shouldExtendSelectionByW ordOrLineAcrossCaret()) {
597 // Don't let the selection go across the base position directly. Nee ded to match mac 597 // Don't let the selection go across the base position directly. Nee ded to match mac
598 // behavior when, for instance, word-selecting backwards starting wi th the caret in 598 // behavior when, for instance, word-selecting backwards starting wi th the caret in
599 // the middle of a word and then word-selecting forward, leaving the caret in the 599 // the middle of a word and then word-selecting forward, leaving the caret in the
600 // same place where it was, instead of directly selecting to the end of the word. 600 // same place where it was, instead of directly selecting to the end of the word.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 lastY = nextY; 690 lastY = nextY;
691 result = next; 691 result = next;
692 } 692 }
693 } 693 }
694 694
695 if (result.isNull()) 695 if (result.isNull())
696 return false; 696 return false;
697 697
698 switch (alter) { 698 switch (alter) {
699 case FrameSelection::AlterationMove: 699 case FrameSelection::AlterationMove:
700 m_selection = VisibleSelection(result, m_selection.isDirectional()); 700 m_selection = createVisibleSelectionDeprecated(result, m_selection.isDir ectional());
701 break; 701 break;
702 case FrameSelection::AlterationExtend: 702 case FrameSelection::AlterationExtend:
703 m_selection.setExtent(result); 703 m_selection.setExtent(result);
704 break; 704 break;
705 } 705 }
706 706
707 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) || alter == FrameSelection::AlterationExtend); 707 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) || alter == FrameSelection::AlterationExtend);
708 708
709 return true; 709 return true;
710 } 710 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 return x; 771 return x;
772 } 772 }
773 773
774 DEFINE_TRACE(SelectionModifier) 774 DEFINE_TRACE(SelectionModifier)
775 { 775 {
776 visitor->trace(m_frame); 776 visitor->trace(m_frame);
777 visitor->trace(m_selection); 777 visitor->trace(m_selection);
778 } 778 }
779 779
780 } // namespace blink 780 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698