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

Side by Side Diff: Source/core/editing/FrameSelection.cpp

Issue 1123563003: Improving direction-based selection strategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing remaining review feedback. Created 5 years, 6 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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 if (m_granularityStrategy && m_granularityStrategy->GetType() == strategyTyp e) 1931 if (m_granularityStrategy && m_granularityStrategy->GetType() == strategyTyp e)
1932 return m_granularityStrategy.get(); 1932 return m_granularityStrategy.get();
1933 1933
1934 if (strategyType == SelectionStrategy::Direction) 1934 if (strategyType == SelectionStrategy::Direction)
1935 m_granularityStrategy = adoptPtr(new DirectionGranularityStrategy()); 1935 m_granularityStrategy = adoptPtr(new DirectionGranularityStrategy());
1936 else 1936 else
1937 m_granularityStrategy = adoptPtr(new CharacterGranularityStrategy()); 1937 m_granularityStrategy = adoptPtr(new CharacterGranularityStrategy());
1938 return m_granularityStrategy.get(); 1938 return m_granularityStrategy.get();
1939 } 1939 }
1940 1940
1941 void FrameSelection::moveRangeSelectionExtent(const VisiblePosition& extentPosit ion) 1941 void FrameSelection::moveRangeSelectionExtent(const IntPoint& contentsPoint)
1942 { 1942 {
1943 if (isNone() || m_selection.visibleBase() == extentPosition) 1943 if (isNone())
1944 return; 1944 return;
1945 1945
1946 VisibleSelection newSelection = granularityStrategy()->updateExtent(extentPo sition, selection()); 1946 VisibleSelection newSelection = granularityStrategy()->updateExtent(contents Point, m_frame);
1947 setSelection( 1947 setSelection(
1948 newSelection, 1948 newSelection,
1949 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | FrameSe lection::DoNotClearStrategy | UserTriggered, 1949 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | FrameSe lection::DoNotClearStrategy | UserTriggered,
1950 FrameSelection::AlignCursorOnScrollIfNeeded, 1950 FrameSelection::AlignCursorOnScrollIfNeeded,
1951 CharacterGranularity); 1951 CharacterGranularity);
1952 } 1952 }
1953 1953
1954 void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition, con st VisiblePosition& extentPosition, TextGranularity granularity) 1954 void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition, con st VisiblePosition& extentPosition, TextGranularity granularity)
1955 { 1955 {
1956 VisibleSelection newSelection(basePosition, extentPosition); 1956 VisibleSelection newSelection(basePosition, extentPosition);
(...skipping 16 matching lines...) Expand all
1973 1973
1974 void showTree(const blink::FrameSelection* sel) 1974 void showTree(const blink::FrameSelection* sel)
1975 { 1975 {
1976 if (sel) 1976 if (sel)
1977 sel->showTreeForThis(); 1977 sel->showTreeForThis();
1978 else 1978 else
1979 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); 1979 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n");
1980 } 1980 }
1981 1981
1982 #endif 1982 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698