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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return false; | 114 return false; |
115 } | 115 } |
116 | 116 |
117 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditActi
on action, CSSPropertyID propertyID, const String& propertyValue) | 117 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditActi
on action, CSSPropertyID propertyID, const String& propertyValue) |
118 { | 118 { |
119 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); | 119 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); |
120 style->setProperty(propertyID, propertyValue); | 120 style->setProperty(propertyID, propertyValue); |
121 return applyCommandToFrame(frame, source, action, style.get()); | 121 return applyCommandToFrame(frame, source, action, style.get()); |
122 } | 122 } |
123 | 123 |
124 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditActi
on action, CSSPropertyID propertyID, int propertyValue) | 124 static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditActi
on action, CSSPropertyID propertyID, CSSValueID propertyValue) |
125 { | 125 { |
126 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); | 126 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); |
127 style->setProperty(propertyID, propertyValue); | 127 style->setProperty(propertyID, propertyValue); |
128 return applyCommandToFrame(frame, source, action, style.get()); | 128 return applyCommandToFrame(frame, source, action, style.get()); |
129 } | 129 } |
130 | 130 |
131 // FIXME: executeToggleStyleInList does not handle complicated cases such as <b>
<u>hello</u>world</b> properly. | 131 // FIXME: executeToggleStyleInList does not handle complicated cases such as <b>
<u>hello</u>world</b> properly. |
132 // This function must use Editor::selectionHasStyle to determine the curr
ent style but we cannot fix this | 132 // This function must use Editor::selectionHasStyle to determine the curr
ent style but we cannot fix this |
133 // until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved. | 133 // until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved. |
134 static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E
ditAction action, CSSPropertyID propertyID, CSSValue* value) | 134 static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E
ditAction action, CSSPropertyID propertyID, CSSValue* value) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 return frame->editor()->findString(value, true, false, true, false); | 411 return frame->editor()->findString(value, true, false, true, false); |
412 } | 412 } |
413 | 413 |
414 static bool executeFontName(Frame* frame, Event*, EditorCommandSource source, co
nst String& value) | 414 static bool executeFontName(Frame* frame, Event*, EditorCommandSource source, co
nst String& value) |
415 { | 415 { |
416 return executeApplyStyle(frame, source, EditActionSetFont, CSSPropertyFontFa
mily, value); | 416 return executeApplyStyle(frame, source, EditActionSetFont, CSSPropertyFontFa
mily, value); |
417 } | 417 } |
418 | 418 |
419 static bool executeFontSize(Frame* frame, Event*, EditorCommandSource source, co
nst String& value) | 419 static bool executeFontSize(Frame* frame, Event*, EditorCommandSource source, co
nst String& value) |
420 { | 420 { |
421 int size; | 421 CSSValueID size; |
422 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) | 422 if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size)) |
423 return false; | 423 return false; |
424 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPrope
rtyFontSize, size); | 424 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPrope
rtyFontSize, size); |
425 } | 425 } |
426 | 426 |
427 static bool executeFontSizeDelta(Frame* frame, Event*, EditorCommandSource sourc
e, const String& value) | 427 static bool executeFontSizeDelta(Frame* frame, Event*, EditorCommandSource sourc
e, const String& value) |
428 { | 428 { |
429 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPrope
rtyWebkitFontSizeDelta, value); | 429 return executeApplyStyle(frame, source, EditActionChangeAttributes, CSSPrope
rtyWebkitFontSizeDelta, value); |
430 } | 430 } |
431 | 431 |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 return m_command->state(m_frame.get(), triggeringEvent) == TrueTriState
? "true" : "false"; | 1727 return m_command->state(m_frame.get(), triggeringEvent) == TrueTriState
? "true" : "false"; |
1728 return m_command->value(m_frame.get(), triggeringEvent); | 1728 return m_command->value(m_frame.get(), triggeringEvent); |
1729 } | 1729 } |
1730 | 1730 |
1731 bool Editor::Command::isTextInsertion() const | 1731 bool Editor::Command::isTextInsertion() const |
1732 { | 1732 { |
1733 return m_command && m_command->isTextInsertion; | 1733 return m_command && m_command->isTextInsertion; |
1734 } | 1734 } |
1735 | 1735 |
1736 } // namespace WebCore | 1736 } // namespace WebCore |
OLD | NEW |