| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 return true; | 487 return true; |
| 488 } | 488 } |
| 489 | 489 |
| 490 static bool executeInsertBacktab(Frame& frame, Event* event, EditorCommandSource
, const String&) | 490 static bool executeInsertBacktab(Frame& frame, Event* event, EditorCommandSource
, const String&) |
| 491 { | 491 { |
| 492 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t",
event, TextEventInputBackTab); | 492 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t",
event, TextEventInputBackTab); |
| 493 } | 493 } |
| 494 | 494 |
| 495 static bool executeInsertHorizontalRule(Frame& frame, Event*, EditorCommandSourc
e, const String& value) | 495 static bool executeInsertHorizontalRule(Frame& frame, Event*, EditorCommandSourc
e, const String& value) |
| 496 { | 496 { |
| 497 RefPtr<HTMLHRElement> rule = HTMLHRElement::create(frame.document()); | 497 ASSERT(frame.document()); |
| 498 RefPtr<HTMLHRElement> rule = HTMLHRElement::create(*frame.document()); |
| 498 if (!value.isEmpty()) | 499 if (!value.isEmpty()) |
| 499 rule->setIdAttribute(value); | 500 rule->setIdAttribute(value); |
| 500 return executeInsertNode(frame, rule.release()); | 501 return executeInsertNode(frame, rule.release()); |
| 501 } | 502 } |
| 502 | 503 |
| 503 static bool executeInsertHTML(Frame& frame, Event*, EditorCommandSource, const S
tring& value) | 504 static bool executeInsertHTML(Frame& frame, Event*, EditorCommandSource, const S
tring& value) |
| 504 { | 505 { |
| 505 return executeInsertFragment(frame, createFragmentFromMarkup(frame.document(
), value, "")); | 506 return executeInsertFragment(frame, createFragmentFromMarkup(frame.document(
), value, "")); |
| 506 } | 507 } |
| 507 | 508 |
| 508 static bool executeInsertImage(Frame& frame, Event*, EditorCommandSource, const
String& value) | 509 static bool executeInsertImage(Frame& frame, Event*, EditorCommandSource, const
String& value) |
| 509 { | 510 { |
| 510 // FIXME: If userInterface is true, we should display a dialog box and let t
he user choose a local image. | 511 // FIXME: If userInterface is true, we should display a dialog box and let t
he user choose a local image. |
| 511 RefPtr<HTMLImageElement> image = HTMLImageElement::create(frame.document()); | 512 ASSERT(frame.document()); |
| 513 RefPtr<HTMLImageElement> image = HTMLImageElement::create(*frame.document())
; |
| 512 image->setSrc(value); | 514 image->setSrc(value); |
| 513 return executeInsertNode(frame, image.release()); | 515 return executeInsertNode(frame, image.release()); |
| 514 } | 516 } |
| 515 | 517 |
| 516 static bool executeInsertLineBreak(Frame& frame, Event* event, EditorCommandSour
ce source, const String&) | 518 static bool executeInsertLineBreak(Frame& frame, Event* event, EditorCommandSour
ce source, const String&) |
| 517 { | 519 { |
| 518 switch (source) { | 520 switch (source) { |
| 519 case CommandFromMenuOrKeyBinding: | 521 case CommandFromMenuOrKeyBinding: |
| 520 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("
\n", event, TextEventInputLineBreak); | 522 return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("
\n", event, TextEventInputLineBreak); |
| 521 case CommandFromDOM: | 523 case CommandFromDOM: |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? "tr
ue" : "false"; | 1757 return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? "tr
ue" : "false"; |
| 1756 return m_command->value(*m_frame, triggeringEvent); | 1758 return m_command->value(*m_frame, triggeringEvent); |
| 1757 } | 1759 } |
| 1758 | 1760 |
| 1759 bool Editor::Command::isTextInsertion() const | 1761 bool Editor::Command::isTextInsertion() const |
| 1760 { | 1762 { |
| 1761 return m_command && m_command->isTextInsertion; | 1763 return m_command && m_command->isTextInsertion; |
| 1762 } | 1764 } |
| 1763 | 1765 |
| 1764 } // namespace WebCore | 1766 } // namespace WebCore |
| OLD | NEW |