Bug 1258657 Part 2 - Remove SummaryFrame. r=bz
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 13 Apr 2016 13:34:14 +0800
changeset 330871 1c23caab8a0d0cc212b9675598afbffbbc2d0588
parent 330870 c9894253461b30b2d6b7ca05d4c44b148e51c6ef
child 330872 b15639b50f9f6a5ace4c82864314702cfa217f65
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1258657, 591737
milestone48.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 1258657 Part 2 - Remove SummaryFrame. r=bz We can use nsBlockFrame to render summary elements. This change undoes "Bug 591737 - Add SummaryFrame" and remove summaryFrame usage in DetailsFrame and nsCSSFrameConstructor. MozReview-Commit-ID: 4aJvHVPfsBb
dom/base/nsGkAtomList.h
layout/base/nsCSSFrameConstructor.cpp
layout/generic/DetailsFrame.cpp
layout/generic/SummaryFrame.cpp
layout/generic/SummaryFrame.h
layout/generic/moz.build
layout/generic/nsFrameIdList.h
layout/generic/nsHTMLParts.h
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -1998,17 +1998,16 @@ GK_ATOM(rubyBaseContainerFrame, "RubyBas
 GK_ATOM(rubyBaseFrame, "RubyBaseFrame")
 GK_ATOM(rubyFrame, "RubyFrame")
 GK_ATOM(rubyTextContainerFrame, "RubyTextContainerFrame")
 GK_ATOM(rubyTextFrame, "RubyTextFrame")
 GK_ATOM(scrollFrame, "ScrollFrame")
 GK_ATOM(scrollbarFrame, "ScrollbarFrame")
 GK_ATOM(sequenceFrame, "SequenceFrame")
 GK_ATOM(sliderFrame, "sliderFrame")
-GK_ATOM(summaryFrame, "SummaryFrame")
 GK_ATOM(tableCellFrame, "TableCellFrame")
 GK_ATOM(tableColFrame, "TableColFrame")
 GK_ATOM(tableColGroupFrame, "TableColGroupFrame")
 GK_ATOM(tableFrame, "TableFrame")
 GK_ATOM(tableOuterFrame, "TableOuterFrame")
 GK_ATOM(tableRowGroupFrame, "TableRowGroupFrame")
 GK_ATOM(tableRowFrame, "TableRowFrame")
 GK_ATOM(textInputFrame,"TextInputFrame")
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -91,17 +91,16 @@
 #include "nsGfxScrollFrame.h"
 #include "nsPageFrame.h"
 #include "nsSimplePageSequenceFrame.h"
 #include "nsTableOuterFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsBackdropFrame.h"
 #include "nsTransitionManager.h"
 #include "DetailsFrame.h"
-#include "SummaryFrame.h"
 
 #ifdef MOZ_XUL
 #include "nsIRootBox.h"
 #endif
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
@@ -3619,20 +3618,17 @@ nsCSSFrameConstructor::FindHTMLData(Elem
       FCDATA_WITH_WRAPPING_BLOCK(FCDATA_ALLOW_BLOCK_STYLES,
                                  NS_NewHTMLButtonControlFrame,
                                  nsCSSAnonBoxes::buttonContent) },
     SIMPLE_TAG_CHAIN(canvas, nsCSSFrameConstructor::FindCanvasData),
     SIMPLE_TAG_CREATE(video, NS_NewHTMLVideoFrame),
     SIMPLE_TAG_CREATE(audio, NS_NewHTMLVideoFrame),
     SIMPLE_TAG_CREATE(progress, NS_NewProgressFrame),
     SIMPLE_TAG_CREATE(meter, NS_NewMeterFrame),
-    COMPLEX_TAG_CREATE(details, &nsCSSFrameConstructor::ConstructDetailsFrame),
-    { &nsGkAtoms::summary,
-      FCDATA_DECL(FCDATA_ALLOW_BLOCK_STYLES | FCDATA_MAY_NEED_SCROLLFRAME,
-                  NS_NewSummaryFrame) }
+    COMPLEX_TAG_CREATE(details, &nsCSSFrameConstructor::ConstructDetailsFrame)
   };
 
   return FindDataByTag(aTag, aElement, aStyleContext, sHTMLData,
                        ArrayLength(sHTMLData));
 }
 
 /* static */
 const nsCSSFrameConstructor::FrameConstructionData*
@@ -8938,19 +8934,16 @@ nsCSSFrameConstructor::CreateContinuingF
     newFrame = NS_NewRubyBaseContainerFrame(shell, styleContext);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (nsGkAtoms::rubyTextContainerFrame == frameType) {
     newFrame = NS_NewRubyTextContainerFrame(shell, styleContext);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (nsGkAtoms::detailsFrame == frameType) {
     newFrame = NS_NewDetailsFrame(shell, styleContext);
     newFrame->Init(content, aParentFrame, aFrame);
-  } else if (nsGkAtoms::summaryFrame == frameType) {
-    newFrame = NS_NewSummaryFrame(shell, styleContext);
-    newFrame->Init(content, aParentFrame, aFrame);
   } else {
     NS_RUNTIMEABORT("unexpected frame type");
   }
 
   // Init() set newFrame to be a fluid continuation of aFrame.
   // If we want a non-fluid continuation, we need to call SetPrevContinuation()
   // to reset NS_FRAME_IS_FLUID_CONTINUATION.
   if (!aIsFluid) {
@@ -9269,25 +9262,30 @@ nsCSSFrameConstructor::MaybeRecreateCont
       aFrame->GetParent()->GetType() == nsGkAtoms::fieldSetFrame) {
     // When we remove the legend for a fieldset, we should reframe
     // the fieldset to ensure another legend is used, if there is one
     *aResult = RecreateFramesForContent(aFrame->GetParent()->GetContent(), false,
                                         aFlags, aDestroyedFramesFor);
     return true;
   }
 
-  if (insertionFrame && insertionFrame->GetType() == nsGkAtoms::summaryFrame &&
+  if (insertionFrame &&
       aFrame->GetParent()->GetType() == nsGkAtoms::detailsFrame) {
-    // When removing a summary frame, we should reframe the parent details frame
-    // to ensure that another summary is used or the default summary is
-    // generated.
-    *aResult = RecreateFramesForContent(aFrame->GetParent()->GetContent(),
-                                        false, REMOVE_FOR_RECONSTRUCTION,
-                                        aDestroyedFramesFor);
-    return true;
+    HTMLSummaryElement* summary =
+      HTMLSummaryElement::FromContent(insertionFrame->GetContent());
+
+    if (summary && summary->IsMainSummary()) {
+      // When removing a summary, we should reframe the parent details frame to
+      // ensure that another summary is used or the default summary is
+      // generated.
+      *aResult = RecreateFramesForContent(aFrame->GetParent()->GetContent(),
+                                          false, REMOVE_FOR_RECONSTRUCTION,
+                                          aDestroyedFramesFor);
+      return true;
+    }
   }
 
   // Now check for possibly needing to reconstruct due to a pseudo parent
   nsIFrame* inFlowFrame =
     (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) ?
       GetPlaceholderFrameFor(aFrame) : aFrame;
   MOZ_ASSERT(inFlowFrame, "How did that happen?");
   MOZ_ASSERT(inFlowFrame == inFlowFrame->FirstContinuation(),
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -49,19 +49,20 @@ DetailsFrame::SetInitialChildList(ChildL
   if (aListID == kPrincipalList) {
     HTMLDetailsElement* details = HTMLDetailsElement::FromContent(GetContent());
     bool isOpen = details->Open();
 
     if (isOpen) {
       // If details is open, the first summary needs to be rendered as if it is
       // the first child.
       for (nsIFrame* child : aChildList) {
-        auto* realFrame = nsPlaceholderFrame::GetRealFrameFor(child);
-        auto* cif = realFrame->GetContentInsertionFrame();
-        if (cif && cif->GetType() == nsGkAtoms::summaryFrame) {
+        HTMLSummaryElement* summary =
+          HTMLSummaryElement::FromContent(child->GetContent());
+
+        if (summary && summary->IsMainSummary()) {
           // Take out the first summary frame and insert it to the beginning of
           // the list.
           aChildList.RemoveFrame(child);
           aChildList.InsertFrame(nullptr, nullptr, child);
           break;
         }
       }
     }
deleted file mode 100644
--- a/layout/generic/SummaryFrame.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "SummaryFrame.h"
-
-#include "mozilla/Attributes.h"
-#include "mozilla/dom/HTMLSummaryElement.h"
-
-NS_IMPL_FRAMEARENA_HELPERS(SummaryFrame)
-
-SummaryFrame*
-NS_NewSummaryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
-{
-  return new (aPresShell) SummaryFrame(aContext);
-}
-
-SummaryFrame::SummaryFrame(nsStyleContext* aContext)
-  : nsBlockFrame(aContext)
-{
-}
-
-SummaryFrame::~SummaryFrame()
-{
-}
-
-nsIAtom*
-SummaryFrame::GetType() const
-{
-  return nsGkAtoms::summaryFrame;
-}
-
-void
-SummaryFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList)
-{
-  nsBlockFrame::SetInitialChildList(aListID, aChildList);
-}
deleted file mode 100644
--- a/layout/generic/SummaryFrame.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef SummaryFrame_h
-#define SummaryFrame_h
-
-#include "nsBlockFrame.h"
-
-class nsStyleContext;
-
-// SummaryFrame is generated by HTMLSummaryElement.
-//
-class SummaryFrame final : public nsBlockFrame
-{
-public:
-  NS_DECL_FRAMEARENA_HELPERS
-
-  explicit SummaryFrame(nsStyleContext* aContext);
-
-  virtual ~SummaryFrame();
-
-  nsIAtom* GetType() const override;
-
-#ifdef DEBUG_FRAME_DUMP
-  nsresult GetFrameName(nsAString& aResult) const override
-  {
-    return MakeFrameName(NS_LITERAL_STRING("Summary"), aResult);
-  }
-#endif
-
-  void SetInitialChildList(ChildListID aListID,
-                           nsFrameList& aChildList) override;
-};
-
-#endif // SummaryFrame_h
--- a/layout/generic/moz.build
+++ b/layout/generic/moz.build
@@ -165,17 +165,16 @@ UNIFIED_SOURCES += [
     'nsTextRunTransformations.cpp',
     'nsVideoFrame.cpp',
     'nsViewportFrame.cpp',
     'RubyUtils.cpp',
     'ScrollbarActivity.cpp',
     'ScrollSnap.cpp',
     'ScrollVelocityQueue.cpp',
     'StickyScrollContainer.cpp',
-    'SummaryFrame.cpp',
     'TextOverflow.cpp',
 ]
 
 # nsLineLayout.cpp needs to be built separately because it uses plarena.h.
 # nsPluginFrame.cpp needs to be built separately because of name clashes in the OS X headers.
 SOURCES += [
     'nsLineLayout.cpp',
     'nsPluginFrame.cpp',
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -171,10 +171,9 @@ FRAME_ID(nsTextBoxFrame)
 FRAME_ID(nsTextControlFrame)
 FRAME_ID(nsTextFrame)
 FRAME_ID(nsTitleBarFrame)
 FRAME_ID(nsTreeBodyFrame)
 FRAME_ID(nsTreeColFrame)
 FRAME_ID(nsVideoFrame)
 FRAME_ID(nsXULLabelFrame)
 FRAME_ID(nsXULScrollFrame)
-FRAME_ID(SummaryFrame)
 FRAME_ID(ViewportFrame)
--- a/layout/generic/nsHTMLParts.h
+++ b/layout/generic/nsHTMLParts.h
@@ -173,19 +173,16 @@ nsIFrame*
 NS_NewMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 nsIFrame*
 NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 nsIFrame*
 NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 class DetailsFrame;
 DetailsFrame*
 NS_NewDetailsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
-class SummaryFrame;
-SummaryFrame*
-NS_NewSummaryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 // Table frame factories
 class nsTableOuterFrame;
 nsTableOuterFrame*
 NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 class nsTableFrame;
 nsTableFrame*
 NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);