LCOV - code coverage report
Current view: top level - layout/tables - nsTableColFrame.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 100 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 18 0.0 %
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             : #include "nsCOMPtr.h"
       6             : #include "nsTableColFrame.h"
       7             : #include "nsTableFrame.h"
       8             : #include "nsContainerFrame.h"
       9             : #include "nsStyleContext.h"
      10             : #include "nsStyleConsts.h"
      11             : #include "nsPresContext.h"
      12             : #include "nsGkAtoms.h"
      13             : #include "nsCSSRendering.h"
      14             : #include "nsIContent.h"
      15             : 
      16             : using namespace mozilla;
      17             : 
      18             : #define COL_TYPE_BITS                 (NS_FRAME_STATE_BIT(28) | \
      19             :                                        NS_FRAME_STATE_BIT(29) | \
      20             :                                        NS_FRAME_STATE_BIT(30) | \
      21             :                                        NS_FRAME_STATE_BIT(31))
      22             : #define COL_TYPE_OFFSET               28
      23             : 
      24             : using namespace mozilla;
      25             : 
      26           0 : nsTableColFrame::nsTableColFrame(nsStyleContext* aContext)
      27             :   : nsSplittableFrame(aContext, kClassID)
      28             :   , mMinCoord(0)
      29             :   , mPrefCoord(0)
      30             :   , mSpanMinCoord(0)
      31             :   , mSpanPrefCoord(0)
      32             :   , mPrefPercent(0.0f)
      33             :   , mSpanPrefPercent(0.0f)
      34             :   , mFinalISize(0)
      35             :   , mColIndex(0)
      36             :   , mIStartBorderWidth(0)
      37             :   , mIEndBorderWidth(0)
      38             :   , mBStartContBorderWidth(0)
      39             :   , mIEndContBorderWidth(0)
      40             :   , mBEndContBorderWidth(0)
      41           0 :   , mHasSpecifiedCoord(false)
      42             : {
      43           0 :   SetColType(eColContent);
      44           0 :   ResetIntrinsics();
      45           0 :   ResetSpanIntrinsics();
      46           0 :   ResetFinalISize();
      47           0 : }
      48             : 
      49           0 : nsTableColFrame::~nsTableColFrame()
      50             : {
      51           0 : }
      52             : 
      53             : nsTableColType
      54           0 : nsTableColFrame::GetColType() const
      55             : {
      56           0 :   return (nsTableColType)((mState & COL_TYPE_BITS) >> COL_TYPE_OFFSET);
      57             : }
      58             : 
      59             : void
      60           0 : nsTableColFrame::SetColType(nsTableColType aType)
      61             : {
      62           0 :   NS_ASSERTION(aType != eColAnonymousCol ||
      63             :                (GetPrevContinuation() &&
      64             :                 GetPrevContinuation()->GetNextContinuation() == this &&
      65             :                 GetPrevContinuation()->GetNextSibling() == this),
      66             :                "spanned content cols must be continuations");
      67           0 :   uint32_t type = aType - eColContent;
      68           0 :   RemoveStateBits(COL_TYPE_BITS);
      69           0 :   AddStateBits(nsFrameState(type << COL_TYPE_OFFSET));
      70           0 : }
      71             : 
      72             : /* virtual */ void
      73           0 : nsTableColFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
      74             : {
      75           0 :   nsSplittableFrame::DidSetStyleContext(aOldStyleContext);
      76             : 
      77           0 :   if (!aOldStyleContext) //avoid this on init
      78           0 :     return;
      79             : 
      80           0 :   nsTableFrame* tableFrame = GetTableFrame();
      81           0 :   if (tableFrame->IsBorderCollapse() &&
      82           0 :       tableFrame->BCRecalcNeeded(aOldStyleContext, StyleContext())) {
      83           0 :     TableArea damageArea(GetColIndex(), 0, 1, tableFrame->GetRowCount());
      84           0 :     tableFrame->AddBCDamageArea(damageArea);
      85             :   }
      86             : }
      87             : 
      88           0 : void nsTableColFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
      89             :                                                  BCPixelSize aPixelValue)
      90             : {
      91           0 :   switch (aForSide) {
      92             :     case eLogicalSideBStart:
      93           0 :       mBStartContBorderWidth = aPixelValue;
      94           0 :       return;
      95             :     case eLogicalSideIEnd:
      96           0 :       mIEndContBorderWidth = aPixelValue;
      97           0 :       return;
      98             :     case eLogicalSideBEnd:
      99           0 :       mBEndContBorderWidth = aPixelValue;
     100           0 :       return;
     101             :     default:
     102           0 :       NS_ERROR("invalid side arg");
     103             :   }
     104             : }
     105             : 
     106             : void
     107           0 : nsTableColFrame::Reflow(nsPresContext*          aPresContext,
     108             :                                   ReflowOutput&     aDesiredSize,
     109             :                                   const ReflowInput& aReflowInput,
     110             :                                   nsReflowStatus&          aStatus)
     111             : {
     112           0 :   MarkInReflow();
     113           0 :   DO_GLOBAL_REFLOW_COUNT("nsTableColFrame");
     114           0 :   DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
     115           0 :   aDesiredSize.ClearSize();
     116           0 :   const nsStyleVisibility* colVis = StyleVisibility();
     117           0 :   bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
     118           0 :   if (collapseCol) {
     119           0 :     GetTableFrame()->SetNeedToCollapse(true);
     120             :   }
     121           0 :   aStatus.Reset();
     122           0 :   NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
     123           0 : }
     124             : 
     125             : void
     126           0 : nsTableColFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
     127             :                                   const nsRect&           aDirtyRect,
     128             :                                   const nsDisplayListSet& aLists)
     129             : {
     130           0 :   nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists);
     131           0 : }
     132             : 
     133           0 : int32_t nsTableColFrame::GetSpan()
     134             : {
     135           0 :   return StyleTable()->mSpan;
     136             : }
     137             : 
     138             : #ifdef DEBUG
     139           0 : void nsTableColFrame::Dump(int32_t aIndent)
     140             : {
     141           0 :   char* indent = new char[aIndent + 1];
     142           0 :   if (!indent) return;
     143           0 :   for (int32_t i = 0; i < aIndent + 1; i++) {
     144           0 :     indent[i] = ' ';
     145             :   }
     146           0 :   indent[aIndent] = 0;
     147             : 
     148           0 :   printf("%s**START COL DUMP**\n%s colIndex=%d coltype=",
     149           0 :     indent, indent, mColIndex);
     150           0 :   nsTableColType colType = GetColType();
     151           0 :   switch (colType) {
     152             :   case eColContent:
     153           0 :     printf(" content ");
     154           0 :     break;
     155             :   case eColAnonymousCol:
     156           0 :     printf(" anonymous-column ");
     157           0 :     break;
     158             :   case eColAnonymousColGroup:
     159           0 :     printf(" anonymous-colgroup ");
     160           0 :     break;
     161             :   case eColAnonymousCell:
     162           0 :     printf(" anonymous-cell ");
     163           0 :     break;
     164             :   }
     165           0 :   printf("\nm:%d c:%d(%c) p:%f sm:%d sc:%d sp:%f f:%d",
     166           0 :          int32_t(mMinCoord), int32_t(mPrefCoord),
     167           0 :          mHasSpecifiedCoord ? 's' : 'u', mPrefPercent,
     168           0 :          int32_t(mSpanMinCoord), int32_t(mSpanPrefCoord),
     169           0 :          mSpanPrefPercent,
     170           0 :          int32_t(GetFinalISize()));
     171           0 :   printf("\n%s**END COL DUMP** ", indent);
     172           0 :   delete [] indent;
     173             : }
     174             : #endif
     175             : /* ----- global methods ----- */
     176             : 
     177             : nsTableColFrame*
     178           0 : NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
     179             : {
     180           0 :   return new (aPresShell) nsTableColFrame(aContext);
     181             : }
     182             : 
     183           0 : NS_IMPL_FRAMEARENA_HELPERS(nsTableColFrame)
     184             : 
     185             : nsTableColFrame*
     186           0 : nsTableColFrame::GetNextCol() const
     187             : {
     188           0 :   nsIFrame* childFrame = GetNextSibling();
     189           0 :   while (childFrame) {
     190           0 :     if (childFrame->IsTableColFrame()) {
     191           0 :       return (nsTableColFrame*)childFrame;
     192             :     }
     193           0 :     childFrame = childFrame->GetNextSibling();
     194             :   }
     195           0 :   return nullptr;
     196             : }
     197             : 
     198             : #ifdef DEBUG_FRAME_DUMP
     199             : nsresult
     200           0 : nsTableColFrame::GetFrameName(nsAString& aResult) const
     201             : {
     202           0 :   return MakeFrameName(NS_LITERAL_STRING("TableCol"), aResult);
     203             : }
     204             : #endif
     205             : 
     206             : nsSplittableType
     207           0 : nsTableColFrame::GetSplittableType() const
     208             : {
     209           0 :   return NS_FRAME_NOT_SPLITTABLE;
     210             : }
     211             : 
     212             : void
     213           0 : nsTableColFrame::InvalidateFrame(uint32_t aDisplayItemKey)
     214             : {
     215           0 :   nsIFrame::InvalidateFrame(aDisplayItemKey);
     216           0 :   GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
     217           0 : }
     218             : 
     219             : void
     220           0 : nsTableColFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
     221             : {
     222           0 :   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);
     223             : 
     224             :   // If we have filters applied that would affects our bounds, then
     225             :   // we get an inactive layer created and this is computed
     226             :   // within FrameLayerBuilder
     227           0 :   GetParent()->InvalidateFrameWithRect(aRect + GetPosition(), aDisplayItemKey);
     228           0 : }
     229             : 

Generated by: LCOV version 1.13