Bug 1388625 part 1. During a stylo restyle, update the style of the trailing anonymous colgroup of a table, if any. r?heycam draft
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 10 Aug 2017 12:42:53 -0400
changeset 644253 935dae61d550c675a182b6ef14296e0060f4493c
parent 641248 b34cf908546b9f37f5d1b100e67dc8ef814fca7a
child 644254 20464496153999e766674485eb31662d4dfb3ef5
push id73370
push userbzbarsky@mozilla.com
push dateThu, 10 Aug 2017 18:56:24 +0000
reviewersheycam
bugs1388625
milestone57.0a1
Bug 1388625 part 1. During a stylo restyle, update the style of the trailing anonymous colgroup of a table, if any. r?heycam MozReview-Commit-ID: 4rz4AlPEsjR
layout/tables/nsTableFrame.cpp
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -8026,16 +8026,37 @@ void
 nsTableFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
 {
   nsIFrame* wrapper = GetParent();
   MOZ_ASSERT(wrapper->StyleContext()->GetPseudo() ==
                nsCSSAnonBoxes::tableWrapper,
              "What happened to our parent?");
   aResult.AppendElement(
     OwnedAnonBox(wrapper, &UpdateStyleOfOwnedAnonBoxesForTableWrapper));
+
+  // We may also have an anonymous colgroup that we're responsible for.
+  // Specifically, we can have three types of colgroup frames: (A) corresponding
+  // to actual elements with "display: table-column-group", (B) wrapping runs of
+  // "display: table-column" kids, and (C) one colgroup frame added at the end
+  // to hold the anonymous colframes we need so each cell has an associated
+  // colframe.
+  //
+  // These types of colgroups are supposed to correspond to the values of the
+  // nsTableColGroupType enum: type (A) to eColGroupContent, type (B) to
+  // eColGroupAnonymousCol, and type (C) to eColGroupAnonymousCell.  But we
+  // never actually set eColGroupAnonymousCol on any colgroups right now; see
+  // bug 1387568.  In any case, eColGroupAnonymousCell works correctly to detect
+  // colgroups of type (C), which are the ones we want to restyle here.  Type
+  // (A) will be restyled via their element, and type (B) via the machinery for
+  // restyling wrapper anonymous frames.
+  auto colGroupFrame =
+    static_cast<nsTableColGroupFrame*>(mColGroups.LastChild());
+  if (colGroupFrame && colGroupFrame->GetColType() == eColGroupAnonymousCell) {
+    aResult.AppendElement(colGroupFrame);
+  }
 }
 
 /* static */ void
 nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
   nsIFrame* aOwningFrame,
   nsIFrame* aWrapperFrame,
   ServoRestyleState& aRestyleState)
 {