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

Unified Diff: ui/views/corewm/tooltip_aura.cc

Issue 2556083002: Don't subtract border from max size for display rect. (Closed)
Patch Set: RenderTextTestApi Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/corewm/tooltip_aura.cc
diff --git a/ui/views/corewm/tooltip_aura.cc b/ui/views/corewm/tooltip_aura.cc
index 256a4fbfebb78e00a78dce44c0024e6939d722ad..00c831c56f7001515f3457029a803e7637e847d2 100644
--- a/ui/views/corewm/tooltip_aura.cc
+++ b/ui/views/corewm/tooltip_aura.cc
@@ -13,6 +13,7 @@
#include "ui/display/screen.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/render_text.h"
+#include "ui/gfx/test/render_text_test_api.h"
#include "ui/gfx/text_elider.h"
#include "ui/gfx/text_utils.h"
#include "ui/native_theme/native_theme.h"
@@ -141,11 +142,13 @@ class TooltipAura::TooltipView : public views::View {
ResetDisplayRect();
}
+ size_t GetLineSizeForTest() {
+ return gfx::test::RenderTextTestApi(render_text_.get()).lines().size();
+ }
+
private:
void ResetDisplayRect() {
- gfx::Insets insets = border()->GetInsets();
- int max_text_width = max_width_ - insets.width();
- render_text_->SetDisplayRect(gfx::Rect(0, 0, max_text_width, 100000));
+ render_text_->SetDisplayRect(gfx::Rect(0, 0, max_width_, 100000));
}
std::unique_ptr<gfx::RenderText> render_text_;
@@ -164,6 +167,10 @@ TooltipAura::~TooltipAura() {
DestroyWidget();
}
+size_t TooltipAura::GetLineSizeForTest() {
+ return tooltip_view_->GetLineSizeForTest();
+}
+
void TooltipAura::SetTooltipBounds(const gfx::Point& mouse_pos,
const gfx::Size& tooltip_size) {
gfx::Rect tooltip_rect(mouse_pos, tooltip_size);

Powered by Google App Engine
This is Rietveld 408576698