static LayoutRect clipRectForNinePieceImageStrip(const InlineFlowBox& box, const NinePieceImage& image, const LayoutRect& paintRect) { LayoutRect clipRect(paintRect); const ComputedStyle& style = box.lineLayoutItem().styleRef(); LayoutRectOutsets outsets = style.imageOutsets(image); if (box.isHorizontal()) { clipRect.setY(paintRect.y() - outsets.top()); clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom()); if (box.includeLogicalLeftEdge()) { clipRect.setX(paintRect.x() - outsets.left()); clipRect.setWidth(paintRect.width() + outsets.left()); } if (box.includeLogicalRightEdge()) clipRect.setWidth(clipRect.width() + outsets.right()); } else { clipRect.setX(paintRect.x() - outsets.left()); clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right()); if (box.includeLogicalLeftEdge()) { clipRect.setY(paintRect.y() - outsets.top()); clipRect.setHeight(paintRect.height() + outsets.top()); } if (box.includeLogicalRightEdge()) clipRect.setHeight(clipRect.height() + outsets.bottom()); } return clipRect; }