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

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

Issue 2144673003: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in SearchBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback addressed. Created 4 years, 5 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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider); 1955 UseCounter::count(frame(), UseCounter::ExternalAddSearchProvider);
1956 } 1956 }
1957 1957
1958 void WebLocalFrameImpl::didCallIsSearchProviderInstalled() 1958 void WebLocalFrameImpl::didCallIsSearchProviderInstalled()
1959 { 1959 {
1960 UseCounter::count(frame(), UseCounter::ExternalIsSearchProviderInstalled); 1960 UseCounter::count(frame(), UseCounter::ExternalIsSearchProviderInstalled);
1961 } 1961 }
1962 1962
1963 bool WebLocalFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect, bool* act iveNow) 1963 bool WebLocalFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect, bool* act iveNow)
1964 { 1964 {
1965 if (!frame())
1966 return false;
1967
1968 // Unlikely, but just in case we try to find-in-page on a detached frame.
1969 DCHECK(frame()->host());
1970
1965 // Search for an active match only if this frame is focused or if this is a 1971 // Search for an active match only if this frame is focused or if this is a
1966 // find next request. 1972 // find next request.
1967 if (isFocused() || options.findNext) 1973 if (!isFocused() && !options.findNext)
1968 return ensureTextFinder().find(identifier, searchText, options, wrapWith inFrame, selectionRect, activeNow); 1974 return false;
1969 1975
1970 return false; 1976 // Up-to-date, clean tree is required for finding text in page, since it rel ies
1977 // on TextIterator to look over the text.
1978 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1979
1980 return ensureTextFinder().find(identifier, searchText, options, wrapWithinFr ame, selectionRect, activeNow);
1971 } 1981 }
1972 1982
1973 void WebLocalFrameImpl::stopFinding(StopFindAction action) 1983 void WebLocalFrameImpl::stopFinding(StopFindAction action)
1974 { 1984 {
1975 bool clearSelection = action == StopFindActionClearSelection; 1985 bool clearSelection = action == StopFindActionClearSelection;
1976 if (clearSelection) 1986 if (clearSelection)
1977 executeCommand(WebString::fromUTF8("Unselect")); 1987 executeCommand(WebString::fromUTF8("Unselect"));
1978 1988
1979 if (m_textFinder) { 1989 if (m_textFinder) {
1980 if (!clearSelection) 1990 if (!clearSelection)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 { 2154 {
2145 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2155 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2146 } 2156 }
2147 2157
2148 void WebLocalFrameImpl::clearActiveFindMatch() 2158 void WebLocalFrameImpl::clearActiveFindMatch()
2149 { 2159 {
2150 ensureTextFinder().clearActiveFindMatch(); 2160 ensureTextFinder().clearActiveFindMatch();
2151 } 2161 }
2152 2162
2153 } // namespace blink 2163 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/TextFinder.cpp ('k') | third_party/WebKit/Source/web/tests/TextFinderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698