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(); }
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); }