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

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

Issue 2952983002: Make Position::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-23T10:37:43 Created 3 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) 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const PositionWithAffinityTemplate<Strategy>& c) { 352 const PositionWithAffinityTemplate<Strategy>& c) {
353 // TODO: this is the current behavior that might need to be fixed. 353 // TODO: this is the current behavior that might need to be fixed.
354 // Please refer to https://bugs.webkit.org/show_bug.cgi?id=49107 for detail. 354 // Please refer to https://bugs.webkit.org/show_bug.cgi?id=49107 for detail.
355 PositionWithAffinityTemplate<Strategy> vis_pos = 355 PositionWithAffinityTemplate<Strategy> vis_pos =
356 StartPositionForLine(c, kUseLogicalOrdering); 356 StartPositionForLine(c, kUseLogicalOrdering);
357 357
358 if (ContainerNode* editable_root = HighestEditableRoot(c.GetPosition())) { 358 if (ContainerNode* editable_root = HighestEditableRoot(c.GetPosition())) {
359 if (!editable_root->contains( 359 if (!editable_root->contains(
360 vis_pos.GetPosition().ComputeContainerNode())) { 360 vis_pos.GetPosition().ComputeContainerNode())) {
361 return PositionWithAffinityTemplate<Strategy>( 361 return PositionWithAffinityTemplate<Strategy>(
362 PositionTemplate<Strategy>::FirstPositionInNode(editable_root)); 362 PositionTemplate<Strategy>::FirstPositionInNode(*editable_root));
363 } 363 }
364 } 364 }
365 365
366 return HonorEditingBoundaryAtOrBefore(vis_pos, c.GetPosition()); 366 return HonorEditingBoundaryAtOrBefore(vis_pos, c.GetPosition());
367 } 367 }
368 368
369 VisiblePosition LogicalStartOfLine(const VisiblePosition& current_position) { 369 VisiblePosition LogicalStartOfLine(const VisiblePosition& current_position) {
370 DCHECK(current_position.IsValid()) << current_position; 370 DCHECK(current_position.IsValid()) << current_position;
371 return CreateVisiblePosition(LogicalStartOfLineAlgorithm<EditingStrategy>( 371 return CreateVisiblePosition(LogicalStartOfLineAlgorithm<EditingStrategy>(
372 current_position.ToPositionWithAffinity())); 372 current_position.ToPositionWithAffinity()));
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 // to the end of the line we're on. 747 // to the end of the line we're on.
748 Element* root_element = HasEditableStyle(*node, editable_type) 748 Element* root_element = HasEditableStyle(*node, editable_type)
749 ? RootEditableElement(*node, editable_type) 749 ? RootEditableElement(*node, editable_type)
750 : node->GetDocument().documentElement(); 750 : node->GetDocument().documentElement();
751 if (!root_element) 751 if (!root_element)
752 return VisiblePosition(); 752 return VisiblePosition();
753 return VisiblePosition::LastPositionInNode(root_element); 753 return VisiblePosition::LastPositionInNode(root_element);
754 } 754 }
755 755
756 } // namespace blink 756 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698