| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 target = m_frame.document()->documentElement(); | 360 target = m_frame.document()->documentElement(); |
| 361 | 361 |
| 362 return target; | 362 return target; |
| 363 } | 363 } |
| 364 | 364 |
| 365 Element* Editor::findEventTargetFromSelection() const | 365 Element* Editor::findEventTargetFromSelection() const |
| 366 { | 366 { |
| 367 return findEventTargetFrom(m_frame.selection().selection()); | 367 return findEventTargetFrom(m_frame.selection().selection()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool Editor::selectionStartHasStyle(CSSPropertyID propertyID, const String& valu
e) const | |
| 371 { | |
| 372 return EditingStyle::create(propertyID, value)->triStateOfStyle( | |
| 373 EditingStyle::styleAtSelectionStart(m_frame.selection().selection(), pro
pertyID == CSSPropertyBackgroundColor).get()); | |
| 374 } | |
| 375 | |
| 376 TriState Editor::selectionHasStyle(CSSPropertyID propertyID, const String& value
) const | |
| 377 { | |
| 378 return EditingStyle::create(propertyID, value)->triStateOfStyle(m_frame.sele
ction().selection()); | |
| 379 } | |
| 380 | |
| 381 String Editor::selectionStartCSSPropertyValue(CSSPropertyID propertyID) | |
| 382 { | |
| 383 RefPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(m_
frame.selection().selection(), | |
| 384 propertyID == CSSPropertyBackgroundColor); | |
| 385 if (!selectionStyle || !selectionStyle->style()) | |
| 386 return String(); | |
| 387 | |
| 388 if (propertyID == CSSPropertyFontSize) | |
| 389 return String::number(selectionStyle->legacyFontSize(m_frame.document())
); | |
| 390 return selectionStyle->style()->getPropertyValue(propertyID); | |
| 391 } | |
| 392 | |
| 393 static void dispatchEditableContentChangedEvents(PassRefPtr<Element> startRoot,
PassRefPtr<Element> endRoot) | 370 static void dispatchEditableContentChangedEvents(PassRefPtr<Element> startRoot,
PassRefPtr<Element> endRoot) |
| 394 { | 371 { |
| 395 if (startRoot) | 372 if (startRoot) |
| 396 startRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableCon
tentChanged), IGNORE_EXCEPTION); | 373 startRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableCon
tentChanged), IGNORE_EXCEPTION); |
| 397 if (endRoot && endRoot != startRoot) | 374 if (endRoot && endRoot != startRoot) |
| 398 endRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableConte
ntChanged), IGNORE_EXCEPTION); | 375 endRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableConte
ntChanged), IGNORE_EXCEPTION); |
| 399 } | 376 } |
| 400 | 377 |
| 401 void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd) | 378 void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd) |
| 402 { | 379 { |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 return m_frame.spellChecker(); | 821 return m_frame.spellChecker(); |
| 845 } | 822 } |
| 846 | 823 |
| 847 void Editor::toggleOverwriteModeEnabled() | 824 void Editor::toggleOverwriteModeEnabled() |
| 848 { | 825 { |
| 849 m_overwriteModeEnabled = !m_overwriteModeEnabled; | 826 m_overwriteModeEnabled = !m_overwriteModeEnabled; |
| 850 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); | 827 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); |
| 851 } | 828 } |
| 852 | 829 |
| 853 } // namespace blink | 830 } // namespace blink |
| OLD | NEW |