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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2385623002: Prune CreateVisibleSelectionDeprecated from web (Closed)
Patch Set: Created 4 years, 2 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 } 1667 }
1668 const EphemeralRange activeMatchRange(activeMatch); 1668 const EphemeralRange activeMatchRange(activeMatch);
1669 if (node) { 1669 if (node) {
1670 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*node)) { 1670 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*node)) {
1671 if (!runner.isElementNode()) 1671 if (!runner.isElementNode())
1672 continue; 1672 continue;
1673 Element& element = toElement(runner); 1673 Element& element = toElement(runner);
1674 if (element.isFocusable()) { 1674 if (element.isFocusable()) {
1675 // Found a focusable parent node. Set the active match as th e 1675 // Found a focusable parent node. Set the active match as th e
1676 // selection and focus to the focusable node. 1676 // selection and focus to the focusable node.
1677 frame()->selection().setSelection(createVisibleSelectionDepr ecated(activeMatchRange)); 1677 frame()->selection().setSelection(createVisibleSelection(act iveMatchRange));
1678 frame()->document()->setFocusedElement(&element, FocusParams (SelectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr)); 1678 frame()->document()->setFocusedElement(&element, FocusParams (SelectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr));
1679 return; 1679 return;
1680 } 1680 }
1681 } 1681 }
1682 } 1682 }
1683 1683
1684 // Iterate over all the nodes in the range until we find a focusable nod e. 1684 // Iterate over all the nodes in the range until we find a focusable nod e.
1685 // This, for example, sets focus to the first link if you search for 1685 // This, for example, sets focus to the first link if you search for
1686 // text and text that is within one or more links. 1686 // text and text that is within one or more links.
1687 for (Node& runner : activeMatchRange.nodes()) { 1687 for (Node& runner : activeMatchRange.nodes()) {
1688 if (!runner.isElementNode()) 1688 if (!runner.isElementNode())
1689 continue; 1689 continue;
1690 Element& element = toElement(runner); 1690 Element& element = toElement(runner);
1691 if (element.isFocusable()) { 1691 if (element.isFocusable()) {
1692 frame()->document()->setFocusedElement(&element, FocusParams(Sel ectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr)); 1692 frame()->document()->setFocusedElement(&element, FocusParams(Sel ectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr));
1693 return; 1693 return;
1694 } 1694 }
1695 } 1695 }
1696 1696
1697 // No node related to the active match was focusable, so set the 1697 // No node related to the active match was focusable, so set the
1698 // active match as the selection (so that when you end the Find session, 1698 // active match as the selection (so that when you end the Find session,
1699 // you'll have the last thing you found highlighted) and make sure that 1699 // you'll have the last thing you found highlighted) and make sure that
1700 // we have nothing focused (otherwise you might have text selected but 1700 // we have nothing focused (otherwise you might have text selected but
1701 // a link focused, which is weird). 1701 // a link focused, which is weird).
1702 frame()->selection().setSelection(createVisibleSelectionDeprecated(activ eMatchRange)); 1702 frame()->selection().setSelection(createVisibleSelection(activeMatchRang e));
1703 frame()->document()->clearFocusedElement(); 1703 frame()->document()->clearFocusedElement();
1704 1704
1705 // Finally clear the active match, for two reasons: 1705 // Finally clear the active match, for two reasons:
1706 // We just finished the find 'session' and we don't want future (potenti ally 1706 // We just finished the find 'session' and we don't want future (potenti ally
1707 // unrelated) find 'sessions' operations to start at the same place. 1707 // unrelated) find 'sessions' operations to start at the same place.
1708 // The WebLocalFrameImpl could get reused and the activeMatch could end up pointing 1708 // The WebLocalFrameImpl could get reused and the activeMatch could end up pointing
1709 // to a document that is no longer valid. Keeping an invalid reference a round 1709 // to a document that is no longer valid. Keeping an invalid reference a round
1710 // is just asking for trouble. 1710 // is just asking for trouble.
1711 m_textFinder->resetActiveMatch(); 1711 m_textFinder->resetActiveMatch();
1712 } 1712 }
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; 2246 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol;
2247 } else if (metric == "wasAlternateProtocolAvailable") { 2247 } else if (metric == "wasAlternateProtocolAvailable") {
2248 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; 2248 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable;
2249 } else if (metric == "connectionInfo") { 2249 } else if (metric == "connectionInfo") {
2250 feature = UseCounter::ChromeLoadTimesConnectionInfo; 2250 feature = UseCounter::ChromeLoadTimesConnectionInfo;
2251 } 2251 }
2252 UseCounter::count(frame(), feature); 2252 UseCounter::count(frame(), feature);
2253 } 2253 }
2254 2254
2255 } // namespace blink 2255 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698