//------------------------------------------------------------------------------// bool InventoryReceiver::addItemAtLocation(InventoryItem& item, int x, int y) { if (itemWillFitAtLocation(item, x, y)) { InventoryReceiver* old_receiver = dynamic_cast<InventoryReceiver*>(item.getParent()); if (old_receiver) old_receiver->removeItem(item); item.setLocationOnReceiver(x, y); writeItemToContentMap(item); addChild(&item); // set position and size. This ensures the items visually match the // logical content map. item.setPosition(UVector2(UDim(static_cast<float>(x) / contentWidth(), 0), UDim(static_cast<float>(y) / contentHeight(), 0))); item.setSize(USize( UDim(static_cast<float>(item.contentWidth()) / contentWidth(), 0), UDim(static_cast<float>(item.contentHeight()) / contentHeight(), 0))); return true; } return false; }
void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { Image* image = m_snapshotResource->image().get(); if (!image || image->isNull()) return; LayoutUnit cWidth = contentWidth(); LayoutUnit cHeight = contentHeight(); if (!cWidth || !cHeight) return; GraphicsContext& context = paintInfo.context(); LayoutSize contentSize(cWidth, cHeight); LayoutPoint contentLocation = location() + paintOffset; contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); LayoutRect rect(contentLocation, contentSize); IntRect alignedRect = snappedIntRect(rect); if (alignedRect.width() <= 0 || alignedRect.height() <= 0) return; bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, image, alignedRect.size()); ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); #if ENABLE(CSS_IMAGE_ORIENTATION) orientationDescription.setImageOrientationEnum(style().imageOrientation()); #endif context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling)); }
void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { Image* image = m_snapshotResource->image().get(); if (!image || image->isNull()) return; LayoutUnit cWidth = contentWidth(); LayoutUnit cHeight = contentHeight(); if (!cWidth || !cHeight) return; GraphicsContext& context = paintInfo.context(); LayoutSize contentSize(cWidth, cHeight); LayoutPoint contentLocation = location() + paintOffset; contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); LayoutRect rect(contentLocation, contentSize); IntRect alignedRect = snappedIntRect(rect); if (alignedRect.width() <= 0 || alignedRect.height() <= 0) return; InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, image, alignedRect.size()); ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation()); context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation)); }
void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { Image* image = m_snapshotResource->image().get(); if (!image || image->isNull()) return; LayoutUnit cWidth = contentWidth(); LayoutUnit cHeight = contentHeight(); if (!cWidth || !cHeight) return; GraphicsContext* context = paintInfo.context; #if PLATFORM(MAC) if (style()->highlight() != nullAtom && !context->paintingDisabled()) paintCustomHighlight(toPoint(paintOffset - location()), style()->highlight(), true); #endif LayoutSize contentSize(cWidth, cHeight); LayoutPoint contentLocation = location() + paintOffset; contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); LayoutRect rect(contentLocation, contentSize); IntRect alignedRect = pixelSnappedIntRect(rect); if (alignedRect.width() <= 0 || alignedRect.height() <= 0) return; bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size()); ImageOrientationDescription orientationDescription; #if ENABLE(CSS_IMAGE_ORIENTATION) orientationDescription.setImageOrientationEnum(style()->imageOrientation()); #endif context->drawImage(image, style()->colorSpace(), alignedRect, CompositeSourceOver, orientationDescription, useLowQualityScaling); }
QImage RoundButton::prepareRippleMask() const { auto innerWidth = contentWidth(); auto rounded = rtlrect(rect().marginsRemoved(_st.padding), width()); if (_fullWidthOverride < 0) { rounded = QRect(0, rounded.top(), innerWidth - _fullWidthOverride, rounded.height()); } return RippleAnimation::roundRectMask(rounded.size(), st::buttonRadius); }
int RenderSlider::trackSize() { ASSERT(m_thumb); ASSERT(m_thumb->renderer()); if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) return contentHeight() - m_thumb->renderBox()->height(); return contentWidth() - m_thumb->renderBox()->width(); }
LayoutUnit RenderRegion::logicalHeightOfAllFlowThreadContent() const { ASSERT(m_flowThread); if (hasOverrideHeight() && !m_flowThread->inConstrainedLayoutPhase()) { ASSERT(hasAutoLogicalHeight()); return overrideLogicalContentHeight(); } return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
LayoutUnit RenderNamedFlowFragment::pageLogicalHeight() const { ASSERT(isValid()); if (hasComputedAutoHeight() && m_flowThread->inMeasureContentLayoutPhase()) { ASSERT(hasAutoLogicalHeight()); return computedAutoHeight(); } return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
LayoutUnit RenderRegion::logicalHeightOfAllFlowThreadContent() const { ASSERT(m_flowThread); if (hasComputedAutoHeight() && m_flowThread->inMeasureContentLayoutPhase()) { ASSERT(hasAutoLogicalHeight()); return computedAutoHeight(); } return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
LayoutUnit RenderRegion::pageLogicalHeight() const { ASSERT(m_flowThread); if (hasComputedAutoHeight() && !m_flowThread->inConstrainedLayoutPhase()) { ASSERT(hasAutoLogicalHeight()); return computedAutoHeight(); } return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
// RenderBox methods will expect coordinates w/o any transforms in coordinates // relative to our borderBox origin. This method gives us exactly that. void RenderSVGRoot::buildLocalToBorderBoxTransform() { float scale = style()->effectiveZoom(); SVGPoint translate = svgSVGElement().currentTranslate(); LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop()); m_localToBorderBoxTransform = svgSVGElement().viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale); if (borderAndPadding.isEmpty() && scale == 1 && translate == SVGPoint::zero()) return; m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform; }
// LayoutBox methods will expect coordinates w/o any transforms in coordinates // relative to our borderBox origin. This method gives us exactly that. void LayoutSVGRoot::buildLocalToBorderBoxTransform() { SVGSVGElement* svg = toSVGSVGElement(node()); ASSERT(svg); float scale = style()->effectiveZoom(); FloatPoint translate = svg->currentTranslate(); LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop()); m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale); AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()); m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform); }
RenderObject* RenderTextControlMultiLine::layoutSpecialExcludedChild(bool relayoutChildren) { RenderObject* placeholderRenderer = RenderTextControl::layoutSpecialExcludedChild(relayoutChildren); if (!placeholderRenderer) return 0; if (!placeholderRenderer->isBox()) return placeholderRenderer; RenderBox* placeholderBox = toRenderBox(placeholderRenderer); placeholderBox->style()->setWidth(Length(contentWidth() - placeholderBox->borderAndPaddingWidth(), Fixed)); placeholderBox->layoutIfNeeded(); placeholderBox->setX(borderLeft() + paddingLeft()); placeholderBox->setY(borderTop() + paddingTop()); return placeholderRenderer; }
void RoundButton::resizeToText() { int innerWidth = contentWidth(); if (_fullWidthOverride < 0) { resize(innerWidth - _fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom()); } else if (_st.width <= 0) { resize(innerWidth - _st.width + _st.padding.left() + _st.padding.right(), _st.height + _st.padding.top() + _st.padding.bottom()); } else { if (_st.width < innerWidth + (_st.height - _st.font->height)) { auto fullText = _fullText; if (_transform == TextTransform::ToUpper) { fullText = std_::move(fullText).toUpper(); } _text = _st.font->elided(fullText, qMax(_st.width - (_st.height - _st.font->height), 1)); _textWidth = _st.font->width(_text); } resize(_st.width + _st.padding.left() + _st.padding.right(), _st.height + _st.padding.top() + _st.padding.bottom()); } }
void RenderRegion::layout() { RenderReplaced::layout(); if (m_flowThread && isValid()) { if (regionRect().width() != contentWidth() || regionRect().height() != contentHeight()) m_flowThread->invalidateRegions(); } // FIXME: We need to find a way to set up overflow properly. Our flow thread hasn't gotten a layout // yet, so we can't look to it for correct information. It's possible we could wait until after the RenderFlowThread // gets a layout, and then try to propagate overflow information back to the region, and then mark for a second layout. // That second layout would then be able to use the information from the RenderFlowThread to set up overflow. // // The big problem though is that overflow needs to be region-specific. We can't simply use the RenderFlowThread's global // overflow values, since then we'd always think any narrow region had huge overflow (all the way to the width of the // RenderFlowThread itself). // // We'll need to expand RenderBoxRegionInfo to also hold left and right overflow values. }
void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { GraphicsContext* context = paintInfo.context; if (m_imageResource->hasImage() && contentWidth() > 0 && contentHeight() > 0) { LayoutRect contentRect = contentBoxRect(); contentRect.moveBy(paintOffset); LayoutRect paintRect = replacedContentRect(); paintRect.moveBy(paintOffset); bool clip = !contentRect.contains(paintRect); if (clip) { context->save(); context->clip(contentRect); } paintIntoRect(context, paintRect); if (clip) context->restore(); } }
IntRect RenderSlider::thumbRect() { if (!m_thumb) return IntRect(); IntRect thumbRect; RenderBox* thumb = toRenderBox(m_thumb->renderer()); thumbRect.setWidth(thumb->style()->width().calcMinValue(contentWidth())); thumbRect.setHeight(thumb->style()->height().calcMinValue(contentHeight())); double fraction = sliderPosition(static_cast<HTMLInputElement*>(node())); IntRect contentRect = contentBoxRect(); if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) { thumbRect.setX(contentRect.x() + (contentRect.width() - thumbRect.width()) / 2); thumbRect.setY(contentRect.y() + static_cast<int>(nextafter((contentRect.height() - thumbRect.height()) + 1, 0) * (1 - fraction))); } else { thumbRect.setX(contentRect.x() + static_cast<int>(nextafter((contentRect.width() - thumbRect.width()) + 1, 0) * fraction)); thumbRect.setY(contentRect.y() + (contentRect.height() - thumbRect.height()) / 2); } return thumbRect; }
void RoundButton::paintEvent(QPaintEvent *e) { Painter p(this); auto innerWidth = contentWidth(); auto rounded = rect().marginsRemoved(_st.padding); if (_fullWidthOverride < 0) { rounded = QRect(0, rounded.top(), innerWidth - _fullWidthOverride, rounded.height()); } App::roundRect(p, myrtlrect(rounded), _st.textBg, ImageRoundRadius::Small); auto over = isOver(); auto down = isDown(); if (over || down) { App::roundRect(p, myrtlrect(rounded), _st.textBgOver, ImageRoundRadius::Small); } auto ms = getms(); paintRipple(p, rounded.x(), rounded.y(), ms); p.setFont(_st.font); int textLeft = _st.padding.left() + ((width() - innerWidth - _st.padding.left() - _st.padding.right()) / 2); if (_fullWidthOverride < 0) { textLeft = -_fullWidthOverride / 2; } int textTop = _st.padding.top() + _st.textTop; if (!_text.isEmpty()) { p.setPen((over || down) ? _st.textFgOver : _st.textFg); p.drawTextLeft(textLeft, textTop, width(), _text); } if (_numbers) { textLeft += _textWidth + (_textWidth ? _st.numbersSkip : 0); p.setPen((over || down) ? _st.numbersTextFgOver : _st.numbersTextFg); _numbers->paint(p, textLeft, textTop, width()); } _st.icon.paint(p, QPoint(_st.padding.left(), _st.padding.right()), width()); }
void Window::center() { auto x = (Client::SCREEN_X - contentWidth()) / 2, y = (Client::SCREEN_Y - contentHeight()) / 2; setPosition(x, y); }
void RenderSVGImage::paint(PaintInfo& paintInfo, int parentX, int parentY) { if (paintInfo.context->paintingDisabled() || (paintInfo.phase != PaintPhaseForeground) || style()->visibility() == HIDDEN) return; paintInfo.context->save(); paintInfo.context->concatCTM(AffineTransform().translate(parentX, parentY)); paintInfo.context->concatCTM(localTransform()); paintInfo.context->concatCTM(translationForAttributes()); FloatRect boundingBox = FloatRect(0, 0, width(), height()); SVGElement* svgElement = static_cast<SVGElement*>(element()); ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement); const SVGRenderStyle* svgStyle = style()->svgStyle(); AtomicString filterId(SVGURIReference::getTarget(svgStyle->filter())); AtomicString clipperId(SVGURIReference::getTarget(svgStyle->clipPath())); AtomicString maskerId(SVGURIReference::getTarget(svgStyle->maskElement())); #if ENABLE(SVG_EXPERIMENTAL_FEATURES) SVGResourceFilter* filter = getFilterById(document(), filterId); #endif SVGResourceClipper* clipper = getClipperById(document(), clipperId); SVGResourceMasker* masker = getMaskerById(document(), maskerId); #if ENABLE(SVG_EXPERIMENTAL_FEATURES) if (filter) filter->prepareFilter(paintInfo.context, boundingBox); else if (!filterId.isEmpty()) svgElement->document()->accessSVGExtensions()->addPendingResource(filterId, styledElement); #endif if (clipper) { clipper->addClient(styledElement); clipper->applyClip(paintInfo.context, boundingBox); } else if (!clipperId.isEmpty()) svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement); if (masker) { masker->addClient(styledElement); masker->applyMask(paintInfo.context, boundingBox); } else if (!maskerId.isEmpty()) svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement); float opacity = style()->opacity(); if (opacity < 1.0f) { paintInfo.context->clip(enclosingIntRect(boundingBox)); paintInfo.context->beginTransparencyLayer(opacity); } PaintInfo pi(paintInfo); pi.rect = absoluteTransform().inverse().mapRect(pi.rect); SVGImageElement* imageElt = static_cast<SVGImageElement*>(node()); FloatRect destRect(m_x, m_y, contentWidth(), contentHeight()); FloatRect srcRect(0, 0, image()->width(), image()->height()); if (imageElt->preserveAspectRatio()->align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio()); paintInfo.context->drawImage(image(), destRect, srcRect); #if ENABLE(SVG_EXPERIMENTAL_FEATURES) if (filter) filter->applyFilter(paintInfo.context, boundingBox); #endif if (opacity < 1.0f) paintInfo.context->endTransparencyLayer(); paintInfo.context->restore(); }
void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { if (paintInfo.context->paintingDisabled()) return; RenderStyle* blockStyle = toRenderMultiColumnBlock(parent())->style(); const Color& ruleColor = blockStyle->visitedDependentColor(CSSPropertyWebkitColumnRuleColor); bool ruleTransparent = blockStyle->columnRuleIsTransparent(); EBorderStyle ruleStyle = blockStyle->columnRuleStyle(); LayoutUnit ruleThickness = blockStyle->columnRuleWidth(); LayoutUnit colGap = columnGap(); bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent && ruleThickness <= colGap; if (!renderRule) return; unsigned colCount = columnCount(); if (colCount <= 1) return; bool antialias = shouldAntialiasLines(paintInfo.context); bool leftToRight = style()->isLeftToRightDirection(); LayoutUnit currLogicalLeftOffset = leftToRight ? ZERO_LAYOUT_UNIT : contentLogicalWidth(); LayoutUnit ruleAdd = borderAndPaddingLogicalLeft(); LayoutUnit ruleLogicalLeft = leftToRight ? ZERO_LAYOUT_UNIT : contentLogicalWidth(); LayoutUnit inlineDirectionSize = computedColumnWidth(); BoxSide boxSide = isHorizontalWritingMode() ? leftToRight ? BSLeft : BSRight : leftToRight ? BSTop : BSBottom; for (unsigned i = 0; i < colCount; i++) { // Move to the next position. if (leftToRight) { ruleLogicalLeft += inlineDirectionSize + colGap / 2; currLogicalLeftOffset += inlineDirectionSize + colGap; } else { ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); currLogicalLeftOffset -= (inlineDirectionSize + colGap); } // Now paint the column rule. if (i < colCount - 1) { LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft(); LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth(); LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness; IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom); drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); } ruleLogicalLeft = currLogicalLeftOffset; } }
VisiblePosition RenderContainer::positionForCoordinates(int x, int y) { // no children...return this render object's element, if there is one, and offset 0 if (!m_firstChild) return VisiblePosition(element(), 0, DOWNSTREAM); if (isTable() && element()) { int right = contentWidth() + borderRight() + paddingRight() + borderLeft() + paddingLeft(); int bottom = contentHeight() + borderTop() + paddingTop() + borderBottom() + paddingBottom(); if (x < 0 || x > right || y < 0 || y > bottom) { if (x <= right / 2) return VisiblePosition(Position(element(), 0)); else return VisiblePosition(Position(element(), maxDeepOffset(element()))); } } // Pass off to the closest child. int minDist = INT_MAX; RenderObject* closestRenderer = 0; int newX = x; int newY = y; if (isTableRow()) { newX += xPos(); newY += yPos(); } for (RenderObject* renderer = m_firstChild; renderer; renderer = renderer->nextSibling()) { if (!renderer->firstChild() && !renderer->isInline() && !renderer->isBlockFlow() || renderer->style()->visibility() != VISIBLE) continue; int top = borderTop() + paddingTop() + (isTableRow() ? 0 : renderer->yPos()); int bottom = top + renderer->contentHeight(); int left = borderLeft() + paddingLeft() + (isTableRow() ? 0 : renderer->xPos()); int right = left + renderer->contentWidth(); if (x <= right && x >= left && y <= top && y >= bottom) { if (renderer->isTableRow()) return renderer->positionForCoordinates(x + newX - renderer->xPos(), y + newY - renderer->yPos()); return renderer->positionForCoordinates(x - renderer->xPos(), y - renderer->yPos()); } // Find the distance from (x, y) to the box. Split the space around the box into 8 pieces // and use a different compare depending on which piece (x, y) is in. IntPoint cmp; if (x > right) { if (y < top) cmp = IntPoint(right, top); else if (y > bottom) cmp = IntPoint(right, bottom); else cmp = IntPoint(right, y); } else if (x < left) { if (y < top) cmp = IntPoint(left, top); else if (y > bottom) cmp = IntPoint(left, bottom); else cmp = IntPoint(left, y); } else { if (y < top) cmp = IntPoint(x, top); else cmp = IntPoint(x, bottom); } int x1minusx2 = cmp.x() - x; int y1minusy2 = cmp.y() - y; int dist = x1minusx2 * x1minusx2 + y1minusy2 * y1minusy2; if (dist < minDist) { closestRenderer = renderer; minDist = dist; } } if (closestRenderer) return closestRenderer->positionForCoordinates(newX - closestRenderer->xPos(), newY - closestRenderer->yPos()); return VisiblePosition(element(), 0, DOWNSTREAM); }
LayoutUnit RenderRegion::pageLogicalWidth() const { ASSERT(m_flowThread); return m_flowThread->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
FoSize FoExternalGraphicDoc::widthValue() { return contentWidth(); }
LayoutUnit RenderRegion::logicalHeightForFlowThreadContent() const { return m_flowThread->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { if (paintInfo.context->paintingDisabled()) return; RenderMultiColumnFlowThread* flowThread = toRenderBlockFlow(parent())->multiColumnFlowThread(); const RenderStyle& blockStyle = parent()->style(); const Color& ruleColor = blockStyle.visitedDependentColor(CSSPropertyWebkitColumnRuleColor); bool ruleTransparent = blockStyle.columnRuleIsTransparent(); EBorderStyle ruleStyle = blockStyle.columnRuleStyle(); LayoutUnit ruleThickness = blockStyle.columnRuleWidth(); LayoutUnit colGap = columnGap(); bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent; if (!renderRule) return; unsigned colCount = columnCount(); if (colCount <= 1) return; bool antialias = shouldAntialiasLines(paintInfo.context); if (flowThread->progressionIsInline()) { bool leftToRight = style().isLeftToRightDirection() ^ flowThread->progressionIsReversed(); LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogicalWidth(); LayoutUnit ruleAdd = logicalLeftOffsetForContent(); LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidth(); LayoutUnit inlineDirectionSize = computedColumnWidth(); BoxSide boxSide = isHorizontalWritingMode() ? leftToRight ? BSLeft : BSRight : leftToRight ? BSTop : BSBottom; for (unsigned i = 0; i < colCount; i++) { // Move to the next position. if (leftToRight) { ruleLogicalLeft += inlineDirectionSize + colGap / 2; currLogicalLeftOffset += inlineDirectionSize + colGap; } else { ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); currLogicalLeftOffset -= (inlineDirectionSize + colGap); } // Now paint the column rule. if (i < colCount - 1) { LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft(); LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth(); LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness; IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom); drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); } ruleLogicalLeft = currLogicalLeftOffset; } } else { bool topToBottom = !style().isFlippedBlocksWritingMode() ^ flowThread->progressionIsReversed(); LayoutUnit ruleLeft = isHorizontalWritingMode() ? LayoutUnit() : colGap / 2 - colGap - ruleThickness / 2; LayoutUnit ruleWidth = isHorizontalWritingMode() ? contentWidth() : ruleThickness; LayoutUnit ruleTop = isHorizontalWritingMode() ? colGap / 2 - colGap - ruleThickness / 2 : LayoutUnit(); LayoutUnit ruleHeight = isHorizontalWritingMode() ? ruleThickness : contentHeight(); LayoutRect ruleRect(ruleLeft, ruleTop, ruleWidth, ruleHeight); if (!topToBottom) { if (isHorizontalWritingMode()) ruleRect.setY(height() - ruleRect.maxY()); else ruleRect.setX(width() - ruleRect.maxX()); } ruleRect.moveBy(paintOffset); BoxSide boxSide = isHorizontalWritingMode() ? topToBottom ? BSTop : BSBottom : topToBottom ? BSLeft : BSRight; LayoutSize step(0, topToBottom ? computedColumnHeight() + colGap : -(computedColumnHeight() + colGap)); if (!isHorizontalWritingMode()) step = step.transposedSize(); for (unsigned i = 1; i < colCount; i++) { ruleRect.move(step); IntRect pixelSnappedRuleRect = pixelSnappedIntRect(ruleRect); drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); } } }