소스 검색

Ladybird/Qt: Allow CR inside of elements title attributes

Bastiaan van der Plaat 1 년 전
부모
커밋
16fdb005f0
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      Ladybird/Qt/WebContentView.cpp

+ 4 - 1
Ladybird/Qt/WebContentView.cpp

@@ -109,9 +109,12 @@ WebContentView::WebContentView(QWidget* window, WebContentOptions const& web_con
     };
     };
 
 
     on_enter_tooltip_area = [this](auto position, auto const& tooltip) {
     on_enter_tooltip_area = [this](auto position, auto const& tooltip) {
+        auto tooltip_without_carriage_return = tooltip.contains("\r"sv)
+            ? tooltip.replace("\r\n"sv, "\n"sv, ReplaceMode::All).replace("\r"sv, "\n"sv, ReplaceMode::All)
+            : tooltip;
         QToolTip::showText(
         QToolTip::showText(
             mapToGlobal(QPoint(position.x(), position.y())),
             mapToGlobal(QPoint(position.x(), position.y())),
-            qstring_from_ak_string(tooltip),
+            qstring_from_ak_string(tooltip_without_carriage_return),
             this);
             this);
     };
     };