IntRect LayoutScrollbar::trackPieceRectWithMargins(ScrollbarPart partType, const IntRect& oldRect) const { LayoutScrollbarPart* partLayoutObject = m_parts.get(partType); if (!partLayoutObject) return oldRect; partLayoutObject->layout(); IntRect rect = oldRect; if (orientation() == HorizontalScrollbar) { rect.setX(rect.x() + partLayoutObject->marginLeft()); rect.setWidth(rect.width() - partLayoutObject->marginWidth()); } else { rect.setY(rect.y() + partLayoutObject->marginTop()); rect.setHeight(rect.height() - partLayoutObject->marginHeight()); } return rect; }
IntRect LayoutScrollbar::trackRect(int startLength, int endLength) const { LayoutScrollbarPart* part = m_parts.get(TrackBGPart); if (part) part->layout(); if (orientation() == HorizontalScrollbar) { int marginLeft = part ? part->marginLeft().toInt() : 0; int marginRight = part ? part->marginRight().toInt() : 0; startLength += marginLeft; endLength += marginRight; int totalLength = startLength + endLength; return IntRect(x() + startLength, y(), width() - totalLength, height()); } int marginTop = part ? part->marginTop().toInt() : 0; int marginBottom = part ? part->marginBottom().toInt() : 0; startLength += marginTop; endLength += marginBottom; int totalLength = startLength + endLength; return IntRect(x(), y() + startLength, width(), height() - totalLength); }