layout/xul/nsStackFrame.cpp

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 //
     7 // Eric Vaughan
     8 // Netscape Communications
     9 //
    10 // See documentation in associated header file
    11 //
    13 #include "nsStackFrame.h"
    14 #include "nsStyleContext.h"
    15 #include "nsIContent.h"
    16 #include "nsCOMPtr.h"
    17 #include "nsHTMLParts.h"
    18 #include "nsIPresShell.h"
    19 #include "nsCSSRendering.h"
    20 #include "nsBoxLayoutState.h"
    21 #include "nsStackLayout.h"
    22 #include "nsDisplayList.h"
    24 nsIFrame*
    25 NS_NewStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
    26 {
    27   return new (aPresShell) nsStackFrame(aPresShell, aContext);
    28 }
    30 NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame)
    32 nsStackFrame::nsStackFrame(nsIPresShell* aPresShell, nsStyleContext* aContext):
    33   nsBoxFrame(aPresShell, aContext)
    34 {
    35   nsCOMPtr<nsBoxLayout> layout;
    36   NS_NewStackLayout(aPresShell, layout);
    37   SetLayoutManager(layout);
    38 }
    40 // REVIEW: The old code put everything in the background layer. To be more
    41 // consistent with the way other frames work, I'm putting everything in the
    42 // Content() (i.e., foreground) layer (see nsFrame::BuildDisplayListForChild,
    43 // the case for stacking context but non-positioned, non-floating frames).
    44 // This could easily be changed back by hacking nsBoxFrame::BuildDisplayListInternal
    45 // a bit more.
    46 void
    47 nsStackFrame::BuildDisplayListForChildren(nsDisplayListBuilder*   aBuilder,
    48                                           const nsRect&           aDirtyRect,
    49                                           const nsDisplayListSet& aLists)
    50 {
    51   // BuildDisplayListForChild puts stacking contexts into the PositionedDescendants
    52   // list. So we need to map that list to aLists.Content(). This is an easy way to
    53   // do that.
    54   nsDisplayList* content = aLists.Content();
    55   nsDisplayListSet kidLists(content, content, content, content, content, content);
    56   nsIFrame* kid = mFrames.FirstChild();
    57   while (kid) {
    58     // Force each child into its own true stacking context.
    59     BuildDisplayListForChild(aBuilder, kid, aDirtyRect, kidLists,
    60                              DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
    61     kid = kid->GetNextSibling();
    62   }
    63 }

mercurial