소스 검색

LibWeb: Skip trim trailing whitespace if user is typing

This PR stops the cursor from disappearing while typing trailing spaces
in a text input box.
Alec Murphy 11 달 전
부모
커밋
b3a67ee088
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      Userland/Libraries/LibWeb/Layout/LineBox.cpp

+ 3 - 0
Userland/Libraries/LibWeb/Layout/LineBox.cpp

@@ -50,6 +50,9 @@ void LineBox::trim_trailing_whitespace()
             return;
             return;
         // last_fragment cannot be null from here on down, as m_fragments is not empty.
         // last_fragment cannot be null from here on down, as m_fragments is not empty.
         last_fragment = &m_fragments.last();
         last_fragment = &m_fragments.last();
+        auto dom_node = last_fragment->layout_node().dom_node();
+        if (dom_node && dom_node->is_editable() && dom_node->document().cursor_position())
+            return;
         if (!should_trim(last_fragment))
         if (!should_trim(last_fragment))
             return;
             return;
         if (last_fragment->is_justifiable_whitespace()) {
         if (last_fragment->is_justifiable_whitespace()) {