| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/clipboard/DataTransfer.h" | 34 #include "core/clipboard/DataTransfer.h" |
| 35 #include "core/clipboard/Pasteboard.h" | 35 #include "core/clipboard/Pasteboard.h" |
| 36 #include "core/css/CSSComputedStyleDeclaration.h" | 36 #include "core/css/CSSComputedStyleDeclaration.h" |
| 37 #include "core/css/StylePropertySet.h" | 37 #include "core/css/StylePropertySet.h" |
| 38 #include "core/dom/AXObjectCache.h" | 38 #include "core/dom/AXObjectCache.h" |
| 39 #include "core/dom/DocumentFragment.h" | 39 #include "core/dom/DocumentFragment.h" |
| 40 #include "core/dom/ElementTraversal.h" | 40 #include "core/dom/ElementTraversal.h" |
| 41 #include "core/dom/NodeTraversal.h" | 41 #include "core/dom/NodeTraversal.h" |
| 42 #include "core/dom/ParserContentPolicy.h" | 42 #include "core/dom/ParserContentPolicy.h" |
| 43 #include "core/dom/Text.h" | 43 #include "core/dom/Text.h" |
| 44 #include "core/editing/EditingStyleUtilities.h" |
| 44 #include "core/editing/EditingUtilities.h" | 45 #include "core/editing/EditingUtilities.h" |
| 45 #include "core/editing/InputMethodController.h" | 46 #include "core/editing/InputMethodController.h" |
| 46 #include "core/editing/RenderedPosition.h" | 47 #include "core/editing/RenderedPosition.h" |
| 47 #include "core/editing/VisibleUnits.h" | 48 #include "core/editing/VisibleUnits.h" |
| 48 #include "core/editing/commands/ApplyStyleCommand.h" | 49 #include "core/editing/commands/ApplyStyleCommand.h" |
| 49 #include "core/editing/commands/DeleteSelectionCommand.h" | 50 #include "core/editing/commands/DeleteSelectionCommand.h" |
| 50 #include "core/editing/commands/IndentOutdentCommand.h" | 51 #include "core/editing/commands/IndentOutdentCommand.h" |
| 51 #include "core/editing/commands/InsertListCommand.h" | 52 #include "core/editing/commands/InsertListCommand.h" |
| 52 #include "core/editing/commands/RemoveFormatCommand.h" | 53 #include "core/editing/commands/RemoveFormatCommand.h" |
| 53 #include "core/editing/commands/ReplaceSelectionCommand.h" | 54 #include "core/editing/commands/ReplaceSelectionCommand.h" |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 InputEvent::InputType inputType) { | 789 InputEvent::InputType inputType) { |
| 789 if (!style || style->isEmpty() || !canEditRichly()) | 790 if (!style || style->isEmpty() || !canEditRichly()) |
| 790 return; | 791 return; |
| 791 | 792 |
| 792 applyParagraphStyle(style, inputType); | 793 applyParagraphStyle(style, inputType); |
| 793 } | 794 } |
| 794 | 795 |
| 795 bool Editor::selectionStartHasStyle(CSSPropertyID propertyID, | 796 bool Editor::selectionStartHasStyle(CSSPropertyID propertyID, |
| 796 const String& value) const { | 797 const String& value) const { |
| 797 EditingStyle* styleToCheck = EditingStyle::create(propertyID, value); | 798 EditingStyle* styleToCheck = EditingStyle::create(propertyID, value); |
| 798 EditingStyle* styleAtStart = EditingStyle::styleAtSelectionStart( | 799 EditingStyle* styleAtStart = |
| 799 frame().selection().selection(), propertyID == CSSPropertyBackgroundColor, | 800 EditingStyleUtilities::createStyleAtSelectionStart( |
| 800 styleToCheck->style()); | 801 frame().selection().selection(), |
| 802 propertyID == CSSPropertyBackgroundColor, styleToCheck->style()); |
| 801 return styleToCheck->triStateOfStyle(styleAtStart); | 803 return styleToCheck->triStateOfStyle(styleAtStart); |
| 802 } | 804 } |
| 803 | 805 |
| 804 TriState Editor::selectionHasStyle(CSSPropertyID propertyID, | 806 TriState Editor::selectionHasStyle(CSSPropertyID propertyID, |
| 805 const String& value) const { | 807 const String& value) const { |
| 806 return EditingStyle::create(propertyID, value) | 808 return EditingStyle::create(propertyID, value) |
| 807 ->triStateOfStyle(frame().selection().selection()); | 809 ->triStateOfStyle(frame().selection().selection()); |
| 808 } | 810 } |
| 809 | 811 |
| 810 String Editor::selectionStartCSSPropertyValue(CSSPropertyID propertyID) { | 812 String Editor::selectionStartCSSPropertyValue(CSSPropertyID propertyID) { |
| 811 EditingStyle* selectionStyle = EditingStyle::styleAtSelectionStart( | 813 EditingStyle* selectionStyle = |
| 812 frame().selection().selection(), | 814 EditingStyleUtilities::createStyleAtSelectionStart( |
| 813 propertyID == CSSPropertyBackgroundColor); | 815 frame().selection().selection(), |
| 816 propertyID == CSSPropertyBackgroundColor); |
| 814 if (!selectionStyle || !selectionStyle->style()) | 817 if (!selectionStyle || !selectionStyle->style()) |
| 815 return String(); | 818 return String(); |
| 816 | 819 |
| 817 if (propertyID == CSSPropertyFontSize) | 820 if (propertyID == CSSPropertyFontSize) |
| 818 return String::number(selectionStyle->legacyFontSize(frame().document())); | 821 return String::number(selectionStyle->legacyFontSize(frame().document())); |
| 819 return selectionStyle->style()->getPropertyValue(propertyID); | 822 return selectionStyle->style()->getPropertyValue(propertyID); |
| 820 } | 823 } |
| 821 | 824 |
| 822 static void dispatchEditableContentChangedEvents(Element* startRoot, | 825 static void dispatchEditableContentChangedEvents(Element* startRoot, |
| 823 Element* endRoot) { | 826 Element* endRoot) { |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 | 1701 |
| 1699 DEFINE_TRACE(Editor) { | 1702 DEFINE_TRACE(Editor) { |
| 1700 visitor->trace(m_frame); | 1703 visitor->trace(m_frame); |
| 1701 visitor->trace(m_lastEditCommand); | 1704 visitor->trace(m_lastEditCommand); |
| 1702 visitor->trace(m_undoStack); | 1705 visitor->trace(m_undoStack); |
| 1703 visitor->trace(m_mark); | 1706 visitor->trace(m_mark); |
| 1704 visitor->trace(m_typingStyle); | 1707 visitor->trace(m_typingStyle); |
| 1705 } | 1708 } |
| 1706 | 1709 |
| 1707 } // namespace blink | 1710 } // namespace blink |
| OLD | NEW |