OLD | NEW |
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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 continue; | 1760 continue; |
1761 Element& element = toElement(runner); | 1761 Element& element = toElement(runner); |
1762 if (element.isFocusable()) { | 1762 if (element.isFocusable()) { |
1763 // Found a focusable parent node. Set the active match as the | 1763 // Found a focusable parent node. Set the active match as the |
1764 // selection and focus to the focusable node. | 1764 // selection and focus to the focusable node. |
1765 frame()->selection().setSelection( | 1765 frame()->selection().setSelection( |
1766 SelectionInDOMTree::Builder() | 1766 SelectionInDOMTree::Builder() |
1767 .setBaseAndExtent(activeMatchRange) | 1767 .setBaseAndExtent(activeMatchRange) |
1768 .build()); | 1768 .build()); |
1769 frame()->document()->setFocusedElement( | 1769 frame()->document()->setFocusedElement( |
1770 &element, FocusParams(SelectionBehaviorOnFocus::None, | 1770 &element, |
1771 WebFocusTypeNone, nullptr)); | 1771 FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, |
| 1772 InputDeviceCapabilities::Null)); |
1772 return; | 1773 return; |
1773 } | 1774 } |
1774 } | 1775 } |
1775 } | 1776 } |
1776 | 1777 |
1777 // Iterate over all the nodes in the range until we find a focusable node. | 1778 // Iterate over all the nodes in the range until we find a focusable node. |
1778 // This, for example, sets focus to the first link if you search for | 1779 // This, for example, sets focus to the first link if you search for |
1779 // text and text that is within one or more links. | 1780 // text and text that is within one or more links. |
1780 for (Node& runner : activeMatchRange.nodes()) { | 1781 for (Node& runner : activeMatchRange.nodes()) { |
1781 if (!runner.isElementNode()) | 1782 if (!runner.isElementNode()) |
1782 continue; | 1783 continue; |
1783 Element& element = toElement(runner); | 1784 Element& element = toElement(runner); |
1784 if (element.isFocusable()) { | 1785 if (element.isFocusable()) { |
1785 frame()->document()->setFocusedElement( | 1786 frame()->document()->setFocusedElement( |
1786 &element, FocusParams(SelectionBehaviorOnFocus::None, | 1787 &element, |
1787 WebFocusTypeNone, nullptr)); | 1788 FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, |
| 1789 InputDeviceCapabilities::Null)); |
1788 return; | 1790 return; |
1789 } | 1791 } |
1790 } | 1792 } |
1791 | 1793 |
1792 // No node related to the active match was focusable, so set the | 1794 // No node related to the active match was focusable, so set the |
1793 // active match as the selection (so that when you end the Find session, | 1795 // active match as the selection (so that when you end the Find session, |
1794 // you'll have the last thing you found highlighted) and make sure that | 1796 // you'll have the last thing you found highlighted) and make sure that |
1795 // we have nothing focused (otherwise you might have text selected but | 1797 // we have nothing focused (otherwise you might have text selected but |
1796 // a link focused, which is weird). | 1798 // a link focused, which is weird). |
1797 frame()->selection().setSelection(SelectionInDOMTree::Builder() | 1799 frame()->selection().setSelection(SelectionInDOMTree::Builder() |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2412 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
2411 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2413 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2412 } else { | 2414 } else { |
2413 clipHtml = | 2415 clipHtml = |
2414 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2416 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
2415 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2417 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2416 } | 2418 } |
2417 } | 2419 } |
2418 | 2420 |
2419 } // namespace blink | 2421 } // namespace blink |
OLD | NEW |