Ejemplo n.º 1
0
NS_IMETHODIMP
nsBox::GetMargin(nsMargin& aMargin)
{
  aMargin.SizeTo(0,0,0,0);
  GetStyleMargin()->GetMargin(aMargin);

  return NS_OK;
}
Ejemplo n.º 2
0
/* virtual */ PRBool
nsInlineFrame::IsSelfEmpty()
{
#if 0
  // I used to think inline frames worked this way, but it seems they
  // don't.  At least not in our codebase.
  if (GetPresContext()->CompatibilityMode() == eCompatibility_FullStandards) {
    return PR_FALSE;
  }
#endif
  const nsStyleMargin* margin = GetStyleMargin();
  const nsStyleBorder* border = GetStyleBorder();
  const nsStylePadding* padding = GetStylePadding();
  // XXX Top and bottom removed, since they shouldn't affect things, but this
  // doesn't really match with nsLineLayout.cpp's setting of
  // ZeroEffectiveSpanBox, anymore, so what should this really be?
  PRBool haveRight =
    border->GetActualBorderWidth(NS_SIDE_RIGHT) != 0 ||
    !IsPaddingZero(padding->mPadding.GetRightUnit(),
                   padding->mPadding.GetRight()) ||
    !IsMarginZero(margin->mMargin.GetRightUnit(),
                  margin->mMargin.GetRight());
  PRBool haveLeft =
    border->GetActualBorderWidth(NS_SIDE_LEFT) != 0 ||
    !IsPaddingZero(padding->mPadding.GetLeftUnit(),
                   padding->mPadding.GetLeft()) ||
    !IsMarginZero(margin->mMargin.GetLeftUnit(),
                  margin->mMargin.GetLeft());
  if (haveLeft || haveRight) {
    if (GetStateBits() & NS_FRAME_IS_SPECIAL) {
      PRBool haveStart, haveEnd;
      if (NS_STYLE_DIRECTION_LTR == GetStyleVisibility()->mDirection) {
        haveStart = haveLeft;
        haveEnd = haveRight;
      } else {
        haveStart = haveRight;
        haveEnd = haveLeft;
      }
      // For special frames, ignore things we know we'll skip in GetSkipSides.
      // XXXbz should we be doing this for non-special frames too, in a more
      // general way?

      // Get the first continuation eagerly, as a performance optimization, to
      // avoid having to get it twice..
      nsIFrame* firstCont = GetFirstContinuation();
      return
        (!haveStart || nsLayoutUtils::FrameIsInLastPartOfIBSplit(firstCont)) &&
        (!haveEnd || nsLayoutUtils::FrameIsInFirstPartOfIBSplit(firstCont));
    }
    return PR_FALSE;
  }
  return PR_TRUE;
}