View Single Post
Old 06-20-2020, 08:08 AM   #34
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,893
Karma: 6120478
Join Date: Nov 2009
Device: many
My build finished and sure enough, the obviously broken code when fixed, actually fixes this problem.

So somebody at Qt did a bad job merging in chrome 79 changes into the QT 5.12.X to create the 5.12.8 tree and introduced a bad break that can cause text to be lost when live editing!

The breakage continued with Qt 5.12.9 since the bug was never reported.


For the record, the bad chrome merge is here:

qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/core/editing/serializers/styled_markup_serializer.cc

The broken code (bad chunk) can be easily seen in a diff from the working Qt 5.12.7 to the Qt 5.12.8 version of the file:

Code:
@@ -358,10 +362,7 @@
         continue;
       }
 
-      if (!n->GetLayoutObject() &&
-          (!n->IsElementNode() || !ToElement(n)->HasDisplayContentsStyle()) &&
-          !EnclosingElementWithTag(FirstPositionInOrBeforeNode(*n),
-                                   selectTag)) {
+      if (n->GetLayoutObject() || ShouldSerializeUnrenderedElement(*n)) {
         next = Strategy::NextSkippingChildren(*n);
         // Don't skip over pastEnd.
         if (past_end && Strategy::IsDescendantOf(*past_end, *n));
Here they reverse the condition in the "if" to simplify the logic but do not reverse the "then" and "else" clauses.

Here is patch that fixes things:

Code:
--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/core/editing/serializers/styled_markup_serializer.cc.orig	2020-06-19 23:46:16.000000000 -0400
+++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/core/editing/serializers/styled_markup_serializer.cc	2020-06-19 23:47:33.000000000 -0400
@@ -363,11 +363,6 @@
       }
 
       if (n->GetLayoutObject() || ShouldSerializeUnrenderedElement(*n)) {
-        next = Strategy::NextSkippingChildren(*n);
-        // Don't skip over pastEnd.
-        if (past_end && Strategy::IsDescendantOf(*past_end, *n))
-          next = past_end;
-      } else {
         // Add the node to the markup if we're not skipping the descendants
         AppendStartMarkup(*n);
 
@@ -378,6 +373,11 @@
         }
         AppendEndMarkup(*n);
         last_closed = n;
+      } else {
+        next = Strategy::NextSkippingChildren(*n);
+        // Don't skip over pastEnd.
+        if (past_end && Strategy::IsDescendantOf(*past_end, *n))
+          next = past_end;
       }
     }
Now we just need to get the attention of the person who broke things at Qt and the Linux people to get this stuff fixed!

For the record, I filed the following official bug report:

https://bugreports.qt.io/browse/QTBUG-85160

Now getting someone to actually admit the error and fix things in an LTS 5.12.8 and LTS 5.12.9 may be next to impossible. I am not sure they are even making another 5.12.X release.

So if anyone knows anyone at Ubuntu, and other Linux devs who support Qt, I would be happy to explain the bad merge and provide the fix. The bug is pretty obvious and so hopefully someone will cherry-pick this fix for Linux.

Last edited by KevinH; 06-20-2020 at 09:24 AM.
KevinH is offline   Reply With Quote