Chromium Code Reviews| 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 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1953 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); | 1953 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); |
| 1954 } | 1954 } |
| 1955 | 1955 |
| 1956 void WebLocalFrameImpl::didCallIsSearchProviderInstalled() | 1956 void WebLocalFrameImpl::didCallIsSearchProviderInstalled() |
| 1957 { | 1957 { |
| 1958 UseCounter::count(frame(), UseCounter::ExternalIsSearchProviderInstalled); | 1958 UseCounter::count(frame(), UseCounter::ExternalIsSearchProviderInstalled); |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 bool WebLocalFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect, bool* act iveNow) | 1961 bool WebLocalFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect, bool* act iveNow) |
| 1962 { | 1962 { |
| 1963 // TODO(dglazkov): This is a bit silly, since isFocused asks the same questi ons, but we'll keep it here | |
| 1964 // to make the next condition less tangled. | |
| 1965 if (!frame() || !frame()->page()) | |
|
esprehn
2016/07/22 05:57:10
I wonder how you get a frame without a page? Is th
dglazkov
2016/07/22 16:40:50
I think that check it bogus. The only time you hav
| |
| 1966 return false; | |
| 1967 | |
| 1963 // Search for an active match only if this frame is focused or if this is a | 1968 // Search for an active match only if this frame is focused or if this is a |
| 1964 // find next request. | 1969 // find next request. |
| 1965 if (isFocused() || options.findNext) | 1970 if (!isFocused() && !options.findNext) |
| 1966 return ensureTextFinder().find(identifier, searchText, options, wrapWith inFrame, selectionRect, activeNow); | 1971 return false; |
| 1967 | 1972 |
| 1968 return false; | 1973 // Up-to-date, clean tree is required for finding text in page, since it rel ies |
| 1974 // on TextIterator to look over the text. | |
| 1975 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | |
| 1976 | |
| 1977 return ensureTextFinder().find(identifier, searchText, options, wrapWithinFr ame, selectionRect, activeNow); | |
| 1969 } | 1978 } |
| 1970 | 1979 |
| 1971 void WebLocalFrameImpl::stopFinding(StopFindAction action) | 1980 void WebLocalFrameImpl::stopFinding(StopFindAction action) |
| 1972 { | 1981 { |
| 1973 bool clearSelection = action == StopFindActionClearSelection; | 1982 bool clearSelection = action == StopFindActionClearSelection; |
| 1974 if (clearSelection) | 1983 if (clearSelection) |
| 1975 executeCommand(WebString::fromUTF8("Unselect")); | 1984 executeCommand(WebString::fromUTF8("Unselect")); |
| 1976 | 1985 |
| 1977 if (m_textFinder) { | 1986 if (m_textFinder) { |
| 1978 if (!clearSelection) | 1987 if (!clearSelection) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2142 { | 2151 { |
| 2143 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2152 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
| 2144 } | 2153 } |
| 2145 | 2154 |
| 2146 void WebLocalFrameImpl::clearActiveFindMatch() | 2155 void WebLocalFrameImpl::clearActiveFindMatch() |
| 2147 { | 2156 { |
| 2148 ensureTextFinder().clearActiveFindMatch(); | 2157 ensureTextFinder().clearActiveFindMatch(); |
| 2149 } | 2158 } |
| 2150 | 2159 |
| 2151 } // namespace blink | 2160 } // namespace blink |
| OLD | NEW |