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

Side by Side Diff: Source/web/TextFinder.cpp

Issue 1231673007: Don't zoom in TextFinder if autosizing is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed frame() helper from test Created 5 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
« no previous file with comments | « Source/core/layout/TextAutosizer.cpp ('k') | Source/web/tests/TextFinderTest.cpp » ('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) 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 23 matching lines...) Expand all
34 34
35 #include "core/dom/DocumentMarker.h" 35 #include "core/dom/DocumentMarker.h"
36 #include "core/dom/DocumentMarkerController.h" 36 #include "core/dom/DocumentMarkerController.h"
37 #include "core/dom/Range.h" 37 #include "core/dom/Range.h"
38 #include "core/dom/shadow/ShadowRoot.h" 38 #include "core/dom/shadow/ShadowRoot.h"
39 #include "core/editing/Editor.h" 39 #include "core/editing/Editor.h"
40 #include "core/editing/VisibleSelection.h" 40 #include "core/editing/VisibleSelection.h"
41 #include "core/editing/iterators/CharacterIterator.h" 41 #include "core/editing/iterators/CharacterIterator.h"
42 #include "core/frame/FrameView.h" 42 #include "core/frame/FrameView.h"
43 #include "core/layout/LayoutObject.h" 43 #include "core/layout/LayoutObject.h"
44 #include "core/layout/TextAutosizer.h"
44 #include "core/page/Page.h" 45 #include "core/page/Page.h"
45 #include "modules/accessibility/AXObject.h" 46 #include "modules/accessibility/AXObject.h"
46 #include "modules/accessibility/AXObjectCacheImpl.h" 47 #include "modules/accessibility/AXObjectCacheImpl.h"
47 #include "platform/Timer.h" 48 #include "platform/Timer.h"
48 #include "public/platform/WebVector.h" 49 #include "public/platform/WebVector.h"
49 #include "public/web/WebAXObject.h" 50 #include "public/web/WebAXObject.h"
50 #include "public/web/WebFindOptions.h" 51 #include "public/web/WebFindOptions.h"
51 #include "public/web/WebFrameClient.h" 52 #include "public/web/WebFrameClient.h"
52 #include "public/web/WebViewClient.h" 53 #include "public/web/WebViewClient.h"
53 #include "web/FindInPageCoordinates.h" 54 #include "web/FindInPageCoordinates.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (!m_activeMatch) { 149 if (!m_activeMatch) {
149 // If we're finding next the next active match might not be in the curre nt frame. 150 // If we're finding next the next active match might not be in the curre nt frame.
150 // In this case we don't want to clear the matches cache. 151 // In this case we don't want to clear the matches cache.
151 if (!options.findNext) 152 if (!options.findNext)
152 clearFindMatchesCache(); 153 clearFindMatchesCache();
153 154
154 ownerFrame().frameView()->invalidatePaintForTickmarks(); 155 ownerFrame().frameView()->invalidatePaintForTickmarks();
155 return false; 156 return false;
156 } 157 }
157 158
158 #if OS(ANDROID) 159 // If the user is browsing a page with autosizing, adjust the zoom to the
159 ownerFrame().viewImpl()->zoomToFindInPageRect(ownerFrame().frameView()->cont entsToRootFrame(enclosingIntRect(LayoutObject::absoluteBoundingBoxRectForRange(m _activeMatch.get())))); 160 // column where the next hit has been found. Doing this when autosizing is
160 #endif 161 // not set will result in a zoom reset on small devices.
162 if (ownerFrame().frame()->document()->textAutosizer()->pageNeedsAutosizing() ) {
163 ownerFrame().viewImpl()->zoomToFindInPageRect(ownerFrame().frameView()-> contentsToRootFrame(enclosingIntRect(LayoutObject::absoluteBoundingBoxRectForRan ge(m_activeMatch.get()))));
164 }
161 165
162 setMarkerActive(m_activeMatch.get(), true); 166 setMarkerActive(m_activeMatch.get(), true);
163 WebLocalFrameImpl* oldActiveFrame = mainFrameImpl->ensureTextFinder().m_curr entActiveMatchFrame; 167 WebLocalFrameImpl* oldActiveFrame = mainFrameImpl->ensureTextFinder().m_curr entActiveMatchFrame;
164 mainFrameImpl->ensureTextFinder().m_currentActiveMatchFrame = &ownerFrame(); 168 mainFrameImpl->ensureTextFinder().m_currentActiveMatchFrame = &ownerFrame();
165 169
166 // Make sure no node is focused. See http://crbug.com/38700. 170 // Make sure no node is focused. See http://crbug.com/38700.
167 ownerFrame().frame()->document()->setFocusedElement(nullptr); 171 ownerFrame().frame()->document()->setFocusedElement(nullptr);
168 172
169 if (!options.findNext || activeSelection) { 173 if (!options.findNext || activeSelection) {
170 // This is either a Find operation or a Find-next from a new start point 174 // This is either a Find operation or a Find-next from a new start point
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 visitor->trace(m_ownerFrame); 794 visitor->trace(m_ownerFrame);
791 visitor->trace(m_currentActiveMatchFrame); 795 visitor->trace(m_currentActiveMatchFrame);
792 visitor->trace(m_activeMatch); 796 visitor->trace(m_activeMatch);
793 visitor->trace(m_resumeScopingFromRange); 797 visitor->trace(m_resumeScopingFromRange);
794 visitor->trace(m_deferredScopingWork); 798 visitor->trace(m_deferredScopingWork);
795 visitor->trace(m_findMatchesCache); 799 visitor->trace(m_findMatchesCache);
796 #endif 800 #endif
797 } 801 }
798 802
799 } // namespace blink 803 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/TextAutosizer.cpp ('k') | Source/web/tests/TextFinderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698