OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1155 { | 1155 { |
1156 moveRangeSelection(base, extent); | 1156 moveRangeSelection(base, extent); |
1157 } | 1157 } |
1158 | 1158 |
1159 void WebLocalFrameImpl::selectRange(const WebRange& webRange) | 1159 void WebLocalFrameImpl::selectRange(const WebRange& webRange) |
1160 { | 1160 { |
1161 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge> >(webRange)) | 1161 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge> >(webRange)) |
1162 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); | 1162 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); |
1163 } | 1163 } |
1164 | 1164 |
1165 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) | |
1166 { | |
1167 VisibleSelection currentSelection = frame()->selection().selection(); | |
1168 | |
1169 VisiblePosition basePosition = currentSelection.isBaseFirst() ? | |
1170 currentSelection.visibleStart() : currentSelection.visibleEnd(); | |
1171 VisiblePosition extentPosition = visiblePositionForWindowPoint(point); | |
1172 | |
1173 // Prevent the selection from collapsing. | |
mlamouri (slow - plz ping)
2014/10/18 08:43:52
nit: could that be expressed in the WebLocalFrame.
| |
1174 if (comparePositions(basePosition, extentPosition) == 0) | |
1175 return; | |
1176 | |
1177 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio n); | |
1178 frame()->selection().setSelection(newSelection, CharacterGranularity); | |
1179 } | |
1180 | |
1165 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint& extent) | 1181 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint& extent) |
1166 { | 1182 { |
1167 VisiblePosition basePosition = visiblePositionForWindowPoint(base); | 1183 VisiblePosition basePosition = visiblePositionForWindowPoint(base); |
1168 VisiblePosition extentPosition = visiblePositionForWindowPoint(extent); | 1184 VisiblePosition extentPosition = visiblePositionForWindowPoint(extent); |
1169 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio n); | 1185 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio n); |
1170 frame()->selection().setSelection(newSelection, CharacterGranularity); | 1186 frame()->selection().setSelection(newSelection, CharacterGranularity); |
1171 } | 1187 } |
1172 | 1188 |
1173 void WebLocalFrameImpl::moveCaretSelection(const WebPoint& point) | 1189 void WebLocalFrameImpl::moveCaretSelection(const WebPoint& point) |
1174 { | 1190 { |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1917 | 1933 |
1918 void WebLocalFrameImpl::invalidateAll() const | 1934 void WebLocalFrameImpl::invalidateAll() const |
1919 { | 1935 { |
1920 ASSERT(frame() && frame()->view()); | 1936 ASSERT(frame() && frame()->view()); |
1921 FrameView* view = frame()->view(); | 1937 FrameView* view = frame()->view(); |
1922 view->invalidateRect(view->frameRect()); | 1938 view->invalidateRect(view->frameRect()); |
1923 invalidateScrollbar(); | 1939 invalidateScrollbar(); |
1924 } | 1940 } |
1925 | 1941 |
1926 } // namespace blink | 1942 } // namespace blink |
OLD | NEW |