#include "chrome/browser/ui/views/omnibox/omnibox_text_view.h"
#include <limits.h>
#include <algorithm>
#include <memory>
#include <optional>
#include "base/feature_list.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/omnibox/omnibox_theme.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/common/omnibox_features.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/range/range.h"
#include "ui/gfx/render_text.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
namespace {
constexpr int kTextStyle = …;
constexpr int kInherit = …;
static constexpr int kVerticalPadding = …;
constexpr size_t kDefaultMaxNumLines = …;
struct TextStyle { … };
void ApplyTextStyleForType(SuggestionAnswer::TextStyle text_style,
OmniboxResultView* result_view,
gfx::RenderText* render_text,
const gfx::Range& range) { … }
void ApplyTextStyleFromColorType(
const std::optional<omnibox::FormattedString::ColorType>& color_type,
OmniboxResultView* result_view,
gfx::RenderText* render_text,
const gfx::Range& range) { … }
bool AnswerHasDefinedMaxLines(omnibox::AnswerType answer_type) { … }
}
OmniboxTextView::OmniboxTextView(OmniboxResultView* result_view)
: … { … }
OmniboxTextView::~OmniboxTextView() = default;
gfx::Size OmniboxTextView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
bool OmniboxTextView::GetCanProcessEventsWithinSubtree() const { … }
void OmniboxTextView::OnPaint(gfx::Canvas* canvas) { … }
void OmniboxTextView::ApplyTextColor(ui::ColorId id) { … }
const std::u16string& OmniboxTextView::GetText() const { … }
void OmniboxTextView::SetText(const std::u16string& new_text) { … }
void OmniboxTextView::SetTextWithStyling(
const std::u16string& new_text,
const ACMatchClassifications& classifications,
bool deemphasize) { … }
void OmniboxTextView::SetTextWithStyling(
const SuggestionAnswer::ImageLine& line,
bool deemphasize) { … }
void OmniboxTextView::SetTextWithStyling(
const omnibox::FormattedString& formatted_string,
size_t fragment_index,
const omnibox::AnswerType& answer_type) { … }
void OmniboxTextView::SetMultilineText(
const omnibox::FormattedString& formatted_string,
const omnibox::AnswerType& answer_type) { … }
void OmniboxTextView::AppendExtraText(const SuggestionAnswer::ImageLine& line) { … }
int OmniboxTextView::GetLineHeight() const { … }
void OmniboxTextView::ReapplyStyling() { … }
std::unique_ptr<gfx::RenderText> OmniboxTextView::CreateRenderText(
const std::u16string& text) const { … }
void OmniboxTextView::AppendText(const SuggestionAnswer::TextField& field,
const std::u16string& prefix) { … }
void OmniboxTextView::OnStyleChanged() { … }
BEGIN_METADATA(…)