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

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

Issue 2955823002: Make VisiblePosition::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-26T13:57:23 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 28 matching lines...) Expand all
39 #include "core/html/HTMLBRElement.h" 39 #include "core/html/HTMLBRElement.h"
40 #include "core/html/HTMLInputElement.h" 40 #include "core/html/HTMLInputElement.h"
41 #include "core/html/HTMLStyleElement.h" 41 #include "core/html/HTMLStyleElement.h"
42 #include "core/html/HTMLTableRowElement.h" 42 #include "core/html/HTMLTableRowElement.h"
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) {
tkent 2017/06/26 08:08:22 Please make the |cell| argument |Node&|, or add |D
yosin_UTC9 2017/06/26 08:53:52 Done.
50 DCHECK(IsTableCell(cell)) << cell; 50 DCHECK(IsTableCell(cell)) << cell;
51 return VisiblePosition::FirstPositionInNode(cell).DeepEquivalent() == 51 return VisiblePosition::FirstPositionInNode(*cell).DeepEquivalent() ==
52 VisiblePosition::LastPositionInNode(cell).DeepEquivalent(); 52 VisiblePosition::LastPositionInNode(cell).DeepEquivalent();
53 } 53 }
54 54
55 static bool IsTableRowEmpty(Node* row) { 55 static bool IsTableRowEmpty(Node* row) {
56 if (!isHTMLTableRowElement(row)) 56 if (!isHTMLTableRowElement(row))
57 return false; 57 return false;
58 58
59 row->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 59 row->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
60 for (Node* child = row->firstChild(); child; child = child->nextSibling()) { 60 for (Node* child = row->firstChild(); child; child = child->nextSibling()) {
61 if (IsTableCell(child) && !IsTableCellEmpty(child)) 61 if (IsTableCell(child) && !IsTableCellEmpty(child))
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 Position first_editable_position = FirstEditablePositionInNode(node); 506 Position first_editable_position = FirstEditablePositionInNode(node);
507 if (first_editable_position.IsNotNull()) 507 if (first_editable_position.IsNotNull())
508 InsertBlockPlaceholder(first_editable_position, editing_state); 508 InsertBlockPlaceholder(first_editable_position, editing_state);
509 } 509 }
510 return; 510 return;
511 } 511 }
512 512
513 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 513 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
514 if (node == start_block_) { 514 if (node == start_block_) {
515 VisiblePosition previous = PreviousPositionOf( 515 VisiblePosition previous = PreviousPositionOf(
516 VisiblePosition::FirstPositionInNode(start_block_.Get())); 516 VisiblePosition::FirstPositionInNode(*start_block_.Get()));
517 if (previous.IsNotNull() && !IsEndOfBlock(previous)) 517 if (previous.IsNotNull() && !IsEndOfBlock(previous))
518 need_placeholder_ = true; 518 need_placeholder_ = true;
519 } 519 }
520 if (node == end_block_) { 520 if (node == end_block_) {
521 VisiblePosition next = 521 VisiblePosition next =
522 NextPositionOf(VisiblePosition::LastPositionInNode(end_block_.Get())); 522 NextPositionOf(VisiblePosition::LastPositionInNode(end_block_.Get()));
523 if (next.IsNotNull() && !IsStartOfBlock(next)) 523 if (next.IsNotNull() && !IsStartOfBlock(next))
524 need_placeholder_ = true; 524 need_placeholder_ = true;
525 } 525 }
526 526
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 visitor->Trace(delete_into_blockquote_style_); 1247 visitor->Trace(delete_into_blockquote_style_);
1248 visitor->Trace(start_root_); 1248 visitor->Trace(start_root_);
1249 visitor->Trace(end_root_); 1249 visitor->Trace(end_root_);
1250 visitor->Trace(start_table_row_); 1250 visitor->Trace(start_table_row_);
1251 visitor->Trace(end_table_row_); 1251 visitor->Trace(end_table_row_);
1252 visitor->Trace(temporary_placeholder_); 1252 visitor->Trace(temporary_placeholder_);
1253 CompositeEditCommand::Trace(visitor); 1253 CompositeEditCommand::Trace(visitor);
1254 } 1254 }
1255 1255
1256 } // namespace blink 1256 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698