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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 static bool executeInsertHTML(LocalFrame& frame, Event*, EditorCommandSource, co
nst String& value) | 510 static bool executeInsertHTML(LocalFrame& frame, Event*, EditorCommandSource, co
nst String& value) |
511 { | 511 { |
512 ASSERT(frame.document()); | 512 ASSERT(frame.document()); |
513 return executeInsertFragment(frame, createFragmentFromMarkup(*frame.document
(), value, "")); | 513 return executeInsertFragment(frame, createFragmentFromMarkup(*frame.document
(), value, "")); |
514 } | 514 } |
515 | 515 |
516 static bool executeInsertImage(LocalFrame& frame, Event*, EditorCommandSource, c
onst String& value) | 516 static bool executeInsertImage(LocalFrame& frame, Event*, EditorCommandSource, c
onst String& value) |
517 { | 517 { |
518 ASSERT(frame.document()); | 518 ASSERT(frame.document()); |
519 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(*frame
.document()); | 519 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(*frame
.document()); |
520 image->setSrc(value); | 520 if (!value.isEmpty()) |
| 521 image->setSrc(value); |
521 return executeInsertElement(frame, image.release()); | 522 return executeInsertElement(frame, image.release()); |
522 } | 523 } |
523 | 524 |
524 static bool executeInsertLineBreak(LocalFrame& frame, Event* event, EditorComman
dSource source, const String&) | 525 static bool executeInsertLineBreak(LocalFrame& frame, Event* event, EditorComman
dSource source, const String&) |
525 { | 526 { |
526 switch (source) { | 527 switch (source) { |
527 case CommandFromMenuOrKeyBinding: | 528 case CommandFromMenuOrKeyBinding: |
528 return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\
n", event, TextEventInputLineBreak); | 529 return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\
n", event, TextEventInputLineBreak); |
529 case CommandFromDOM: | 530 case CommandFromDOM: |
530 // Doesn't scroll to make the selection visible, or modify the kill ring
. | 531 // Doesn't scroll to make the selection visible, or modify the kill ring
. |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 { | 1786 { |
1786 return m_command && m_command->isTextInsertion; | 1787 return m_command && m_command->isTextInsertion; |
1787 } | 1788 } |
1788 | 1789 |
1789 int Editor::Command::idForHistogram() const | 1790 int Editor::Command::idForHistogram() const |
1790 { | 1791 { |
1791 return isSupported() ? m_command->idForUserMetrics : 0; | 1792 return isSupported() ? m_command->idForUserMetrics : 0; |
1792 } | 1793 } |
1793 | 1794 |
1794 } // namespace blink | 1795 } // namespace blink |
OLD | NEW |