tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SimpleXULLeafFrame.cpp (1529B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "SimpleXULLeafFrame.h"
      8 
      9 #include "mozilla/PresShell.h"
     10 
     11 nsIFrame* NS_NewSimpleXULLeafFrame(mozilla::PresShell* aPresShell,
     12                                   mozilla::ComputedStyle* aStyle) {
     13  return new (aPresShell)
     14      mozilla::SimpleXULLeafFrame(aStyle, aPresShell->GetPresContext());
     15 }
     16 
     17 namespace mozilla {
     18 
     19 NS_IMPL_FRAMEARENA_HELPERS(SimpleXULLeafFrame)
     20 
     21 void SimpleXULLeafFrame::Reflow(nsPresContext* aPresContext,
     22                                ReflowOutput& aDesiredSize,
     23                                const ReflowInput& aReflowInput,
     24                                nsReflowStatus& aStatus) {
     25  MarkInReflow();
     26  MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
     27  const auto wm = GetWritingMode();
     28  const auto& bp = aReflowInput.ComputedLogicalBorderPadding(wm);
     29  aDesiredSize.ISize(wm) = bp.IStartEnd(wm) + aReflowInput.ComputedISize();
     30  aDesiredSize.BSize(wm) =
     31      bp.BStartEnd(wm) + (aReflowInput.ComputedBSize() == NS_UNCONSTRAINEDSIZE
     32                              ? aReflowInput.ComputedMinBSize()
     33                              : aReflowInput.ComputedBSize());
     34  aDesiredSize.SetOverflowAreasToDesiredBounds();
     35 }
     36 
     37 }  // namespace mozilla