Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: Source/core/editing/ReplaceSelectionCommand.cpp

Issue 16081007: Introduce toHTMLInputElement(Node*), and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 // A br that was originally acting as a line break should still be acting as a line break, not as a placeholder. 1239 // A br that was originally acting as a line break should still be acting as a line break, not as a placeholder.
1240 return isStartOfParagraph(visiblePos) && isEndOfParagraph(visiblePos); 1240 return isStartOfParagraph(visiblePos) && isEndOfParagraph(visiblePos);
1241 } 1241 }
1242 1242
1243 bool ReplaceSelectionCommand::shouldPerformSmartReplace() const 1243 bool ReplaceSelectionCommand::shouldPerformSmartReplace() const
1244 { 1244 {
1245 if (!m_smartReplace) 1245 if (!m_smartReplace)
1246 return false; 1246 return false;
1247 1247
1248 Element* textControl = enclosingTextFormControl(positionAtStartOfInsertedCon tent().deepEquivalent()); 1248 Element* textControl = enclosingTextFormControl(positionAtStartOfInsertedCon tent().deepEquivalent());
1249 if (textControl && textControl->hasTagName(inputTag) && static_cast<HTMLInpu tElement*>(textControl)->isPasswordField()) 1249 if (textControl && textControl->hasTagName(inputTag) && toHTMLInputElement(t extControl)->isPasswordField())
1250 return false; // Disable smart replace for password fields. 1250 return false; // Disable smart replace for password fields.
1251 1251
1252 return true; 1252 return true;
1253 } 1253 }
1254 1254
1255 static bool isCharacterSmartReplaceExemptConsideringNonBreakingSpace(UChar32 cha racter, bool previousCharacter) 1255 static bool isCharacterSmartReplaceExemptConsideringNonBreakingSpace(UChar32 cha racter, bool previousCharacter)
1256 { 1256 {
1257 return isCharacterSmartReplaceExempt(character == noBreakSpace ? ' ' : chara cter, previousCharacter); 1257 return isCharacterSmartReplaceExempt(character == noBreakSpace ? ' ' : chara cter, previousCharacter);
1258 } 1258 }
1259 1259
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); 1485 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1486 1486
1487 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1487 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1488 1488
1489 setEndingSelection(selectionAfterReplace); 1489 setEndingSelection(selectionAfterReplace);
1490 1490
1491 return true; 1491 return true;
1492 } 1492 }
1493 1493
1494 } // namespace WebCore 1494 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698