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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 return executeInsertFragment(frame, fragment.release()); | 209 return executeInsertFragment(frame, fragment.release()); |
210 } | 210 } |
211 | 211 |
212 static bool expandSelectionToGranularity(LocalFrame& frame, TextGranularity gran
ularity) | 212 static bool expandSelectionToGranularity(LocalFrame& frame, TextGranularity gran
ularity) |
213 { | 213 { |
214 VisibleSelection selection = frame.selection().selection(); | 214 VisibleSelection selection = frame.selection().selection(); |
215 selection.expandUsingGranularity(granularity); | 215 selection.expandUsingGranularity(granularity); |
216 RefPtrWillBeRawPtr<Range> newRange = selection.toNormalizedRange(); | 216 RefPtrWillBeRawPtr<Range> newRange = selection.toNormalizedRange(); |
217 if (!newRange) | 217 if (!newRange) |
218 return false; | 218 return false; |
219 if (newRange->collapsed(IGNORE_EXCEPTION)) | 219 if (newRange->collapsed()) |
220 return false; | 220 return false; |
221 EAffinity affinity = frame.selection().affinity(); | 221 EAffinity affinity = frame.selection().affinity(); |
222 frame.selection().setSelectedRange(newRange.get(), affinity, FrameSelection:
:CloseTyping); | 222 frame.selection().setSelectedRange(newRange.get(), affinity, FrameSelection:
:CloseTyping); |
223 return true; | 223 return true; |
224 } | 224 } |
225 | 225 |
226 static TriState stateStyle(LocalFrame& frame, CSSPropertyID propertyID, const ch
ar* desiredValue) | 226 static TriState stateStyle(LocalFrame& frame, CSSPropertyID propertyID, const ch
ar* desiredValue) |
227 { | 227 { |
228 if (frame.editor().behavior().shouldToggleStyleBasedOnStartOfSelection()) | 228 if (frame.editor().behavior().shouldToggleStyleBasedOnStartOfSelection()) |
229 return frame.editor().selectionStartHasStyle(propertyID, desiredValue) ?
TrueTriState : FalseTriState; | 229 return frame.editor().selectionStartHasStyle(propertyID, desiredValue) ?
TrueTriState : FalseTriState; |
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 { | 1734 { |
1735 return m_command && m_command->isTextInsertion; | 1735 return m_command && m_command->isTextInsertion; |
1736 } | 1736 } |
1737 | 1737 |
1738 int Editor::Command::idForHistogram() const | 1738 int Editor::Command::idForHistogram() const |
1739 { | 1739 { |
1740 return isSupported() ? m_command->idForUserMetrics : 0; | 1740 return isSupported() ? m_command->idForUserMetrics : 0; |
1741 } | 1741 } |
1742 | 1742 |
1743 } // namespace WebCore | 1743 } // namespace WebCore |
OLD | NEW |