OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 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 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 // Send a compositionupdate event when this function updates the exis
ting composition | 1240 // Send a compositionupdate event when this function updates the exis
ting composition |
1241 // node, i.e. m_compositionNode != 0 && !text.isEmpty(). | 1241 // node, i.e. m_compositionNode != 0 && !text.isEmpty(). |
1242 // 3. Canceling the ongoing composition. | 1242 // 3. Canceling the ongoing composition. |
1243 // Send a compositionend event when function deletes the existing com
position node, i.e. | 1243 // Send a compositionend event when function deletes the existing com
position node, i.e. |
1244 // m_compositionNode != 0 && test.isEmpty(). | 1244 // m_compositionNode != 0 && test.isEmpty(). |
1245 RefPtr<CompositionEvent> event; | 1245 RefPtr<CompositionEvent> event; |
1246 if (!m_compositionNode) { | 1246 if (!m_compositionNode) { |
1247 // We should send a compositionstart event only when the given text
is not empty because this | 1247 // We should send a compositionstart event only when the given text
is not empty because this |
1248 // function doesn't create a composition node when the text is empty
. | 1248 // function doesn't create a composition node when the text is empty
. |
1249 if (!text.isEmpty()) { | 1249 if (!text.isEmpty()) { |
1250 FrameSelection* selection = m_frame->selection(); | 1250 target->dispatchEvent(CompositionEvent::create(eventNames().comp
ositionstartEvent, m_frame->document()->domWindow(), selectedText())); |
1251 String selectionText; | |
1252 if (selection->isRange()) { | |
1253 RefPtr<Range> range = selection->toNormalizedRange(); | |
1254 selectionText = plainText(range.get()); | |
1255 } | |
1256 target->dispatchEvent(CompositionEvent::create(eventNames().comp
ositionstartEvent, m_frame->document()->domWindow(), selectionText)); | |
1257 event = CompositionEvent::create(eventNames().compositionupdateE
vent, m_frame->document()->domWindow(), text); | 1251 event = CompositionEvent::create(eventNames().compositionupdateE
vent, m_frame->document()->domWindow(), text); |
1258 } | 1252 } |
1259 } else { | 1253 } else { |
1260 if (!text.isEmpty()) | 1254 if (!text.isEmpty()) |
1261 event = CompositionEvent::create(eventNames().compositionupdateE
vent, m_frame->document()->domWindow(), text); | 1255 event = CompositionEvent::create(eventNames().compositionupdateE
vent, m_frame->document()->domWindow(), text); |
1262 else | 1256 else |
1263 event = CompositionEvent::create(eventNames().compositionendEvent,
m_frame->document()->domWindow(), text); | 1257 event = CompositionEvent::create(eventNames().compositionendEvent,
m_frame->document()->domWindow(), text); |
1264 } | 1258 } |
1265 if (event.get()) | 1259 if (event.get()) |
1266 target->dispatchEvent(event, IGNORE_EXCEPTION); | 1260 target->dispatchEvent(event, IGNORE_EXCEPTION); |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 return WebCore::unifiedTextCheckerEnabled(m_frame); | 2342 return WebCore::unifiedTextCheckerEnabled(m_frame); |
2349 } | 2343 } |
2350 | 2344 |
2351 void Editor::toggleOverwriteModeEnabled() | 2345 void Editor::toggleOverwriteModeEnabled() |
2352 { | 2346 { |
2353 m_overwriteModeEnabled = !m_overwriteModeEnabled; | 2347 m_overwriteModeEnabled = !m_overwriteModeEnabled; |
2354 frame()->selection()->setShouldShowBlockCursor(m_overwriteModeEnabled); | 2348 frame()->selection()->setShouldShowBlockCursor(m_overwriteModeEnabled); |
2355 }; | 2349 }; |
2356 | 2350 |
2357 } // namespace WebCore | 2351 } // namespace WebCore |
OLD | NEW |