mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibGUI: Don't render placeholders as secret
before my placeholder 'password' showed up as '********'.
This commit is contained in:
parent
92b6e4fd76
commit
c19d868a3e
1 changed files with 3 additions and 3 deletions
|
@ -402,8 +402,8 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
|
||||
// NOTE: This lambda and TextEditor::text_width_for_font() are used to substitute all glyphs with m_substitution_code_point if necessary.
|
||||
// Painter::draw_text() and Gfx::Font::width() should not be called directly, but using this lambda and TextEditor::text_width_for_font().
|
||||
auto draw_text = [&](Gfx::IntRect const& rect, auto const& raw_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Gfx::Color color) {
|
||||
if (m_substitution_code_point) {
|
||||
auto draw_text = [&](Gfx::IntRect const& rect, auto const& raw_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Gfx::Color color, bool substitue = true) {
|
||||
if (m_substitution_code_point && substitue) {
|
||||
painter.draw_text(rect, substitution_code_point_view(raw_text.length()), font, alignment, color);
|
||||
} else {
|
||||
painter.draw_text(rect, raw_text, font, alignment, color);
|
||||
|
@ -519,7 +519,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
if (!placeholder().is_empty() && document().is_empty() && line_index == 0) {
|
||||
auto line_rect = visual_line_rect;
|
||||
line_rect.set_width(text_width_for_font(placeholder(), font()));
|
||||
draw_text(line_rect, placeholder(), font(), m_text_alignment, palette().color(Gfx::ColorRole::PlaceholderText));
|
||||
draw_text(line_rect, placeholder(), font(), m_text_alignment, palette().color(Gfx::ColorRole::PlaceholderText), false);
|
||||
} else if (!document().has_spans()) {
|
||||
// Fast-path for plain text
|
||||
auto color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue