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

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

Issue 2962473002: Make Position::LastPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-26T14:00:00 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, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple 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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 SplitTextNode(text, end.OffsetInContainerNode()); 1566 SplitTextNode(text, end.OffsetInContainerNode());
1567 1567
1568 Node* prev_node = text->previousSibling(); 1568 Node* prev_node = text->previousSibling();
1569 if (!prev_node || !prev_node->IsTextNode()) 1569 if (!prev_node || !prev_node->IsTextNode())
1570 return; 1570 return;
1571 1571
1572 Position new_start = 1572 Position new_start =
1573 should_update_start 1573 should_update_start
1574 ? Position(ToText(prev_node), start.OffsetInContainerNode()) 1574 ? Position(ToText(prev_node), start.OffsetInContainerNode())
1575 : start; 1575 : start;
1576 UpdateStartEnd(new_start, Position::LastPositionInNode(prev_node)); 1576 UpdateStartEnd(new_start, Position::LastPositionInNode(*prev_node));
1577 } 1577 }
1578 1578
1579 void ApplyStyleCommand::SplitTextElementAtStart(const Position& start, 1579 void ApplyStyleCommand::SplitTextElementAtStart(const Position& start,
1580 const Position& end) { 1580 const Position& end) {
1581 DCHECK(start.ComputeContainerNode()->IsTextNode()) << start; 1581 DCHECK(start.ComputeContainerNode()->IsTextNode()) << start;
1582 1582
1583 Position new_end; 1583 Position new_end;
1584 if (start.ComputeContainerNode() == end.ComputeContainerNode()) 1584 if (start.ComputeContainerNode() == end.ComputeContainerNode())
1585 new_end = 1585 new_end =
1586 Position(end.ComputeContainerNode(), 1586 Position(end.ComputeContainerNode(),
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 2046
2047 DEFINE_TRACE(ApplyStyleCommand) { 2047 DEFINE_TRACE(ApplyStyleCommand) {
2048 visitor->Trace(style_); 2048 visitor->Trace(style_);
2049 visitor->Trace(start_); 2049 visitor->Trace(start_);
2050 visitor->Trace(end_); 2050 visitor->Trace(end_);
2051 visitor->Trace(styled_inline_element_); 2051 visitor->Trace(styled_inline_element_);
2052 CompositeEditCommand::Trace(visitor); 2052 CompositeEditCommand::Trace(visitor);
2053 } 2053 }
2054 2054
2055 } // namespace blink 2055 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698