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

Side by Side Diff: third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializer.cpp

Issue 2950053002: Make Position::BeforeNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-21T17:56:36 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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
5 * Copyright (C) 2011 Igalia S.L. 5 * Copyright (C) 2011 Igalia S.L.
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 const VisiblePositionTemplate<Strategy> visible_end = 192 const VisiblePositionTemplate<Strategy> visible_end =
193 CreateVisiblePosition(end_); 193 CreateVisiblePosition(end_);
194 if (ShouldAnnotate() && NeedInterchangeNewlineAfter(visible_start)) { 194 if (ShouldAnnotate() && NeedInterchangeNewlineAfter(visible_start)) {
195 markup_accumulator.AppendInterchangeNewline(); 195 markup_accumulator.AppendInterchangeNewline();
196 if (visible_start.DeepEquivalent() == 196 if (visible_start.DeepEquivalent() ==
197 PreviousPositionOf(visible_end).DeepEquivalent()) 197 PreviousPositionOf(visible_end).DeepEquivalent())
198 return markup_accumulator.TakeResults(); 198 return markup_accumulator.TakeResults();
199 199
200 first_node = NextPositionOf(visible_start).DeepEquivalent().AnchorNode(); 200 first_node = NextPositionOf(visible_start).DeepEquivalent().AnchorNode();
201 201
202 if (past_end && PositionTemplate<Strategy>::BeforeNode(first_node) 202 if (past_end && PositionTemplate<Strategy>::BeforeNode(*first_node)
203 .CompareTo(PositionTemplate<Strategy>::BeforeNode( 203 .CompareTo(PositionTemplate<Strategy>::BeforeNode(
204 past_end)) >= 0) { 204 *past_end)) >= 0) {
205 // This condition hits in editing/pasteboard/copy-display-none.html. 205 // This condition hits in editing/pasteboard/copy-display-none.html.
206 return markup_accumulator.TakeResults(); 206 return markup_accumulator.TakeResults();
207 } 207 }
208 } 208 }
209 209
210 // If there is no the highest node in the selected nodes, |m_lastClosed| can 210 // If there is no the highest node in the selected nodes, |m_lastClosed| can
211 // be #text when its parent is a formatting tag. In this case, #text is 211 // be #text when its parent is a formatting tag. In this case, #text is
212 // wrapped by <span> tag, but this text should be wrapped by the formatting 212 // wrapped by <span> tag, but this text should be wrapped by the formatting
213 // tag. See http://crbug.com/634482 213 // tag. See http://crbug.com/634482
214 bool should_append_parent_tag = false; 214 bool should_append_parent_tag = false;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 if (element.IsHTMLElement() && ShouldAnnotate()) 547 if (element.IsHTMLElement() && ShouldAnnotate())
548 inline_style->MergeStyleFromRulesForSerialization(&ToHTMLElement(element)); 548 inline_style->MergeStyleFromRulesForSerialization(&ToHTMLElement(element));
549 549
550 return inline_style; 550 return inline_style;
551 } 551 }
552 552
553 template class StyledMarkupSerializer<EditingStrategy>; 553 template class StyledMarkupSerializer<EditingStrategy>;
554 template class StyledMarkupSerializer<EditingInFlatTreeStrategy>; 554 template class StyledMarkupSerializer<EditingInFlatTreeStrategy>;
555 555
556 } // namespace blink 556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698