| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 { | 193 { |
| 194 ASSERT(frame.document()); | 194 ASSERT(frame.document()); |
| 195 ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectio
nCommand::PreventNesting, EditActionUnspecified)->apply(); | 195 ReplaceSelectionCommand::create(*frame.document(), fragment, ReplaceSelectio
nCommand::PreventNesting, EditActionUnspecified)->apply(); |
| 196 return true; | 196 return true; |
| 197 } | 197 } |
| 198 | 198 |
| 199 static bool executeInsertNode(Frame& frame, PassRefPtr<Node> content) | 199 static bool executeInsertNode(Frame& frame, PassRefPtr<Node> content) |
| 200 { | 200 { |
| 201 ASSERT(frame.document()); | 201 ASSERT(frame.document()); |
| 202 RefPtr<DocumentFragment> fragment = DocumentFragment::create(*frame.document
()); | 202 RefPtr<DocumentFragment> fragment = DocumentFragment::create(*frame.document
()); |
| 203 TrackExceptionState es; | 203 TrackExceptionState exceptionState; |
| 204 fragment->appendChild(content, es); | 204 fragment->appendChild(content, exceptionState); |
| 205 if (es.hadException()) | 205 if (exceptionState.hadException()) |
| 206 return false; | 206 return false; |
| 207 return executeInsertFragment(frame, fragment.release()); | 207 return executeInsertFragment(frame, fragment.release()); |
| 208 } | 208 } |
| 209 | 209 |
| 210 static bool expandSelectionToGranularity(Frame& frame, TextGranularity granulari
ty) | 210 static bool expandSelectionToGranularity(Frame& frame, TextGranularity granulari
ty) |
| 211 { | 211 { |
| 212 VisibleSelection selection = frame.selection().selection(); | 212 VisibleSelection selection = frame.selection().selection(); |
| 213 selection.expandUsingGranularity(granularity); | 213 selection.expandUsingGranularity(granularity); |
| 214 RefPtr<Range> newRange = selection.toNormalizedRange(); | 214 RefPtr<Range> newRange = selection.toNormalizedRange(); |
| 215 if (!newRange) | 215 if (!newRange) |
| (...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? "tr
ue" : "false"; | 1723 return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? "tr
ue" : "false"; |
| 1724 return m_command->value(*m_frame, triggeringEvent); | 1724 return m_command->value(*m_frame, triggeringEvent); |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 bool Editor::Command::isTextInsertion() const | 1727 bool Editor::Command::isTextInsertion() const |
| 1728 { | 1728 { |
| 1729 return m_command && m_command->isTextInsertion; | 1729 return m_command && m_command->isTextInsertion; |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 } // namespace WebCore | 1732 } // namespace WebCore |
| OLD | NEW |