| Index: WebCore/rendering/RenderBlock.cpp
|
| ===================================================================
|
| --- WebCore/rendering/RenderBlock.cpp (revision 10232)
|
| +++ WebCore/rendering/RenderBlock.cpp (working copy)
|
| @@ -1606,20 +1606,57 @@
|
| }
|
| }
|
|
|
| -void RenderBlock::paintColumns(PaintInfo& paintInfo, int tx, int ty, bool paintingFloats)
|
| +void RenderBlock::paintColumnRules(PaintInfo& paintInfo, int tx, int ty)
|
| {
|
| + const Color& ruleColor = style()->columnRuleColor();
|
| + bool ruleTransparent = style()->columnRuleIsTransparent();
|
| + EBorderStyle ruleStyle = style()->columnRuleStyle();
|
| + int ruleWidth = style()->columnRuleWidth();
|
| + int colGap = columnGap();
|
| + bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent && ruleWidth <= colGap;
|
| + if (!renderRule)
|
| + return;
|
| +
|
| // We need to do multiple passes, breaking up our child painting into strips.
|
| + int currXOffset = 0;
|
| + int ruleAdd = borderLeft() + paddingLeft();
|
| + int ruleX = 0;
|
| + Vector<IntRect>* colRects = columnRects();
|
| + unsigned colCount = colRects->size();
|
| + for (unsigned i = 0; i < colCount; i++) {
|
| + // For each rect, we clip to the rect, and then we adjust our coords.
|
| + IntRect colRect = colRects->at(i);
|
| +
|
| + // Move to the next position.
|
| + if (style()->direction() == LTR) {
|
| + ruleX += colRect.width() + colGap / 2;
|
| + currXOffset += colRect.width() + colGap;
|
| + } else {
|
| + ruleX -= (colRect.width() + colGap / 2);
|
| + currXOffset -= (colRect.width() + colGap);
|
| + }
|
| +
|
| + // Now paint the column rule.
|
| + if (i < colCount - 1) {
|
| + int ruleStart = tx + ruleX - ruleWidth / 2 + ruleAdd;
|
| + int ruleEnd = ruleStart + ruleWidth;
|
| + int ruleTop = ty + borderTop() + paddingTop();
|
| + int ruleBottom = ruleTop + contentHeight();
|
| + drawLineForBoxSide(paintInfo.context, ruleStart, ruleTop, ruleEnd, ruleBottom,
|
| + style()->direction() == LTR ? BSLeft : BSRight, ruleColor, style()->color(), ruleStyle, 0, 0);
|
| + }
|
| +
|
| + ruleX = currXOffset;
|
| + }
|
| +}
|
| +
|
| +void RenderBlock::paintColumnContents(PaintInfo& paintInfo, int tx, int ty, bool paintingFloats)
|
| +{
|
| + // We need to do multiple passes, breaking up our child painting into strips.
|
| GraphicsContext* context = paintInfo.context;
|
| int currXOffset = 0;
|
| int currYOffset = 0;
|
| - int ruleAdd = borderLeft() + paddingLeft();
|
| - int ruleX = 0;
|
| int colGap = columnGap();
|
| - const Color& ruleColor = style()->columnRuleColor();
|
| - bool ruleTransparent = style()->columnRuleIsTransparent();
|
| - EBorderStyle ruleStyle = style()->columnRuleStyle();
|
| - int ruleWidth = style()->columnRuleWidth();
|
| - bool renderRule = !paintingFloats && ruleStyle > BHIDDEN && !ruleTransparent && ruleWidth <= colGap;
|
| Vector<IntRect>* colRects = columnRects();
|
| unsigned colCount = colRects->size();
|
| for (unsigned i = 0; i < colCount; i++) {
|
| @@ -1645,27 +1682,14 @@
|
| paintContents(info, finalX, finalY);
|
|
|
| // Move to the next position.
|
| - if (style()->direction() == LTR) {
|
| - ruleX += colRect.width() + colGap / 2;
|
| + if (style()->direction() == LTR)
|
| currXOffset += colRect.width() + colGap;
|
| - } else {
|
| - ruleX -= (colRect.width() + colGap / 2);
|
| + else
|
| currXOffset -= (colRect.width() + colGap);
|
| - }
|
| -
|
| +
|
| currYOffset -= colRect.height();
|
|
|
| context->restore();
|
| -
|
| - // Now paint the column rule.
|
| - if (renderRule && paintInfo.phase == PaintPhaseForeground && i < colCount - 1) {
|
| - int ruleStart = ruleX - ruleWidth / 2 + ruleAdd;
|
| - int ruleEnd = ruleStart + ruleWidth;
|
| - drawLineForBoxSide(paintInfo.context, tx + ruleStart, ty + borderTop() + paddingTop(), tx + ruleEnd, ty + borderTop() + paddingTop() + contentHeight(),
|
| - style()->direction() == LTR ? BSLeft : BSRight, ruleColor, style()->color(), ruleStyle, 0, 0);
|
| - }
|
| -
|
| - ruleX = currXOffset;
|
| }
|
| }
|
|
|
| @@ -1739,9 +1763,11 @@
|
| PaintPhase paintPhase = paintInfo.phase;
|
|
|
| // 1. paint background, borders etc
|
| - if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) &&
|
| - hasBoxDecorations() && style()->visibility() == VISIBLE) {
|
| - paintBoxDecorations(paintInfo, tx, ty);
|
| + if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && style()->visibility() == VISIBLE) {
|
| + if (hasBoxDecorations())
|
| + paintBoxDecorations(paintInfo, tx, ty);
|
| + if (hasColumns())
|
| + paintColumnRules(paintInfo, tx, ty);
|
| }
|
|
|
| if (paintPhase == PaintPhaseMask && style()->visibility() == VISIBLE) {
|
| @@ -1762,7 +1788,7 @@
|
| // 2. paint contents
|
| if (paintPhase != PaintPhaseSelfOutline) {
|
| if (hasColumns())
|
| - paintColumns(paintInfo, scrolledX, scrolledY);
|
| + paintColumnContents(paintInfo, scrolledX, scrolledY);
|
| else
|
| paintContents(paintInfo, scrolledX, scrolledY);
|
| }
|
| @@ -1776,7 +1802,7 @@
|
| // 4. paint floats.
|
| if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip) {
|
| if (hasColumns())
|
| - paintColumns(paintInfo, scrolledX, scrolledY, true);
|
| + paintColumnContents(paintInfo, scrolledX, scrolledY, true);
|
| else
|
| paintFloats(paintInfo, scrolledX, scrolledY, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);
|
| }
|
|
|