LCOV - code coverage report
Current view: top level - layout/generic - nsLeafFrame.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 2 42 4.8 %
Date: 2017-07-14 16:53:18 Functions: 1 9 11.1 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : /* base class for rendering objects that do not have child lists */
       7             : 
       8             : #include "nsLeafFrame.h"
       9             : #include "nsPresContext.h"
      10             : 
      11             : using namespace mozilla;
      12             : 
      13          34 : nsLeafFrame::~nsLeafFrame()
      14             : {
      15          34 : }
      16             : 
      17             : /* virtual */ nscoord
      18           0 : nsLeafFrame::GetMinISize(gfxContext *aRenderingContext)
      19             : {
      20             :   nscoord result;
      21           0 :   DISPLAY_MIN_WIDTH(this, result);
      22           0 :   result = GetIntrinsicISize();
      23           0 :   return result;
      24             : }
      25             : 
      26             : /* virtual */ nscoord
      27           0 : nsLeafFrame::GetPrefISize(gfxContext *aRenderingContext)
      28             : {
      29             :   nscoord result;
      30           0 :   DISPLAY_PREF_WIDTH(this, result);
      31           0 :   result = GetIntrinsicISize();
      32           0 :   return result;
      33             : }
      34             : 
      35             : /* virtual */
      36             : LogicalSize
      37           0 : nsLeafFrame::ComputeAutoSize(gfxContext*         aRenderingContext,
      38             :                              WritingMode         aWM,
      39             :                              const LogicalSize&  aCBSize,
      40             :                              nscoord             aAvailableISize,
      41             :                              const LogicalSize&  aMargin,
      42             :                              const LogicalSize&  aBorder,
      43             :                              const LogicalSize&  aPadding,
      44             :                              ComputeSizeFlags    aFlags)
      45             : {
      46           0 :   const WritingMode wm = GetWritingMode();
      47           0 :   LogicalSize result(wm, GetIntrinsicISize(), GetIntrinsicBSize());
      48           0 :   return result.ConvertTo(aWM, wm);
      49             : }
      50             : 
      51             : void
      52           0 : nsLeafFrame::Reflow(nsPresContext* aPresContext,
      53             :                     ReflowOutput& aMetrics,
      54             :                     const ReflowInput& aReflowInput,
      55             :                     nsReflowStatus& aStatus)
      56             : {
      57           0 :   MarkInReflow();
      58           0 :   DO_GLOBAL_REFLOW_COUNT("nsLeafFrame");
      59           0 :   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
      60             :                  ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",
      61             :                   aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
      62             : 
      63           0 :   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
      64             : 
      65           0 :   DoReflow(aPresContext, aMetrics, aReflowInput, aStatus);
      66             : 
      67           0 :   FinishAndStoreOverflow(&aMetrics, aReflowInput.mStyleDisplay);
      68           0 : }
      69             : 
      70             : void
      71           0 : nsLeafFrame::DoReflow(nsPresContext* aPresContext,
      72             :                       ReflowOutput& aMetrics,
      73             :                       const ReflowInput& aReflowInput,
      74             :                       nsReflowStatus& aStatus)
      75             : {
      76           0 :   NS_ASSERTION(aReflowInput.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
      77             :                "Shouldn't have unconstrained stuff here "
      78             :                "thanks to the rules of reflow");
      79           0 :   NS_ASSERTION(NS_INTRINSICSIZE != aReflowInput.ComputedHeight(),
      80             :                "Shouldn't have unconstrained stuff here "
      81             :                "thanks to ComputeAutoSize");
      82             : 
      83             :   // XXX how should border&padding effect baseline alignment?
      84             :   // => descent = borderPadding.bottom for example
      85           0 :   WritingMode wm = aReflowInput.GetWritingMode();
      86           0 :   aMetrics.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding());
      87             : 
      88           0 :   aStatus.Reset();
      89             : 
      90           0 :   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
      91             :                  ("exit nsLeafFrame::DoReflow: size=%d,%d",
      92             :                   aMetrics.ISize(wm), aMetrics.BSize(wm)));
      93           0 :   NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
      94             : 
      95           0 :   aMetrics.SetOverflowAreasToDesiredBounds();
      96           0 : }
      97             : 
      98             : nscoord
      99           0 : nsLeafFrame::GetIntrinsicBSize()
     100             : {
     101           0 :   NS_NOTREACHED("Someone didn't override Reflow or ComputeAutoSize");
     102           0 :   return 0;
     103             : }
     104             : 
     105             : void
     106           0 : nsLeafFrame::SizeToAvailSize(const ReflowInput& aReflowInput,
     107             :                              ReflowOutput& aDesiredSize)
     108             : {
     109           0 :   WritingMode wm = aReflowInput.GetWritingMode();
     110             :   LogicalSize size(wm, aReflowInput.AvailableISize(), // FRAME
     111           0 :                    aReflowInput.AvailableBSize());
     112           0 :   aDesiredSize.SetSize(wm, size);
     113           0 :   aDesiredSize.SetOverflowAreasToDesiredBounds();
     114           0 :   FinishAndStoreOverflow(&aDesiredSize, aReflowInput.mStyleDisplay);
     115           0 : }

Generated by: LCOV version 1.13