fix: cyclical #include dependency between autofill_popup.h and autofill_popup_view.h (#44705)

fix: AutofillPopup warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]

refactor: reduce #indclude scope in autofill_popup.h and autofill_popup_view.h
This commit is contained in:
Charles Kerr 2024-11-19 13:45:18 -06:00 committed by GitHub
parent 48c9149a52
commit 1cf5e6d88c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 17 deletions

View file

@ -8,15 +8,18 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "shell/browser/ui/views/autofill_popup_view.h"
#include "ui/gfx/font_list.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/view_observer.h"
namespace content {
class RenderFrameHost;
} // namespace content
namespace gfx {
class RectF;
} // namespace gfx
namespace ui {
using ColorId = int;
} // namespace ui
@ -68,6 +71,10 @@ class AutofillPopup : private views::ViewObserver {
const std::u16string& label_at(int i) const { return labels_.at(i); }
int LineFromY(int y) const;
static constexpr int kNamePadding = 15;
static constexpr int kRowHeight = 24;
static constexpr int kSmallerFontSizeDelta = -1;
int selected_index_;
// Popup location
@ -81,8 +88,10 @@ class AutofillPopup : private views::ViewObserver {
std::vector<std::u16string> labels_;
// Font lists for the suggestions
gfx::FontList smaller_font_list_;
gfx::FontList bold_font_list_;
const gfx::FontList smaller_font_list_ =
gfx::FontList{}.DeriveWithSizeDelta(kSmallerFontSizeDelta);
const gfx::FontList bold_font_list_ =
gfx::FontList{}.DeriveWithWeight(gfx::Font::Weight::BOLD);
// For sending the accepted suggestion to the render frame that
// asked to open the popup