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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnitsParagraph.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 * 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 template <typename Strategy> 46 template <typename Strategy>
47 PositionTemplate<Strategy> StartOfParagraphAlgorithm( 47 PositionTemplate<Strategy> StartOfParagraphAlgorithm(
48 const PositionTemplate<Strategy>& position, 48 const PositionTemplate<Strategy>& position,
49 EditingBoundaryCrossingRule boundary_crossing_rule) { 49 EditingBoundaryCrossingRule boundary_crossing_rule) {
50 Node* const start_node = position.AnchorNode(); 50 Node* const start_node = position.AnchorNode();
51 51
52 if (!start_node) 52 if (!start_node)
53 return PositionTemplate<Strategy>(); 53 return PositionTemplate<Strategy>();
54 54
55 if (IsRenderedAsNonInlineTableImageOrHR(start_node)) 55 if (IsRenderedAsNonInlineTableImageOrHR(start_node))
56 return PositionTemplate<Strategy>::BeforeNode(start_node); 56 return PositionTemplate<Strategy>::BeforeNode(*start_node);
57 57
58 Element* const start_block = EnclosingBlock( 58 Element* const start_block = EnclosingBlock(
59 PositionTemplate<Strategy>::FirstPositionInOrBeforeNode(start_node), 59 PositionTemplate<Strategy>::FirstPositionInOrBeforeNode(start_node),
60 kCannotCrossEditingBoundary); 60 kCannotCrossEditingBoundary);
61 ContainerNode* const highest_root = HighestEditableRoot(position); 61 ContainerNode* const highest_root = HighestEditableRoot(position);
62 const bool start_node_is_editable = HasEditableStyle(*start_node); 62 const bool start_node_is_editable = HasEditableStyle(*start_node);
63 63
64 Node* candidate_node = start_node; 64 Node* candidate_node = start_node;
65 PositionAnchorType candidate_type = position.AnchorType(); 65 PositionAnchorType candidate_type = position.AnchorType();
66 int candidate_offset = position.ComputeEditingOffset(); 66 int candidate_offset = position.ComputeEditingOffset();
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 ? paragraph_start 399 ? paragraph_start
400 : range.StartPosition(); 400 : range.StartPosition();
401 const Position& result_end = 401 const Position& result_end =
402 paragraph_end.IsNotNull() && paragraph_end >= range.EndPosition() 402 paragraph_end.IsNotNull() && paragraph_end >= range.EndPosition()
403 ? paragraph_end 403 ? paragraph_end
404 : range.EndPosition(); 404 : range.EndPosition();
405 return EphemeralRange(result_start, result_end); 405 return EphemeralRange(result_start, result_end);
406 } 406 }
407 407
408 } // namespace blink 408 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698