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

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

Issue 2957833004: Make VisiblePosition::LastPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-27T15:28:02 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) 2005 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/layout/LayoutTableCell.h" 43 #include "core/layout/LayoutTableCell.h"
44 44
45 namespace blink { 45 namespace blink {
46 46
47 using namespace HTMLNames; 47 using namespace HTMLNames;
48 48
49 static bool IsTableCellEmpty(Node* cell) { 49 static bool IsTableCellEmpty(Node* cell) {
50 DCHECK(cell); 50 DCHECK(cell);
51 DCHECK(IsTableCell(cell)) << cell; 51 DCHECK(IsTableCell(cell)) << cell;
52 return VisiblePosition::FirstPositionInNode(*cell).DeepEquivalent() == 52 return VisiblePosition::FirstPositionInNode(*cell).DeepEquivalent() ==
53 VisiblePosition::LastPositionInNode(cell).DeepEquivalent(); 53 VisiblePosition::LastPositionInNode(*cell).DeepEquivalent();
54 } 54 }
55 55
56 static bool IsTableRowEmpty(Node* row) { 56 static bool IsTableRowEmpty(Node* row) {
57 if (!isHTMLTableRowElement(row)) 57 if (!isHTMLTableRowElement(row))
58 return false; 58 return false;
59 59
60 row->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 60 row->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
61 for (Node* child = row->firstChild(); child; child = child->nextSibling()) { 61 for (Node* child = row->firstChild(); child; child = child->nextSibling()) {
62 if (IsTableCell(child) && !IsTableCellEmpty(child)) 62 if (IsTableCell(child) && !IsTableCellEmpty(child))
63 return false; 63 return false;
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 513
514 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 514 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
515 if (node == start_block_) { 515 if (node == start_block_) {
516 VisiblePosition previous = PreviousPositionOf( 516 VisiblePosition previous = PreviousPositionOf(
517 VisiblePosition::FirstPositionInNode(*start_block_.Get())); 517 VisiblePosition::FirstPositionInNode(*start_block_.Get()));
518 if (previous.IsNotNull() && !IsEndOfBlock(previous)) 518 if (previous.IsNotNull() && !IsEndOfBlock(previous))
519 need_placeholder_ = true; 519 need_placeholder_ = true;
520 } 520 }
521 if (node == end_block_) { 521 if (node == end_block_) {
522 VisiblePosition next = 522 VisiblePosition next =
523 NextPositionOf(VisiblePosition::LastPositionInNode(end_block_.Get())); 523 NextPositionOf(VisiblePosition::LastPositionInNode(*end_block_.Get()));
524 if (next.IsNotNull() && !IsStartOfBlock(next)) 524 if (next.IsNotNull() && !IsStartOfBlock(next))
525 need_placeholder_ = true; 525 need_placeholder_ = true;
526 } 526 }
527 527
528 // FIXME: Update the endpoints of the range being deleted. 528 // FIXME: Update the endpoints of the range being deleted.
529 ending_position_ = ComputePositionForNodeRemoval(ending_position_, *node); 529 ending_position_ = ComputePositionForNodeRemoval(ending_position_, *node);
530 leading_whitespace_ = 530 leading_whitespace_ =
531 ComputePositionForNodeRemoval(leading_whitespace_, *node); 531 ComputePositionForNodeRemoval(leading_whitespace_, *node);
532 trailing_whitespace_ = 532 trailing_whitespace_ =
533 ComputePositionForNodeRemoval(trailing_whitespace_, *node); 533 ComputePositionForNodeRemoval(trailing_whitespace_, *node);
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 visitor->Trace(delete_into_blockquote_style_); 1248 visitor->Trace(delete_into_blockquote_style_);
1249 visitor->Trace(start_root_); 1249 visitor->Trace(start_root_);
1250 visitor->Trace(end_root_); 1250 visitor->Trace(end_root_);
1251 visitor->Trace(start_table_row_); 1251 visitor->Trace(start_table_row_);
1252 visitor->Trace(end_table_row_); 1252 visitor->Trace(end_table_row_);
1253 visitor->Trace(temporary_placeholder_); 1253 visitor->Trace(temporary_placeholder_);
1254 CompositeEditCommand::Trace(visitor); 1254 CompositeEditCommand::Trace(visitor);
1255 } 1255 }
1256 1256
1257 } // namespace blink 1257 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698