OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2009 Igalia S.L. | 4 * Copyright (C) 2009 Igalia S.L. |
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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 | 1908 |
1909 static bool enabledInRichlyEditableText(LocalFrame& frame, | 1909 static bool enabledInRichlyEditableText(LocalFrame& frame, |
1910 Event*, | 1910 Event*, |
1911 EditorCommandSource) { | 1911 EditorCommandSource) { |
1912 frame.document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 1912 frame.document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
1913 | 1913 |
1914 // We should update selection to canonicalize with current layout and style, | 1914 // We should update selection to canonicalize with current layout and style, |
1915 // before accessing |FrameSelection::selection()|. | 1915 // before accessing |FrameSelection::selection()|. |
1916 frame.selection().updateIfNeeded(); | 1916 frame.selection().updateIfNeeded(); |
1917 return !frame.selection().isNone() && | 1917 return !frame.selection().isNone() && |
1918 frame.selection().isContentRichlyEditable() && | 1918 frame.selection() |
| 1919 .computeVisibleSelectionInDOMTreeDeprecated() |
| 1920 .isContentRichlyEditable() && |
1919 frame.selection().rootEditableElement(); | 1921 frame.selection().rootEditableElement(); |
1920 } | 1922 } |
1921 | 1923 |
1922 static bool enabledPaste(LocalFrame& frame, | 1924 static bool enabledPaste(LocalFrame& frame, |
1923 Event*, | 1925 Event*, |
1924 EditorCommandSource source) { | 1926 EditorCommandSource source) { |
1925 if (!canReadClipboard(frame, source)) | 1927 if (!canReadClipboard(frame, source)) |
1926 return false; | 1928 return false; |
1927 return frame.editor().canPaste(); | 1929 return frame.editor().canPaste(); |
1928 } | 1930 } |
(...skipping 11 matching lines...) Expand all Loading... |
1940 | 1942 |
1941 static bool enabledRangeInRichlyEditableText(LocalFrame& frame, | 1943 static bool enabledRangeInRichlyEditableText(LocalFrame& frame, |
1942 Event*, | 1944 Event*, |
1943 EditorCommandSource) { | 1945 EditorCommandSource) { |
1944 frame.document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 1946 frame.document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
1945 | 1947 |
1946 // We should update selection to canonicalize with current layout and style, | 1948 // We should update selection to canonicalize with current layout and style, |
1947 // before accessing |FrameSelection::selection()|. | 1949 // before accessing |FrameSelection::selection()|. |
1948 frame.selection().updateIfNeeded(); | 1950 frame.selection().updateIfNeeded(); |
1949 return frame.selection().isRange() && | 1951 return frame.selection().isRange() && |
1950 frame.selection().isContentRichlyEditable(); | 1952 frame.selection() |
| 1953 .computeVisibleSelectionInDOMTreeDeprecated() |
| 1954 .isContentRichlyEditable(); |
1951 } | 1955 } |
1952 | 1956 |
1953 static bool enabledRedo(LocalFrame& frame, Event*, EditorCommandSource) { | 1957 static bool enabledRedo(LocalFrame& frame, Event*, EditorCommandSource) { |
1954 return frame.editor().canRedo(); | 1958 return frame.editor().canRedo(); |
1955 } | 1959 } |
1956 | 1960 |
1957 static bool enabledUndo(LocalFrame& frame, Event*, EditorCommandSource) { | 1961 static bool enabledUndo(LocalFrame& frame, Event*, EditorCommandSource) { |
1958 return frame.editor().canUndo(); | 1962 return frame.editor().canUndo(); |
1959 } | 1963 } |
1960 | 1964 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 *m_frame, DirectionBackward, WordGranularity); | 2755 *m_frame, DirectionBackward, WordGranularity); |
2752 case WebEditingCommandType::DeleteWordForward: | 2756 case WebEditingCommandType::DeleteWordForward: |
2753 return RangesFromCurrentSelectionOrExtendCaret(*m_frame, DirectionForward, | 2757 return RangesFromCurrentSelectionOrExtendCaret(*m_frame, DirectionForward, |
2754 WordGranularity); | 2758 WordGranularity); |
2755 default: | 2759 default: |
2756 return targetRangesForInputEvent(*target); | 2760 return targetRangesForInputEvent(*target); |
2757 } | 2761 } |
2758 } | 2762 } |
2759 | 2763 |
2760 } // namespace blink | 2764 } // namespace blink |
OLD | NEW |