- Source/WebCore/ChangeLog +28 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2011-06-28  Levi Weintraub  <leviw@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Switch PaintMask* to new layout types
6
        https://bugs.webkit.org/show_bug.cgi?id=63576
7
8
        Switching paintMask* to layout type abstraction from more integral types.
9
10
        No new tests as this is just moving to an abstraction.
11
12
        * rendering/InlineFlowBox.cpp:
13
        (WebCore::InlineFlowBox::paintMask):
14
        * rendering/InlineFlowBox.h:
15
        * rendering/RenderBox.cpp:
16
        (WebCore::RenderBox::paintMask):
17
        (WebCore::RenderBox::paintMaskImages):
18
        * rendering/RenderBox.h:
19
        * rendering/RenderFieldset.cpp:
20
        (WebCore::RenderFieldset::paintMask):
21
        * rendering/RenderFieldset.h:
22
        * rendering/RenderTable.cpp:
23
        (WebCore::RenderTable::paintMask):
24
        * rendering/RenderTable.h:
25
        * rendering/RenderTableCell.cpp:
26
        (WebCore::RenderTableCell::paintMask):
27
        * rendering/RenderTableCell.h:
28
1
2011-06-28  Levi Weintraub  <leviw@chromium.org>
29
2011-06-28  Levi Weintraub  <leviw@chromium.org>
2
30
3
        Reviewed by Eric Seidel.
31
        Reviewed by Eric Seidel.
- Source/WebCore/rendering/InlineFlowBox.cpp -13 / +13 lines
Lines 1163-1182 void InlineFlowBox::paintBoxDecorations( Source/WebCore/rendering/InlineFlowBox.cpp_sec1
1163
    }
1163
    }
1164
}
1164
}
1165
1165
1166
void InlineFlowBox::paintMask(PaintInfo& paintInfo, const IntPoint& paintOffset)
1166
void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
1167
{
1167
{
1168
    if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
1168
    if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
1169
        return;
1169
        return;
1170
1170
1171
    // Pixel snap mask painting.
1171
    // Pixel snap mask painting.
1172
    IntRect frameRect = roundedFrameRect();
1172
    LayoutRect frameRect = roundedFrameRect();
1173
1173
1174
    constrainToLineTopAndBottomIfNeeded(frameRect);
1174
    constrainToLineTopAndBottomIfNeeded(frameRect);
1175
    
1175
    
1176
    // Move x/y to our coordinates.
1176
    // Move x/y to our coordinates.
1177
    IntRect localRect(frameRect);
1177
    LayoutRect localRect(frameRect);
1178
    flipForWritingMode(localRect);
1178
    flipForWritingMode(localRect);
1179
    IntPoint adjustedPaintOffset = paintOffset + localRect.location();
1179
    LayoutPoint adjustedPaintOffset = paintOffset + localRect.location();
1180
1180
1181
    const NinePieceImage& maskNinePieceImage = renderer()->style()->maskBoxImage();
1181
    const NinePieceImage& maskNinePieceImage = renderer()->style()->maskBoxImage();
1182
    StyleImage* maskBoxImage = renderer()->style()->maskBoxImage().image();
1182
    StyleImage* maskBoxImage = renderer()->style()->maskBoxImage().image();
Lines 1197-1203 void InlineFlowBox::paintMask(PaintInfo& Source/WebCore/rendering/InlineFlowBox.cpp_sec2
1197
        }
1197
        }
1198
    }
1198
    }
1199
1199
1200
    IntRect paintRect = IntRect(adjustedPaintOffset, frameRect.size());
1200
    LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size());
1201
    paintFillLayers(paintInfo, Color(), renderer()->style()->maskLayers(), paintRect, compositeOp);
1201
    paintFillLayers(paintInfo, Color(), renderer()->style()->maskLayers(), paintRect, compositeOp);
1202
    
1202
    
1203
    bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer()->style()->effectiveZoom());
1203
    bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer()->style()->effectiveZoom());
Lines 1207-1230 void InlineFlowBox::paintMask(PaintInfo& Source/WebCore/rendering/InlineFlowBox.cpp_sec3
1207
    // The simple case is where we are the only box for this object.  In those
1207
    // The simple case is where we are the only box for this object.  In those
1208
    // cases only a single call to draw is required.
1208
    // cases only a single call to draw is required.
1209
    if (!prevLineBox() && !nextLineBox()) {
1209
    if (!prevLineBox() && !nextLineBox()) {
1210
        boxModelObject()->paintNinePieceImage(paintInfo.context, IntRect(adjustedPaintOffset, frameRect.size()), renderer()->style(), maskNinePieceImage, compositeOp);
1210
        boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adjustedPaintOffset, frameRect.size()), renderer()->style(), maskNinePieceImage, compositeOp);
1211
    } else {
1211
    } else {
1212
        // We have a mask image that spans multiple lines.
1212
        // We have a mask image that spans multiple lines.
1213
        // We need to adjust _tx and _ty by the width of all previous lines.
1213
        // We need to adjust _tx and _ty by the width of all previous lines.
1214
        int logicalOffsetOnLine = 0;
1214
        LayoutUnit logicalOffsetOnLine = 0;
1215
        for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
1215
        for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
1216
            logicalOffsetOnLine += curr->logicalWidth();
1216
            logicalOffsetOnLine += curr->logicalWidth();
1217
        int totalLogicalWidth = logicalOffsetOnLine;
1217
        LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
1218
        for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
1218
        for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
1219
            totalLogicalWidth += curr->logicalWidth();
1219
            totalLogicalWidth += curr->logicalWidth();
1220
        int stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
1220
        LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
1221
        int stripY = adjustedPaintOffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
1221
        LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
1222
        int stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
1222
        LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
1223
        int stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
1223
        LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
1224
1224
1225
        GraphicsContextStateSaver stateSaver(*paintInfo.context);
1225
        GraphicsContextStateSaver stateSaver(*paintInfo.context);
1226
        paintInfo.context->clip(paintRect);
1226
        paintInfo.context->clip(paintRect);
1227
        boxModelObject()->paintNinePieceImage(paintInfo.context, IntRect(stripX, stripY, stripWidth, stripHeight), renderer()->style(), maskNinePieceImage, compositeOp);
1227
        boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style(), maskNinePieceImage, compositeOp);
1228
    }
1228
    }
1229
    
1229
    
1230
    if (pushTransparencyLayer)
1230
    if (pushTransparencyLayer)
- Source/WebCore/rendering/InlineFlowBox.h -1 / +1 lines
Lines 104-110 public: Source/WebCore/rendering/InlineFlowBox.h_sec1
104
    IntRect roundedFrameRect() const;
104
    IntRect roundedFrameRect() const;
105
    
105
    
106
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
106
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
107
    virtual void paintMask(PaintInfo&, const IntPoint&);
107
    virtual void paintMask(PaintInfo&, const LayoutPoint&);
108
    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
108
    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
109
    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
109
    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
110
    void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const IntRect&);
110
    void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const IntRect&);
- Source/WebCore/rendering/RenderBox.cpp -3 / +3 lines
Lines 878-889 void RenderBox::paintBoxDecorations(Pain Source/WebCore/rendering/RenderBox.cpp_sec1
878
        paintInfo.context->endTransparencyLayer();
878
        paintInfo.context->endTransparencyLayer();
879
}
879
}
880
880
881
void RenderBox::paintMask(PaintInfo& paintInfo, const IntPoint& paintOffset)
881
void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
882
{
882
{
883
    if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled())
883
    if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled())
884
        return;
884
        return;
885
885
886
    IntRect paintRect = IntRect(paintOffset, size());
886
    LayoutRect paintRect = LayoutRect(paintOffset, size());
887
887
888
    // border-fit can adjust where we paint our border and background.  If set, we snugly fit our line box descendants.  (The iChat
888
    // border-fit can adjust where we paint our border and background.  If set, we snugly fit our line box descendants.  (The iChat
889
    // balloon layout is an example of this).
889
    // balloon layout is an example of this).
Lines 892-898 void RenderBox::paintMask(PaintInfo& pai Source/WebCore/rendering/RenderBox.cpp_sec2
892
    paintMaskImages(paintInfo, paintRect);
892
    paintMaskImages(paintInfo, paintRect);
893
}
893
}
894
894
895
void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const IntRect& paintRect)
895
void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& paintRect)
896
{
896
{
897
    // Figure out if we need to push a transparency layer to render our mask.
897
    // Figure out if we need to push a transparency layer to render our mask.
898
    bool pushTransparencyLayer = false;
898
    bool pushTransparencyLayer = false;
- Source/WebCore/rendering/RenderBox.h -2 / +2 lines
Lines 354-360 public: Source/WebCore/rendering/RenderBox.h_sec1
354
354
355
    virtual void paintObject(PaintInfo&, const IntPoint&) { ASSERT_NOT_REACHED(); }
355
    virtual void paintObject(PaintInfo&, const IntPoint&) { ASSERT_NOT_REACHED(); }
356
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
356
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
357
    virtual void paintMask(PaintInfo&, const IntPoint&);
357
    virtual void paintMask(PaintInfo&, const LayoutPoint&);
358
    virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
358
    virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
359
359
360
    // Called when a positioned object moves but doesn't necessarily change size.  A simplified layout is attempted
360
    // Called when a positioned object moves but doesn't necessarily change size.  A simplified layout is attempted
Lines 420-426 protected: Source/WebCore/rendering/RenderBox.h_sec2
420
    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
420
    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
421
    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
421
    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
422
422
423
    void paintMaskImages(const PaintInfo&, const IntRect&);
423
    void paintMaskImages(const PaintInfo&, const LayoutRect&);
424
424
425
#if PLATFORM(MAC)
425
#if PLATFORM(MAC)
426
    void paintCustomHighlight(const IntPoint&, const AtomicString& type, bool behindText);
426
    void paintCustomHighlight(const IntPoint&, const AtomicString& type, bool behindText);
- Source/WebCore/rendering/RenderFieldset.cpp -4 / +4 lines
Lines 168-179 void RenderFieldset::paintBoxDecorations Source/WebCore/rendering/RenderFieldset.cpp_sec1
168
    paintBorder(paintInfo.context, paintRect, style());
168
    paintBorder(paintInfo.context, paintRect, style());
169
}
169
}
170
170
171
void RenderFieldset::paintMask(PaintInfo& paintInfo, const IntPoint& paintOffset)
171
void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
172
{
172
{
173
    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
173
    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
174
        return;
174
        return;
175
175
176
    IntRect paintRect = IntRect(paintOffset, size());
176
    LayoutRect paintRect = LayoutRect(paintOffset, size());
177
    RenderBox* legend = findLegend();
177
    RenderBox* legend = findLegend();
178
    if (!legend)
178
    if (!legend)
179
        return RenderBlock::paintMask(paintInfo, paintOffset);
179
        return RenderBlock::paintMask(paintInfo, paintOffset);
Lines 182-192 void RenderFieldset::paintMask(PaintInfo Source/WebCore/rendering/RenderFieldset.cpp_sec2
182
    // cases the legend is embedded in the right and bottom borders respectively.
182
    // cases the legend is embedded in the right and bottom borders respectively.
183
    // https://bugs.webkit.org/show_bug.cgi?id=47236
183
    // https://bugs.webkit.org/show_bug.cgi?id=47236
184
    if (style()->isHorizontalWritingMode()) {
184
    if (style()->isHorizontalWritingMode()) {
185
        int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
185
        LayoutUnit yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
186
        paintRect.expand(0, -yOff);
186
        paintRect.expand(0, -yOff);
187
        paintRect.move(0, yOff);
187
        paintRect.move(0, yOff);
188
    } else {
188
    } else {
189
        int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
189
        LayoutUnit xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
190
        paintRect.expand(-xOff, 0);
190
        paintRect.expand(-xOff, 0);
191
        paintRect.move(xOff, 0);
191
        paintRect.move(xOff, 0);
192
    }
192
    }
- Source/WebCore/rendering/RenderFieldset.h -1 / +1 lines
Lines 45-51 private: Source/WebCore/rendering/RenderFieldset.h_sec1
45
    virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; }
45
    virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; }
46
46
47
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
47
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
48
    virtual void paintMask(PaintInfo&, const IntPoint&);
48
    virtual void paintMask(PaintInfo&, const LayoutPoint&);
49
};
49
};
50
50
51
inline RenderFieldset* toRenderFieldset(RenderObject* object)
51
inline RenderFieldset* toRenderFieldset(RenderObject* object)
- Source/WebCore/rendering/RenderTable.cpp -2 / +2 lines
Lines 572-583 void RenderTable::paintBoxDecorations(Pa Source/WebCore/rendering/RenderTable.cpp_sec1
572
        paintBorder(paintInfo.context, rect, style());
572
        paintBorder(paintInfo.context, rect, style());
573
}
573
}
574
574
575
void RenderTable::paintMask(PaintInfo& paintInfo, const IntPoint& paintOffset)
575
void RenderTable::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
576
{
576
{
577
    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
577
    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
578
        return;
578
        return;
579
579
580
    IntRect rect(paintOffset, size());
580
    LayoutRect rect(paintOffset, size());
581
    subtractCaptionRect(rect);
581
    subtractCaptionRect(rect);
582
582
583
    paintMaskImages(paintInfo, rect);
583
    paintMaskImages(paintInfo, rect);
- Source/WebCore/rendering/RenderTable.h -1 / +1 lines
Lines 217-223 private: Source/WebCore/rendering/RenderTable.h_sec1
217
    virtual void paint(PaintInfo&, const IntPoint&);
217
    virtual void paint(PaintInfo&, const IntPoint&);
218
    virtual void paintObject(PaintInfo&, const IntPoint&);
218
    virtual void paintObject(PaintInfo&, const IntPoint&);
219
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
219
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
220
    virtual void paintMask(PaintInfo&, const IntPoint&);
220
    virtual void paintMask(PaintInfo&, const LayoutPoint&);
221
    virtual void layout();
221
    virtual void layout();
222
    virtual void computePreferredLogicalWidths();
222
    virtual void computePreferredLogicalWidths();
223
    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);
223
    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);
- Source/WebCore/rendering/RenderTableCell.cpp -2 / +2 lines
Lines 1019-1025 void RenderTableCell::paintBoxDecoration Source/WebCore/rendering/RenderTableCell.cpp_sec1
1019
    paintBorder(paintInfo.context, paintRect, style());
1019
    paintBorder(paintInfo.context, paintRect, style());
1020
}
1020
}
1021
1021
1022
void RenderTableCell::paintMask(PaintInfo& paintInfo, const IntPoint& paintOffset)
1022
void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
1023
{
1023
{
1024
    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
1024
    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
1025
        return;
1025
        return;
Lines 1028-1034 void RenderTableCell::paintMask(PaintInf Source/WebCore/rendering/RenderTableCell.cpp_sec2
1028
    if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild())
1028
    if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild())
1029
        return;
1029
        return;
1030
   
1030
   
1031
    paintMaskImages(paintInfo, IntRect(paintOffset, size()));
1031
    paintMaskImages(paintInfo, LayoutRect(paintOffset, size()));
1032
}
1032
}
1033
1033
1034
void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged)
1034
void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged)
- Source/WebCore/rendering/RenderTableCell.h -1 / +1 lines
Lines 143-149 private: Source/WebCore/rendering/RenderTableCell.h_sec1
143
    virtual void computeLogicalWidth();
143
    virtual void computeLogicalWidth();
144
144
145
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
145
    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
146
    virtual void paintMask(PaintInfo&, const IntPoint&);
146
    virtual void paintMask(PaintInfo&, const LayoutPoint&);
147
147
148
    virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
148
    virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
149
    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
149
    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);

Return to Bug 63576