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

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

Issue 1318183002: Move global function intersectsNode() to local function in FrameSelection.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T10:16:38 Created 5 years, 3 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 | « no previous file | Source/core/editing/VisibleSelection.h » ('j') | 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) 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 { 353 {
354 // There can't be a selection inside a fragment, so if a fragment's node is being removed, 354 // There can't be a selection inside a fragment, so if a fragment's node is being removed,
355 // the selection in the document that created the fragment needs no adjustme nt. 355 // the selection in the document that created the fragment needs no adjustme nt.
356 if (isNone() || !node.inActiveDocument()) 356 if (isNone() || !node.inActiveDocument())
357 return; 357 return;
358 358
359 respondToNodeModification(node, removingNodeRemovesPosition(node, m_selectio n.base()), removingNodeRemovesPosition(node, m_selection.extent()), 359 respondToNodeModification(node, removingNodeRemovesPosition(node, m_selectio n.base()), removingNodeRemovesPosition(node, m_selection.extent()),
360 removingNodeRemovesPosition(node, m_selection.start()), removingNodeRemo vesPosition(node, m_selection.end())); 360 removingNodeRemovesPosition(node, m_selection.start()), removingNodeRemo vesPosition(node, m_selection.end()));
361 } 361 }
362 362
363 static bool intersectsNode(const VisibleSelection& selection, Node* node)
364 {
365 if (selection.isNone())
366 return false;
367 Position start = selection.start().parentAnchoredEquivalent();
368 Position end = selection.end().parentAnchoredEquivalent();
369 TrackExceptionState exceptionState;
370 // TODO(yosin) We should avoid to use |Range::intersectsNode()|.
371 return Range::intersectsNode(node, start, end, exceptionState) && !exception State.hadException();
372 }
373
363 void FrameSelection::respondToNodeModification(Node& node, bool baseRemoved, boo l extentRemoved, bool startRemoved, bool endRemoved) 374 void FrameSelection::respondToNodeModification(Node& node, bool baseRemoved, boo l extentRemoved, bool startRemoved, bool endRemoved)
364 { 375 {
365 ASSERT(node.document().isActive()); 376 ASSERT(node.document().isActive());
366 377
367 bool clearLayoutTreeSelection = false; 378 bool clearLayoutTreeSelection = false;
368 bool clearDOMTreeSelection = false; 379 bool clearDOMTreeSelection = false;
369 380
370 if (startRemoved || endRemoved) { 381 if (startRemoved || endRemoved) {
371 Position start = m_selection.start(); 382 Position start = m_selection.start();
372 Position end = m_selection.end(); 383 Position end = m_selection.end();
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 2069
2059 void showTree(const blink::FrameSelection* sel) 2070 void showTree(const blink::FrameSelection* sel)
2060 { 2071 {
2061 if (sel) 2072 if (sel)
2062 sel->showTreeForThis(); 2073 sel->showTreeForThis();
2063 else 2074 else
2064 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); 2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n");
2065 } 2076 }
2066 2077
2067 #endif 2078 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698