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 коммит произвёл GitHub
Родитель 48c9149a52
Коммит 1cf5e6d88c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 19 добавлений и 17 удалений

Просмотреть файл

@ -15,6 +15,7 @@
#include "shell/browser/osr/osr_render_widget_host_view.h" #include "shell/browser/osr/osr_render_widget_host_view.h"
#include "shell/browser/osr/osr_view_proxy.h" #include "shell/browser/osr/osr_view_proxy.h"
#include "shell/browser/ui/autofill_popup.h" #include "shell/browser/ui/autofill_popup.h"
#include "shell/browser/ui/views/autofill_popup_view.h"
#include "shell/common/api/api.mojom.h" #include "shell/common/api/api.mojom.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "ui/color/color_id.h" #include "ui/color/color_id.h"
@ -160,11 +161,7 @@ gfx::Rect CalculatePopupBounds(const gfx::Size& desired_size,
} // namespace } // namespace
AutofillPopup::AutofillPopup() { AutofillPopup::AutofillPopup() = default;
bold_font_list_ = gfx::FontList().DeriveWithWeight(gfx::Font::Weight::BOLD);
smaller_font_list_ =
gfx::FontList().DeriveWithSizeDelta(kSmallerFontSizeDelta);
}
AutofillPopup::~AutofillPopup() { AutofillPopup::~AutofillPopup() {
Hide(); Hide();

Просмотреть файл

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

Просмотреть файл

@ -12,6 +12,7 @@
#include "cc/paint/skia_paint_canvas.h" #include "cc/paint/skia_paint_canvas.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "shell/browser/ui/autofill_popup.h"
#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/color/color_provider.h" #include "ui/color/color_provider.h"

Просмотреть файл

@ -8,8 +8,6 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include "shell/browser/ui/autofill_popup.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "electron/buildflags/buildflags.h" #include "electron/buildflags/buildflags.h"
@ -31,11 +29,8 @@ struct AXNodeData;
namespace electron { namespace electron {
const int kPopupBorderThickness = 1; constexpr int kPopupBorderThickness = 1;
const int kSmallerFontSizeDelta = -1; constexpr int kEndPadding = 8;
const int kEndPadding = 8;
const int kNamePadding = 15;
const int kRowHeight = 24;
class AutofillPopup; class AutofillPopup;