Exemplo n.º 1
0
inline LayoutUnit borderBeforeInWritingMode(const LayoutBox& layoutBox, WritingMode writingMode)
{
    switch (writingMode) {
    case TopToBottomWritingMode: return layoutBox.borderTop();
    case LeftToRightWritingMode: return layoutBox.borderLeft();
    case RightToLeftWritingMode: return layoutBox.borderRight();
    }

    ASSERT_NOT_REACHED();
    return layoutBox.borderBefore();
}
Exemplo n.º 2
0
static LayoutRect getShapeImageMarginRect(
    const LayoutBox& layoutBox,
    const LayoutSize& referenceBoxLogicalSize) {
  LayoutPoint marginBoxOrigin(
      -layoutBox.marginLogicalLeft() - layoutBox.borderAndPaddingLogicalLeft(),
      -layoutBox.marginBefore() - layoutBox.borderBefore() -
          layoutBox.paddingBefore());
  LayoutSize marginBoxSizeDelta(
      layoutBox.marginLogicalWidth() + layoutBox.borderAndPaddingLogicalWidth(),
      layoutBox.marginLogicalHeight() +
          layoutBox.borderAndPaddingLogicalHeight());
  LayoutSize marginRectSize(referenceBoxLogicalSize + marginBoxSizeDelta);
  marginRectSize.clampNegativeToZero();
  return LayoutRect(marginBoxOrigin, marginRectSize);
}