Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/find_bar_host.h" | 5 #include "chrome/browser/ui/views/find_bar_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 base::string16 FindBarHost::GetFindText() { | 134 base::string16 FindBarHost::GetFindText() { |
| 135 return find_bar_view()->GetFindText(); | 135 return find_bar_view()->GetFindText(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 gfx::Range FindBarHost::GetSelectedRange() { | 138 gfx::Range FindBarHost::GetSelectedRange() { |
| 139 return find_bar_view()->GetSelectedRange(); | 139 return find_bar_view()->GetSelectedRange(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void FindBarHost::UpdateUIForFindResult(const FindNotificationDetails& result, | 142 void FindBarHost::UpdateUIForFindResult(const FindNotificationDetails& result, |
| 143 const base::string16& find_text) { | 143 const base::string16& find_text) { |
| 144 // Make sure match count is clear. It may get set again in UpdateForResult | |
| 145 // if enough data is available. | |
| 146 find_bar_view()->ClearMatchCount(); | |
| 147 | |
| 148 if (!find_text.empty()) | 144 if (!find_text.empty()) |
| 149 find_bar_view()->UpdateForResult(result, find_text); | 145 find_bar_view()->UpdateForResult(result, find_text); |
| 146 else | |
| 147 find_bar_view()->ClearMatchCount(); | |
|
msw
2016/03/14 17:30:10
AFAICT, the regression was just from FindBarView::
Mario Pistrich
2016/03/14 17:52:46
Reverting only the change of && -> || would reintr
msw
2016/03/14 18:10:32
Okay, that's reasonable; thanks for the fix and ex
| |
| 150 | 148 |
| 151 // We now need to check if the window is obscuring the search results. | 149 // We now need to check if the window is obscuring the search results. |
| 152 MoveWindowIfNecessary(result.selection_rect()); | 150 MoveWindowIfNecessary(result.selection_rect()); |
| 153 | 151 |
| 154 // Once we find a match we no longer want to keep track of what had | 152 // Once we find a match we no longer want to keep track of what had |
| 155 // focus. EndFindSession will then set the focus to the page content. | 153 // focus. EndFindSession will then set the focus to the page content. |
| 156 if (result.number_of_matches() > 0) | 154 if (result.number_of_matches() > 0) |
| 157 ResetFocusTracker(); | 155 ResetFocusTracker(); |
| 158 } | 156 } |
| 159 | 157 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 | 352 |
| 355 //////////////////////////////////////////////////////////////////////////////// | 353 //////////////////////////////////////////////////////////////////////////////// |
| 356 // private: | 354 // private: |
| 357 | 355 |
| 358 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 356 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
| 359 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); | 357 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); |
| 360 gfx::Rect webcontents_rect = | 358 gfx::Rect webcontents_rect = |
| 361 find_bar_controller_->web_contents()->GetViewBounds(); | 359 find_bar_controller_->web_contents()->GetViewBounds(); |
| 362 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 360 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
| 363 } | 361 } |
| OLD | NEW |