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

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

Issue 2952983002: Make Position::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-23T10:37:43 Created 3 years, 6 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) 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 ? GetDocument().FocusedElement() 441 ? GetDocument().FocusedElement()
442 : GetDocument().documentElement(); 442 : GetDocument().documentElement();
443 if (!focused_element) 443 if (!focused_element)
444 return false; 444 return false;
445 445
446 if (focused_element->IsTextControl()) 446 if (focused_element->IsTextControl())
447 return focused_element->ContainsIncludingHostElements(*current); 447 return focused_element->ContainsIncludingHostElements(*current);
448 448
449 // Selection has focus if it contains the focused element. 449 // Selection has focus if it contains the focused element.
450 const PositionInFlatTree& focused_position = 450 const PositionInFlatTree& focused_position =
451 PositionInFlatTree::FirstPositionInNode(focused_element); 451 PositionInFlatTree::FirstPositionInNode(*focused_element);
452 if (ComputeVisibleSelectionInFlatTree().Start() <= focused_position && 452 if (ComputeVisibleSelectionInFlatTree().Start() <= focused_position &&
453 ComputeVisibleSelectionInFlatTree().End() >= focused_position) 453 ComputeVisibleSelectionInFlatTree().End() >= focused_position)
454 return true; 454 return true;
455 455
456 bool has_editable_style = HasEditableStyle(*current); 456 bool has_editable_style = HasEditableStyle(*current);
457 do { 457 do {
458 // If the selection is within an editable sub tree and that sub tree 458 // If the selection is within an editable sub tree and that sub tree
459 // doesn't have focus, the selection doesn't have focus either. 459 // doesn't have focus, the selection doesn't have focus either.
460 if (has_editable_style && !HasEditableStyle(*current)) 460 if (has_editable_style && !HasEditableStyle(*current))
461 return false; 461 return false;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 } 1182 }
1183 1183
1184 void showTree(const blink::FrameSelection* sel) { 1184 void showTree(const blink::FrameSelection* sel) {
1185 if (sel) 1185 if (sel)
1186 sel->ShowTreeForThis(); 1186 sel->ShowTreeForThis();
1187 else 1187 else
1188 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1188 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1189 } 1189 }
1190 1190
1191 #endif 1191 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EphemeralRange.cpp ('k') | third_party/WebKit/Source/core/editing/Position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698