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

Side by Side Diff: third_party/WebKit/Source/core/html/TextControlElement.cpp

Issue 2958523002: Make Position::LastOffsetInNode() to take const Node& (Closed)
Patch Set: 2017-06-23T18:50:42 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 .SetIsDirectional(selectionDirection() != "none") 623 .SetIsDirectional(selectionDirection() != "none")
624 .Build(); 624 .Build();
625 } 625 }
626 626
627 int offset = 0; 627 int offset = 0;
628 Node* start_node = 0; 628 Node* start_node = 0;
629 Node* end_node = 0; 629 Node* end_node = 0;
630 for (Node& node : NodeTraversal::DescendantsOf(*inner_text)) { 630 for (Node& node : NodeTraversal::DescendantsOf(*inner_text)) {
631 DCHECK(!node.hasChildren()); 631 DCHECK(!node.hasChildren());
632 DCHECK(node.IsTextNode() || isHTMLBRElement(node)); 632 DCHECK(node.IsTextNode() || isHTMLBRElement(node));
633 int length = node.IsTextNode() ? Position::LastOffsetInNode(&node) : 1; 633 int length = node.IsTextNode() ? Position::LastOffsetInNode(node) : 1;
634 634
635 if (offset <= start && start <= offset + length) 635 if (offset <= start && start <= offset + length)
636 SetContainerAndOffsetForRange(&node, start - offset, start_node, start); 636 SetContainerAndOffsetForRange(&node, start - offset, start_node, start);
637 637
638 if (offset <= end && end <= offset + length) { 638 if (offset <= end && end <= offset + length) {
639 SetContainerAndOffsetForRange(&node, end - offset, end_node, end); 639 SetContainerAndOffsetForRange(&node, end - offset, end_node, end);
640 break; 640 break;
641 } 641 }
642 642
643 offset += length; 643 offset += length;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 971
972 void TextControlElement::CopyNonAttributePropertiesFromElement( 972 void TextControlElement::CopyNonAttributePropertiesFromElement(
973 const Element& source) { 973 const Element& source) {
974 const TextControlElement& source_element = 974 const TextControlElement& source_element =
975 static_cast<const TextControlElement&>(source); 975 static_cast<const TextControlElement&>(source);
976 last_change_was_user_edit_ = source_element.last_change_was_user_edit_; 976 last_change_was_user_edit_ = source_element.last_change_was_user_edit_;
977 HTMLFormControlElement::CopyNonAttributePropertiesFromElement(source); 977 HTMLFormControlElement::CopyNonAttributePropertiesFromElement(source);
978 } 978 }
979 979
980 } // namespace blink 980 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698