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

Side by Side Diff: ui/views/corewm/tooltip_controller.cc

Issue 2652353003: Fix regression: empty tooltip appears in Linux and Chrome OS (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/corewm/tooltip_controller.h" 5 #include "ui/views/corewm/tooltip_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 kDelayForTooltipUpdateInMs), 320 kDelayForTooltipUpdateInMs),
321 this, &TooltipController::ShowTooltip); 321 this, &TooltipController::ShowTooltip);
322 } 322 }
323 } else { 323 } else {
324 ShowTooltip(); // Allow tooltip to show up without delay for unit tests. 324 ShowTooltip(); // Allow tooltip to show up without delay for unit tests.
325 } 325 }
326 } 326 }
327 } 327 }
328 328
329 void TooltipController::ShowTooltip() { 329 void TooltipController::ShowTooltip() {
330 if (!tooltip_window_) 330 if (!tooltip_window_ || tooltip_text_whitespace_trimmed_.empty())
sky 2017/01/25 23:43:21 Also, how do we end up here with an empty tooltip?
chengx 2017/01/26 01:16:24 Because this function is called from UpdateIfRequi
331 return; 331 return;
332 gfx::Point widget_loc = 332 gfx::Point widget_loc =
333 curr_mouse_loc_ + tooltip_window_->GetBoundsInScreen().OffsetFromOrigin(); 333 curr_mouse_loc_ + tooltip_window_->GetBoundsInScreen().OffsetFromOrigin();
334 tooltip_->SetText(tooltip_window_, tooltip_text_whitespace_trimmed_, 334 tooltip_->SetText(tooltip_window_, tooltip_text_whitespace_trimmed_,
335 widget_loc); 335 widget_loc);
336 tooltip_->Show(); 336 tooltip_->Show();
337 int timeout = GetTooltipShownTimeout(); 337 int timeout = GetTooltipShownTimeout();
338 if (timeout > 0) { 338 if (timeout > 0) {
339 tooltip_shown_timer_.Start(FROM_HERE, 339 tooltip_shown_timer_.Start(FROM_HERE,
340 base::TimeDelta::FromMilliseconds(timeout), this, 340 base::TimeDelta::FromMilliseconds(timeout), this,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return; 379 return;
380 if (tooltip_window_) 380 if (tooltip_window_)
381 tooltip_window_->RemoveObserver(this); 381 tooltip_window_->RemoveObserver(this);
382 tooltip_window_ = target; 382 tooltip_window_ = target;
383 if (tooltip_window_) 383 if (tooltip_window_)
384 tooltip_window_->AddObserver(this); 384 tooltip_window_->AddObserver(this);
385 } 385 }
386 386
387 } // namespace corewm 387 } // namespace corewm
388 } // namespace views 388 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698