Bug 1517297 - Fix nsIFrame::IsColumnSpanInMulticolSubtree(). r=emilio
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 04 Jan 2019 19:16:28 +0000
changeset 509723 763f3f9bc7c3d5eae05fe45639ece36a7495b8c0
parent 509688 6dd228164d427b7b247e59e7d9d0251206dea83d
child 509724 9cb5b5f77ed8210c871b5377a9a6739841fb1e0e
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1517297, 1507244
milestone66.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 1517297 - Fix nsIFrame::IsColumnSpanInMulticolSubtree(). r=emilio After Bug 1507244 Part 2 landed, only block or inline frames can have NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR bit set. We need to fix IsColumnSpanInMulticolSubtree() for other types of frames. In multi-column formatting context, every frame having a "column-span:all" style will be wrapped by a -moz-column-span-wrapper frame. We can use this to check whether a non-inline and non-block frame is in a multi-column subtree or not. Differential Revision: https://phabricator.services.mozilla.com/D15709
layout/generic/crashtests/1517297.html
layout/generic/crashtests/crashtests.list
layout/generic/nsIFrame.h
layout/generic/nsIFrameInlines.h
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1517297.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+  <style>
+    * {
+      column-count: 1;
+      min-width: -moz-min-content;
+      column-span: all;
+    }
+
+    ins {
+      display: grid;
+    }
+  </style>
+</head>
+<body>
+  <a>
+    <ins>MJ]yYfC&gt;;M|</ins>
+    <keygen></keygen>
+  </a>
+</body>
+</html>
+
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -717,8 +717,9 @@ load 1493708.html
 load 1493710.html
 load 1493741.html
 load 1494380.html
 load 1505817.html
 pref(layout.css.column-span.enabled,true) load 1506216.html
 pref(layout.css.column-span.enabled,true) load 1506306.html
 pref(layout.css.column-span.enabled,true) load 1507196.html
 pref(layout.css.column-span.enabled,true) load 1517033.html
+pref(layout.css.column-span.enabled,true) load 1517297.html
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -3849,20 +3849,19 @@ class nsIFrame : public nsQueryFrame {
   inline bool IsFixedPosContainingBlock() const;
   inline bool IsRelativelyPositioned() const;
   inline bool IsAbsolutelyPositioned(
       const nsStyleDisplay* aStyleDisplay = nullptr) const;
 
   // Does this frame have "column-span: all" style.
   //
   // Note this only checks computed style, but not testing whether the
-  // containing block formatting context was established by a multicol.
-  // Callers need to consider NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR to check
-  // whether multi-column effects apply or not, or use
-  // IsColumnSpanInMulticolSubtree().
+  // containing block formatting context was established by a multicol. Callers
+  // need to use IsColumnSpanInMulticolSubtree() to check whether multi-column
+  // effects apply or not.
   inline bool IsColumnSpan() const;
 
   // Like IsColumnSpan(), but this also checks whether the frame has a
   // multi-column ancestor or not.
   inline bool IsColumnSpanInMulticolSubtree() const;
 
   /**
    * Returns the vertical-align value to be used for layout, if it is one
--- a/layout/generic/nsIFrameInlines.h
+++ b/layout/generic/nsIFrameInlines.h
@@ -65,17 +65,22 @@ bool nsIFrame::IsInlineOutside() const {
   return StyleDisplay()->IsInlineOutside(this);
 }
 
 bool nsIFrame::IsColumnSpan() const {
   return IsBlockOutside() && StyleColumn()->IsColumnSpanStyle();
 }
 
 bool nsIFrame::IsColumnSpanInMulticolSubtree() const {
-  return IsColumnSpan() && HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
+  return IsColumnSpan() &&
+         (HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) ||
+          // A frame other than inline and block won't have
+          // NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR. We instead test its parent.
+          (GetParent() && GetParent()->Style()->GetPseudo() ==
+                              nsCSSAnonBoxes::columnSpanWrapper()));
 }
 
 mozilla::StyleDisplay nsIFrame::GetDisplay() const {
   return StyleDisplay()->GetDisplay(this);
 }
 
 nscoord nsIFrame::SynthesizeBaselineBOffsetFromMarginBox(
     mozilla::WritingMode aWM, BaselineSharingGroup aGroup) const {