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

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

Issue 2451613003: Get rid of createVisibleSelection() taking two Position (Closed)
Patch Set: 2016-10-26T15:09:55 Created 4 years, 1 month 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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 TextAffinity affinity, 1021 TextAffinity affinity,
1022 SelectionDirectionalMode directional, 1022 SelectionDirectionalMode directional,
1023 SetSelectionOptions options) { 1023 SetSelectionOptions options) {
1024 if (range.isNull()) 1024 if (range.isNull())
1025 return false; 1025 return false;
1026 m_selectionEditor->resetLogicalRange(); 1026 m_selectionEditor->resetLogicalRange();
1027 // Since |FrameSeleciton::setSelection()| dispatches events and DOM tree 1027 // Since |FrameSeleciton::setSelection()| dispatches events and DOM tree
1028 // can be modified by event handlers, we should create |Range| object before 1028 // can be modified by event handlers, we should create |Range| object before
1029 // calling it. 1029 // calling it.
1030 Range* logicalRange = createRange(range); 1030 Range* logicalRange = createRange(range);
1031 VisibleSelection newSelection = createVisibleSelection( 1031 setSelection(SelectionInDOMTree::Builder()
1032 range.startPosition(), range.endPosition(), affinity, 1032 .setBaseAndExtent(range)
1033 directional == SelectionDirectionalMode::Directional); 1033 .setAffinity(affinity)
1034 setSelection(newSelection, options); 1034 .setIsDirectional(directional ==
1035 SelectionDirectionalMode::Directional)
1036 .build(),
1037 options);
1035 m_selectionEditor->setLogicalRange(logicalRange); 1038 m_selectionEditor->setLogicalRange(logicalRange);
1036 return true; 1039 return true;
1037 } 1040 }
1038 1041
1039 Range* FrameSelection::firstRange() const { 1042 Range* FrameSelection::firstRange() const {
1040 return m_selectionEditor->firstRange(); 1043 return m_selectionEditor->firstRange();
1041 } 1044 }
1042 1045
1043 bool FrameSelection::isInPasswordField() const { 1046 bool FrameSelection::isInPasswordField() const {
1044 HTMLTextFormControlElement* textControl = enclosingTextFormControl(start()); 1047 HTMLTextFormControlElement* textControl = enclosingTextFormControl(start());
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 } 1507 }
1505 1508
1506 void showTree(const blink::FrameSelection* sel) { 1509 void showTree(const blink::FrameSelection* sel) {
1507 if (sel) 1510 if (sel)
1508 sel->showTreeForThis(); 1511 sel->showTreeForThis();
1509 else 1512 else
1510 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1513 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1511 } 1514 }
1512 1515
1513 #endif 1516 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698