Bug 1265104, paint dnd'ed content also when it is under non-displayed content (display: contents or ShadowRoot), r=emilio
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 11 Mar 2019 22:47:12 +0000
changeset 521457 e5e2e0d4eb054eb3b88748e5ef9dfadc7d2f2697
parent 521456 b9b0378c5e0bd749b7904c2a5ccca74c9683bf42
child 521458 ec39fd695adb0548e5c689d839843fa2e9b3acbd
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1265104
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1265104, paint dnd'ed content also when it is under non-displayed content (display: contents or ShadowRoot), r=emilio Differential Revision: https://phabricator.services.mozilla.com/D23050
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4656,21 +4656,25 @@ UniquePtr<RangePaintInfo> PresShell::Cre
   Document* doc = startContainer->GetComposedDoc();
   if (startContainer == doc || endContainer == doc) {
     ancestorFrame = rootFrame;
   } else {
     nsINode* ancestor =
         nsContentUtils::GetCommonAncestor(startContainer, endContainer);
     NS_ASSERTION(!ancestor || ancestor->IsContent(),
                  "common ancestor is not content");
-    if (!ancestor || !ancestor->IsContent()) return nullptr;
-
-    ancestorFrame = ancestor->AsContent()->GetPrimaryFrame();
-
-    // XXX deal with ancestorFrame being null due to display:contents
+
+    while (ancestor && ancestor->IsContent()) {
+      ancestorFrame = ancestor->AsContent()->GetPrimaryFrame();
+      if (ancestorFrame) {
+        break;
+      }
+
+      ancestor = ancestor->GetParentOrHostNode();
+    }
 
     // use the nearest ancestor frame that includes all continuations as the
     // root for building the display list
     while (ancestorFrame &&
            nsLayoutUtils::GetNextContinuationOrIBSplitSibling(ancestorFrame))
       ancestorFrame = ancestorFrame->GetParent();
   }