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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp

Issue 2151353002: [InputEvent] Replace |EditAction| with |InputType| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@inputevent-text-styling
Patch Set: Replaced |EditAction| with |InputType| Created 4 years, 5 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
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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 inline void ReplaceSelectionCommand::InsertedNodes::didReplaceNode(Node& node, N ode& newNode) 394 inline void ReplaceSelectionCommand::InsertedNodes::didReplaceNode(Node& node, N ode& newNode)
395 { 395 {
396 if (m_firstNodeInserted.get() == node) 396 if (m_firstNodeInserted.get() == node)
397 m_firstNodeInserted = &newNode; 397 m_firstNodeInserted = &newNode;
398 if (m_lastNodeInserted.get() == node) 398 if (m_lastNodeInserted.get() == node)
399 m_lastNodeInserted = &newNode; 399 m_lastNodeInserted = &newNode;
400 } 400 }
401 401
402 ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, DocumentFra gment* fragment, CommandOptions options, EditAction editAction) 402 ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, DocumentFra gment* fragment, CommandOptions options, InputEvent::InputType inputType)
403 : CompositeEditCommand(document) 403 : CompositeEditCommand(document)
404 , m_selectReplacement(options & SelectReplacement) 404 , m_selectReplacement(options & SelectReplacement)
405 , m_smartReplace(options & SmartReplace) 405 , m_smartReplace(options & SmartReplace)
406 , m_matchStyle(options & MatchStyle) 406 , m_matchStyle(options & MatchStyle)
407 , m_documentFragment(fragment) 407 , m_documentFragment(fragment)
408 , m_preventNesting(options & PreventNesting) 408 , m_preventNesting(options & PreventNesting)
409 , m_movingParagraph(options & MovingParagraph) 409 , m_movingParagraph(options & MovingParagraph)
410 , m_editAction(editAction) 410 , m_inputType(inputType)
411 , m_sanitizeFragment(options & SanitizeFragment) 411 , m_sanitizeFragment(options & SanitizeFragment)
412 , m_shouldMergeEnd(false) 412 , m_shouldMergeEnd(false)
413 { 413 {
414 } 414 }
415 415
416 static bool hasMatchingQuoteLevel(VisiblePosition endOfExistingContent, VisibleP osition endOfInsertedContent) 416 static bool hasMatchingQuoteLevel(VisiblePosition endOfExistingContent, VisibleP osition endOfInsertedContent)
417 { 417 {
418 Position existing = endOfExistingContent.deepEquivalent(); 418 Position existing = endOfExistingContent.deepEquivalent();
419 Position inserted = endOfInsertedContent.deepEquivalent(); 419 Position inserted = endOfInsertedContent.deepEquivalent();
420 bool isInsideMailBlockquote = enclosingNodeOfType(inserted, isMailHTMLBlockq uoteElement, CanCrossEditingBoundary); 420 bool isInsideMailBlockquote = enclosingNodeOfType(inserted, isMailHTMLBlockq uoteElement, CanCrossEditingBoundary);
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 positionOnlyToBeUpdated = Position(text, originalLength + positionOn lyToBeUpdated.offsetInContainerNode()); 1629 positionOnlyToBeUpdated = Position(text, originalLength + positionOn lyToBeUpdated.offsetInContainerNode());
1630 else 1630 else
1631 updatePositionForNodeRemoval(positionOnlyToBeUpdated, *next); 1631 updatePositionForNodeRemoval(positionOnlyToBeUpdated, *next);
1632 1632
1633 removeNode(next, editingState); 1633 removeNode(next, editingState);
1634 if (editingState->isAborted()) 1634 if (editingState->isAborted())
1635 return; 1635 return;
1636 } 1636 }
1637 } 1637 }
1638 1638
1639 EditAction ReplaceSelectionCommand::editingAction() const 1639 InputEvent::InputType ReplaceSelectionCommand::inputType() const
1640 { 1640 {
1641 return m_editAction; 1641 return m_inputType;
1642 } 1642 }
1643 1643
1644 // If the user is inserting a list into an existing list, instead of nesting the list, 1644 // If the user is inserting a list into an existing list, instead of nesting the list,
1645 // we put the list items into the existing list. 1645 // we put the list items into the existing list.
1646 Node* ReplaceSelectionCommand::insertAsListItems(HTMLElement* listElement, Eleme nt* insertionBlock, const Position& insertPos, InsertedNodes& insertedNodes, Edi tingState* editingState) 1646 Node* ReplaceSelectionCommand::insertAsListItems(HTMLElement* listElement, Eleme nt* insertionBlock, const Position& insertPos, InsertedNodes& insertedNodes, Edi tingState* editingState)
1647 { 1647 {
1648 while (listElement->hasOneChild() && isHTMLListElement(listElement->firstChi ld())) 1648 while (listElement->hasOneChild() && isHTMLListElement(listElement->firstChi ld()))
1649 listElement = toHTMLElement(listElement->firstChild()); 1649 listElement = toHTMLElement(listElement->firstChild());
1650 1650
1651 bool isStart = isStartOfParagraph(createVisiblePosition(insertPos)); 1651 bool isStart = isStartOfParagraph(createVisiblePosition(insertPos));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 visitor->trace(m_startOfInsertedContent); 1755 visitor->trace(m_startOfInsertedContent);
1756 visitor->trace(m_endOfInsertedContent); 1756 visitor->trace(m_endOfInsertedContent);
1757 visitor->trace(m_insertionStyle); 1757 visitor->trace(m_insertionStyle);
1758 visitor->trace(m_documentFragment); 1758 visitor->trace(m_documentFragment);
1759 visitor->trace(m_startOfInsertedRange); 1759 visitor->trace(m_startOfInsertedRange);
1760 visitor->trace(m_endOfInsertedRange); 1760 visitor->trace(m_endOfInsertedRange);
1761 CompositeEditCommand::trace(visitor); 1761 CompositeEditCommand::trace(visitor);
1762 } 1762 }
1763 1763
1764 } // namespace blink 1764 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698