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

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

Issue 2955823002: Make VisiblePosition::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-26T17:50:06 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) 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 cached_selection_end_ != end || 452 cached_selection_end_ != end ||
453 cached_selection_direction_ != direction; 453 cached_selection_direction_ != direction;
454 cached_selection_start_ = start; 454 cached_selection_start_ = start;
455 cached_selection_end_ = end; 455 cached_selection_end_ = end;
456 cached_selection_direction_ = direction; 456 cached_selection_direction_ = direction;
457 return did_change; 457 return did_change;
458 } 458 }
459 459
460 VisiblePosition TextControlElement::VisiblePositionForIndex(int index) const { 460 VisiblePosition TextControlElement::VisiblePositionForIndex(int index) const {
461 if (index <= 0) 461 if (index <= 0)
462 return VisiblePosition::FirstPositionInNode(InnerEditorElement()); 462 return VisiblePosition::FirstPositionInNode(*InnerEditorElement());
463 Position start, end; 463 Position start, end;
464 bool selected = Range::selectNodeContents(InnerEditorElement(), start, end); 464 bool selected = Range::selectNodeContents(InnerEditorElement(), start, end);
465 if (!selected) 465 if (!selected)
466 return VisiblePosition(); 466 return VisiblePosition();
467 CharacterIterator it(start, end); 467 CharacterIterator it(start, end);
468 it.Advance(index - 1); 468 it.Advance(index - 1);
469 return CreateVisiblePosition(it.EndPosition(), TextAffinity::kUpstream); 469 return CreateVisiblePosition(it.EndPosition(), TextAffinity::kUpstream);
470 } 470 }
471 471
472 // TODO(yosin): We should move |TextControlElement::indexForVisiblePosition()| 472 // TODO(yosin): We should move |TextControlElement::indexForVisiblePosition()|
(...skipping 498 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

Powered by Google App Engine
This is Rietveld 408576698