| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 // FIXME: executeToggleStyleInList does not handle complicated cases such as <b>
<u>hello</u>world</b> properly. | 135 // FIXME: executeToggleStyleInList does not handle complicated cases such as <b>
<u>hello</u>world</b> properly. |
| 136 // This function must use Editor::selectionHasStyle to determine the curr
ent style but we cannot fix this | 136 // This function must use Editor::selectionHasStyle to determine the curr
ent style but we cannot fix this |
| 137 // until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved. | 137 // until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved. |
| 138 static bool executeToggleStyleInList(LocalFrame& frame, EditorCommandSource sour
ce, EditAction action, CSSPropertyID propertyID, CSSValue* value) | 138 static bool executeToggleStyleInList(LocalFrame& frame, EditorCommandSource sour
ce, EditAction action, CSSPropertyID propertyID, CSSValue* value) |
| 139 { | 139 { |
| 140 RefPtrWillBeRawPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelec
tionStart(frame.selection().selection()); | 140 RefPtrWillBeRawPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelec
tionStart(frame.selection().selection()); |
| 141 if (!selectionStyle || !selectionStyle->style()) | 141 if (!selectionStyle || !selectionStyle->style()) |
| 142 return false; | 142 return false; |
| 143 | 143 |
| 144 RefPtrWillBeRawPtr<CSSValue> selectedCSSValue = selectionStyle->style()->get
PropertyCSSValue(propertyID); | 144 RefPtr<CSSValue> selectedCSSValue = selectionStyle->style()->getPropertyCSSV
alue(propertyID); |
| 145 String newStyle("none"); | 145 String newStyle("none"); |
| 146 if (selectedCSSValue->isValueList()) { | 146 if (selectedCSSValue->isValueList()) { |
| 147 RefPtrWillBeRawPtr<CSSValueList> selectedCSSValueList = toCSSValueList(s
electedCSSValue.get()); | 147 RefPtr<CSSValueList> selectedCSSValueList = toCSSValueList(selectedCSSVa
lue.get()); |
| 148 if (!selectedCSSValueList->removeAll(value)) | 148 if (!selectedCSSValueList->removeAll(value)) |
| 149 selectedCSSValueList->append(value); | 149 selectedCSSValueList->append(value); |
| 150 if (selectedCSSValueList->length()) | 150 if (selectedCSSValueList->length()) |
| 151 newStyle = selectedCSSValueList->cssText(); | 151 newStyle = selectedCSSValueList->cssText(); |
| 152 | 152 |
| 153 } else if (selectedCSSValue->cssText() == "none") { | 153 } else if (selectedCSSValue->cssText() == "none") { |
| 154 newStyle = value->cssText(); | 154 newStyle = value->cssText(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // FIXME: We shouldn't be having to convert new style into text. We should
have setPropertyCSSValue. | 157 // FIXME: We shouldn't be having to convert new style into text. We should
have setPropertyCSSValue. |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 static bool executeSetMark(LocalFrame& frame, Event*, EditorCommandSource, const
String&) | 1056 static bool executeSetMark(LocalFrame& frame, Event*, EditorCommandSource, const
String&) |
| 1057 { | 1057 { |
| 1058 frame.editor().setMark(frame.selection().selection()); | 1058 frame.editor().setMark(frame.selection().selection()); |
| 1059 return true; | 1059 return true; |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 static bool executeStrikethrough(LocalFrame& frame, Event*, EditorCommandSource
source, const String&) | 1062 static bool executeStrikethrough(LocalFrame& frame, Event*, EditorCommandSource
source, const String&) |
| 1063 { | 1063 { |
| 1064 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineThrough = CSSPrimitiveValue::creat
eIdentifier(CSSValueLineThrough); | 1064 RefPtr<CSSPrimitiveValue> lineThrough = CSSPrimitiveValue::createIdentifier(
CSSValueLineThrough); |
| 1065 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPrope
rtyWebkitTextDecorationsInEffect, lineThrough.get()); | 1065 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPrope
rtyWebkitTextDecorationsInEffect, lineThrough.get()); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 static bool executeStyleWithCSS(LocalFrame& frame, Event*, EditorCommandSource,
const String& value) | 1068 static bool executeStyleWithCSS(LocalFrame& frame, Event*, EditorCommandSource,
const String& value) |
| 1069 { | 1069 { |
| 1070 frame.editor().setShouldStyleWithCSS(!equalIgnoringCase(value, "false")); | 1070 frame.editor().setShouldStyleWithCSS(!equalIgnoringCase(value, "false")); |
| 1071 return true; | 1071 return true; |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 static bool executeUseCSS(LocalFrame& frame, Event*, EditorCommandSource, const
String& value) | 1074 static bool executeUseCSS(LocalFrame& frame, Event*, EditorCommandSource, const
String& value) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 static bool executeTranspose(LocalFrame& frame, Event*, EditorCommandSource, con
st String&) | 1111 static bool executeTranspose(LocalFrame& frame, Event*, EditorCommandSource, con
st String&) |
| 1112 { | 1112 { |
| 1113 frame.editor().transpose(); | 1113 frame.editor().transpose(); |
| 1114 return true; | 1114 return true; |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 static bool executeUnderline(LocalFrame& frame, Event*, EditorCommandSource sour
ce, const String&) | 1117 static bool executeUnderline(LocalFrame& frame, Event*, EditorCommandSource sour
ce, const String&) |
| 1118 { | 1118 { |
| 1119 RefPtrWillBeRawPtr<CSSPrimitiveValue> underline = CSSPrimitiveValue::createI
dentifier(CSSValueUnderline); | 1119 RefPtr<CSSPrimitiveValue> underline = CSSPrimitiveValue::createIdentifier(CS
SValueUnderline); |
| 1120 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPrope
rtyWebkitTextDecorationsInEffect, underline.get()); | 1120 return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPrope
rtyWebkitTextDecorationsInEffect, underline.get()); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 static bool executeUndo(LocalFrame& frame, Event*, EditorCommandSource, const St
ring&) | 1123 static bool executeUndo(LocalFrame& frame, Event*, EditorCommandSource, const St
ring&) |
| 1124 { | 1124 { |
| 1125 frame.editor().undo(); | 1125 frame.editor().undo(); |
| 1126 return true; | 1126 return true; |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 static bool executeUnlink(LocalFrame& frame, Event*, EditorCommandSource, const
String&) | 1129 static bool executeUnlink(LocalFrame& frame, Event*, EditorCommandSource, const
String&) |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 { | 1787 { |
| 1788 return m_command && m_command->isTextInsertion; | 1788 return m_command && m_command->isTextInsertion; |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 int Editor::Command::idForHistogram() const | 1791 int Editor::Command::idForHistogram() const |
| 1792 { | 1792 { |
| 1793 return isSupported() ? m_command->idForUserMetrics : 0; | 1793 return isSupported() ? m_command->idForUserMetrics : 0; |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 } // namespace blink | 1796 } // namespace blink |
| OLD | NEW |