diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-14 11:45:46 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-14 12:15:11 +0200 |
commit | 9bdd8ec3f330437a621686ce0b4f01586bcaac4d (patch) | |
tree | f834cddf414175f27823ccfe6b0445a48e367ee8 | |
parent | be76abfdb39cd22840a69d226c42c7ec99107252 (diff) | |
download | serenity-9bdd8ec3f330437a621686ce0b4f01586bcaac4d.zip |
LibWeb: Don't paint a text cursor in unfocused frames
-rw-r--r-- | Libraries/LibWeb/Layout/LayoutText.cpp | 3 | ||||
-rw-r--r-- | Libraries/LibWeb/Page/Frame.cpp | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutText.cpp b/Libraries/LibWeb/Layout/LayoutText.cpp index 64d89313ea..654786b0a9 100644 --- a/Libraries/LibWeb/Layout/LayoutText.cpp +++ b/Libraries/LibWeb/Layout/LayoutText.cpp @@ -108,6 +108,9 @@ void LayoutText::paint_fragment(PaintContext& context, const LineBoxFragment& fr void LayoutText::paint_cursor_if_needed(PaintContext& context, const LineBoxFragment& fragment) const { + if (!frame().is_focused_frame()) + return; + if (!frame().cursor_blink_state()) return; diff --git a/Libraries/LibWeb/Page/Frame.cpp b/Libraries/LibWeb/Page/Frame.cpp index f6726476ab..9d4225bc43 100644 --- a/Libraries/LibWeb/Page/Frame.cpp +++ b/Libraries/LibWeb/Page/Frame.cpp @@ -61,6 +61,8 @@ Frame::~Frame() void Frame::setup() { m_cursor_blink_timer = Core::Timer::construct(500, [this] { + if (!is_focused_frame()) + return; if (m_cursor_position.node() && m_cursor_position.node()->layout_node()) { m_cursor_blink_state = !m_cursor_blink_state; m_cursor_position.node()->layout_node()->set_needs_display(); |