| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
| 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 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/editing/ReplaceSelectionCommand.h" | 28 #include "core/editing/ReplaceSelectionCommand.h" |
| 29 | 29 |
| 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 31 #include "core/CSSPropertyNames.h" | 31 #include "core/CSSPropertyNames.h" |
| 32 #include "core/HTMLNames.h" | 32 #include "core/HTMLNames.h" |
| 33 #include "core/InputTypeNames.h" |
| 33 #include "core/css/CSSStyleDeclaration.h" | 34 #include "core/css/CSSStyleDeclaration.h" |
| 34 #include "core/css/StylePropertySet.h" | 35 #include "core/css/StylePropertySet.h" |
| 35 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 36 #include "core/dom/DocumentFragment.h" | 37 #include "core/dom/DocumentFragment.h" |
| 37 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 38 #include "core/dom/Text.h" | 39 #include "core/dom/Text.h" |
| 39 #include "core/editing/ApplyStyleCommand.h" | 40 #include "core/editing/ApplyStyleCommand.h" |
| 40 #include "core/editing/BreakBlockquoteCommand.h" | 41 #include "core/editing/BreakBlockquoteCommand.h" |
| 41 #include "core/editing/FrameSelection.h" | 42 #include "core/editing/FrameSelection.h" |
| 42 #include "core/editing/HTMLInterchange.h" | 43 #include "core/editing/HTMLInterchange.h" |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 // A br that was originally acting as a line break should still be acting as
a line break, not as a placeholder. | 1283 // A br that was originally acting as a line break should still be acting as
a line break, not as a placeholder. |
| 1283 return isStartOfParagraph(visiblePos) && isEndOfParagraph(visiblePos); | 1284 return isStartOfParagraph(visiblePos) && isEndOfParagraph(visiblePos); |
| 1284 } | 1285 } |
| 1285 | 1286 |
| 1286 bool ReplaceSelectionCommand::shouldPerformSmartReplace() const | 1287 bool ReplaceSelectionCommand::shouldPerformSmartReplace() const |
| 1287 { | 1288 { |
| 1288 if (!m_smartReplace) | 1289 if (!m_smartReplace) |
| 1289 return false; | 1290 return false; |
| 1290 | 1291 |
| 1291 HTMLTextFormControlElement* textControl = enclosingTextFormControl(positionA
tStartOfInsertedContent().deepEquivalent()); | 1292 HTMLTextFormControlElement* textControl = enclosingTextFormControl(positionA
tStartOfInsertedContent().deepEquivalent()); |
| 1292 if (isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->isPa
sswordField()) | 1293 if (isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->type
() == InputTypeNames::password) |
| 1293 return false; // Disable smart replace for password fields. | 1294 return false; // Disable smart replace for password fields. |
| 1294 | 1295 |
| 1295 return true; | 1296 return true; |
| 1296 } | 1297 } |
| 1297 | 1298 |
| 1298 static bool isCharacterSmartReplaceExemptConsideringNonBreakingSpace(UChar32 cha
racter, bool previousCharacter) | 1299 static bool isCharacterSmartReplaceExemptConsideringNonBreakingSpace(UChar32 cha
racter, bool previousCharacter) |
| 1299 { | 1300 { |
| 1300 return isCharacterSmartReplaceExempt(character == noBreakSpace ? ' ' : chara
cter, previousCharacter); | 1301 return isCharacterSmartReplaceExempt(character == noBreakSpace ? ' ' : chara
cter, previousCharacter); |
| 1301 } | 1302 } |
| 1302 | 1303 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 void ReplaceSelectionCommand::trace(Visitor* visitor) | 1541 void ReplaceSelectionCommand::trace(Visitor* visitor) |
| 1541 { | 1542 { |
| 1542 visitor->trace(m_startOfInsertedContent); | 1543 visitor->trace(m_startOfInsertedContent); |
| 1543 visitor->trace(m_endOfInsertedContent); | 1544 visitor->trace(m_endOfInsertedContent); |
| 1544 visitor->trace(m_insertionStyle); | 1545 visitor->trace(m_insertionStyle); |
| 1545 visitor->trace(m_documentFragment); | 1546 visitor->trace(m_documentFragment); |
| 1546 CompositeEditCommand::trace(visitor); | 1547 CompositeEditCommand::trace(visitor); |
| 1547 } | 1548 } |
| 1548 | 1549 |
| 1549 } // namespace blink | 1550 } // namespace blink |
| OLD | NEW |