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

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

Issue 2920733002: Rename VisibleSelection::end() to End() (Closed)
Patch Set: 2017-06-01T18:31:38 Created 3 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
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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1021
1022 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 1022 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
1023 1023
1024 // We can skip matching the style if the selection is plain text. 1024 // We can skip matching the style if the selection is plain text.
1025 if ((selection.Start().AnchorNode()->GetLayoutObject() && 1025 if ((selection.Start().AnchorNode()->GetLayoutObject() &&
1026 selection.Start() 1026 selection.Start()
1027 .AnchorNode() 1027 .AnchorNode()
1028 ->GetLayoutObject() 1028 ->GetLayoutObject()
1029 ->Style() 1029 ->Style()
1030 ->UserModify() == EUserModify::kReadWritePlaintextOnly) && 1030 ->UserModify() == EUserModify::kReadWritePlaintextOnly) &&
1031 (selection.end().AnchorNode()->GetLayoutObject() && 1031 (selection.End().AnchorNode()->GetLayoutObject() &&
1032 selection.end().AnchorNode()->GetLayoutObject()->Style()->UserModify() == 1032 selection.End().AnchorNode()->GetLayoutObject()->Style()->UserModify() ==
1033 EUserModify::kReadWritePlaintextOnly)) 1033 EUserModify::kReadWritePlaintextOnly))
1034 match_style_ = false; 1034 match_style_ = false;
1035 1035
1036 if (match_style_) { 1036 if (match_style_) {
1037 insertion_style_ = EditingStyle::Create(selection.Start()); 1037 insertion_style_ = EditingStyle::Create(selection.Start());
1038 insertion_style_->MergeTypingStyle(&GetDocument()); 1038 insertion_style_->MergeTypingStyle(&GetDocument());
1039 } 1039 }
1040 1040
1041 const VisiblePosition visible_start = selection.VisibleStart(); 1041 const VisiblePosition visible_start = selection.VisibleStart();
1042 const VisiblePosition visible_end = selection.VisibleEnd(); 1042 const VisiblePosition visible_end = selection.VisibleEnd();
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 // should not be underlined. 1957 // should not be underlined.
1958 if (ElementToSplitToAvoidPastingIntoInlineElementsWithStyle( 1958 if (ElementToSplitToAvoidPastingIntoInlineElementsWithStyle(
1959 EndingSelection().Start())) 1959 EndingSelection().Start()))
1960 return false; 1960 return false;
1961 1961
1962 // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets 1962 // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets
1963 // needs to be audited. See http://crbug.com/590369 for more details. 1963 // needs to be audited. See http://crbug.com/590369 for more details.
1964 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 1964 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
1965 1965
1966 Node* node_after_insertion_pos = 1966 Node* node_after_insertion_pos =
1967 MostForwardCaretPosition(EndingSelection().end()).AnchorNode(); 1967 MostForwardCaretPosition(EndingSelection().End()).AnchorNode();
1968 Text* text_node = ToText(fragment.FirstChild()); 1968 Text* text_node = ToText(fragment.FirstChild());
1969 // Our fragment creation code handles tabs, spaces, and newlines, so we don't 1969 // Our fragment creation code handles tabs, spaces, and newlines, so we don't
1970 // have to worry about those here. 1970 // have to worry about those here.
1971 1971
1972 Position start = EndingSelection().Start(); 1972 Position start = EndingSelection().Start();
1973 Position end = ReplaceSelectedTextInNode(text_node->data()); 1973 Position end = ReplaceSelectedTextInNode(text_node->data());
1974 if (end.IsNull()) 1974 if (end.IsNull())
1975 return false; 1975 return false;
1976 1976
1977 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 1977 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 visitor->Trace(start_of_inserted_content_); 2009 visitor->Trace(start_of_inserted_content_);
2010 visitor->Trace(end_of_inserted_content_); 2010 visitor->Trace(end_of_inserted_content_);
2011 visitor->Trace(insertion_style_); 2011 visitor->Trace(insertion_style_);
2012 visitor->Trace(document_fragment_); 2012 visitor->Trace(document_fragment_);
2013 visitor->Trace(start_of_inserted_range_); 2013 visitor->Trace(start_of_inserted_range_);
2014 visitor->Trace(end_of_inserted_range_); 2014 visitor->Trace(end_of_inserted_range_);
2015 CompositeEditCommand::Trace(visitor); 2015 CompositeEditCommand::Trace(visitor);
2016 } 2016 }
2017 2017
2018 } // namespace blink 2018 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698