Changeset 89979 in webkit
- Timestamp:
- Jun 28, 2011 5:53:04 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89977 r89979 1 2011-06-28 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch paintBoxShadow and paintBoxDecorations to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63577 7 8 Switching paintBoxShadow and paintBoxDecorations to layout type abstraction 9 from more integral types. 10 11 No new tests as this is just moving to an abstraction. 12 13 * rendering/InlineFlowBox.cpp: 14 (WebCore::InlineFlowBox::paintBoxShadow): 15 (WebCore::InlineFlowBox::paintBoxDecorations): 16 * rendering/InlineFlowBox.h: 17 * rendering/RenderBox.cpp: 18 (WebCore::RenderBox::paintBoxDecorations): 19 * rendering/RenderBox.h: 20 * rendering/RenderBoxModelObject.cpp: 21 (WebCore::RenderBoxModelObject::paintBoxShadow): 22 * rendering/RenderBoxModelObject.h: 23 * rendering/RenderFieldset.cpp: 24 (WebCore::RenderFieldset::paintBoxDecorations): 25 * rendering/RenderFieldset.h: 26 * rendering/RenderTable.cpp: 27 (WebCore::RenderTable::paintBoxDecorations): 28 * rendering/RenderTable.h: 29 * rendering/RenderTableCell.cpp: 30 (WebCore::RenderTableCell::paintBoxDecorations): 31 * rendering/RenderTableCell.h: 32 * rendering/RenderView.cpp: 33 (WebCore::RenderView::paintBoxDecorations): 34 * rendering/RenderView.h: 35 1 36 2011-06-28 Emil A Eklund <eae@chromium.org> 2 37 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r89974 r89979 1064 1064 } 1065 1065 1066 void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, ShadowStyle shadowStyle, const IntRect& paintRect)1066 void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect) 1067 1067 { 1068 1068 if ((!prevLineBox() && !nextLineBox()) || !parent()) … … 1095 1095 } 1096 1096 1097 void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)1097 void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 1098 1098 { 1099 1099 if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) … … 1101 1101 1102 1102 // Pixel snap background/border painting. 1103 IntRect frameRect = roundedFrameRect();1103 LayoutRect frameRect = roundedFrameRect(); 1104 1104 1105 1105 constrainToLineTopAndBottomIfNeeded(frameRect); 1106 1106 1107 1107 // Move x/y to our coordinates. 1108 IntRect localRect(frameRect);1108 LayoutRect localRect(frameRect); 1109 1109 flipForWritingMode(localRect); 1110 IntPoint adjustedPaintoffset = paintOffset + localRect.location();1110 LayoutPoint adjustedPaintoffset = paintOffset + localRect.location(); 1111 1111 1112 1112 GraphicsContext* context = paintInfo.context; … … 1116 1116 RenderStyle* styleToUse = renderer()->style(m_firstLine); 1117 1117 if ((!parent() && m_firstLine && styleToUse != renderer()->style()) || (parent() && renderer()->hasBoxDecorations())) { 1118 IntRect paintRect = IntRect(adjustedPaintoffset, frameRect.size());1118 LayoutRect paintRect = LayoutRect(adjustedPaintoffset, frameRect.size()); 1119 1119 // Shadow comes first and is behind the background and border. 1120 1120 paintBoxShadow(context, styleToUse, Normal, paintRect); … … 1145 1145 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right, 1146 1146 // but it isn't even clear how this should work at all. 1147 int logicalOffsetOnLine = 0;1147 LayoutUnit logicalOffsetOnLine = 0; 1148 1148 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox()) 1149 1149 logicalOffsetOnLine += curr->logicalWidth(); 1150 int totalLogicalWidth = logicalOffsetOnLine;1150 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; 1151 1151 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) 1152 1152 totalLogicalWidth += curr->logicalWidth(); 1153 int stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);1154 int stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);1155 int stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();1156 int stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;1153 LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0); 1154 LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine); 1155 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width(); 1156 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth; 1157 1157 1158 1158 GraphicsContextStateSaver stateSaver(*context); 1159 1159 context->clip(paintRect); 1160 boxModelObject()->paintBorder(context, IntRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());1160 boxModelObject()->paintBorder(context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style()); 1161 1161 } 1162 1162 } -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r89974 r89979 104 104 IntRect roundedFrameRect() const; 105 105 106 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);106 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); 107 107 virtual void paintMask(PaintInfo&, const LayoutPoint&); 108 108 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver); 109 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 LayoutRect&); 111 111 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 112 112 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, int lineTop, int lineBottom); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r89977 r89979 828 828 } 829 829 830 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)830 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 831 831 { 832 832 if (!paintInfo.shouldPaintWithinRoot(this)) 833 833 return; 834 IntRect paintRect(paintOffset, size());834 LayoutRect paintRect(paintOffset, size()); 835 835 836 836 // border-fit can adjust where we paint our border and background. If set, we snugly fit our line box descendants. (The iChat -
trunk/Source/WebCore/rendering/RenderBox.h
r89977 r89979 354 354 355 355 virtual void paintObject(PaintInfo&, const IntPoint&) { ASSERT_NOT_REACHED(); } 356 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);356 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); 357 357 virtual void paintMask(PaintInfo&, const LayoutPoint&); 358 358 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r89977 r89979 2091 2091 } 2092 2092 2093 void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, const IntRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)2093 void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, const LayoutRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 2094 2094 { 2095 2095 // FIXME: Deal with border-image. Would be great to use border-image as a mask. … … 2109 2109 continue; 2110 2110 2111 IntSize shadowOffset(shadow->x(), shadow->y());2112 int shadowBlur = shadow->blur();2113 int shadowSpread = shadow->spread();2111 LayoutSize shadowOffset(shadow->x(), shadow->y()); 2112 LayoutUnit shadowBlur = shadow->blur(); 2113 LayoutUnit shadowSpread = shadow->spread(); 2114 2114 2115 2115 if (shadowOffset.isZero() && !shadowBlur && !shadowSpread) … … 2124 2124 continue; 2125 2125 2126 IntRect shadowRect(border.rect());2126 LayoutRect shadowRect(border.rect()); 2127 2127 shadowRect.inflate(shadowBlur + shadowSpread); 2128 2128 shadowRect.move(shadowOffset); … … 2133 2133 // Move the fill just outside the clip, adding 1 pixel separation so that the fill does not 2134 2134 // bleed in (due to antialiasing) if the context is transformed. 2135 IntSize extraOffset(paintRect.width() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);2135 LayoutSize extraOffset(paintRect.width() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0); 2136 2136 shadowOffset -= extraOffset; 2137 2137 fillRect.move(extraOffset); … … 2158 2158 context->fillRoundedRect(fillRect, Color::black, s->colorSpace()); 2159 2159 } else { 2160 IntRect rectToClipOut = border.rect();2160 LayoutRect rectToClipOut = border.rect(); 2161 2161 2162 2162 // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time … … 2177 2177 } else { 2178 2178 // Inset shadow. 2179 IntRect holeRect(border.rect());2179 LayoutRect holeRect(border.rect()); 2180 2180 holeRect.inflate(-shadowSpread); 2181 2181 … … 2206 2206 Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255); 2207 2207 2208 IntRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset);2208 LayoutRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset); 2209 2209 RoundedIntRect roundedHole(holeRect, border.radii()); 2210 2210 … … 2218 2218 context->clip(border.rect()); 2219 2219 2220 IntSize extraOffset(2 * paintRect.width() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);2220 LayoutSize extraOffset(2 * paintRect.width() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0); 2221 2221 context->translate(extraOffset.width(), extraOffset.height()); 2222 2222 shadowOffset -= extraOffset; -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r89977 r89979 121 121 void paintBorder(GraphicsContext*, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 122 122 bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); 123 void paintBoxShadow(GraphicsContext*, const IntRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);123 void paintBoxShadow(GraphicsContext*, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 124 124 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); 125 125 -
trunk/Source/WebCore/rendering/RenderFieldset.cpp
r89974 r89979 119 119 } 120 120 121 void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)121 void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 122 122 { 123 123 if (!paintInfo.shouldPaintWithinRoot(this)) 124 124 return; 125 125 126 IntRect paintRect(paintOffset, size());126 LayoutRect paintRect(paintOffset, size()); 127 127 RenderBox* legend = findLegend(); 128 128 if (!legend) … … 133 133 // https://bugs.webkit.org/show_bug.cgi?id=47236 134 134 if (style()->isHorizontalWritingMode()) { 135 int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;135 LayoutUnit yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2; 136 136 paintRect.setHeight(paintRect.height() - yOff); 137 137 paintRect.setY(paintRect.y() + yOff); 138 138 } else { 139 int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;139 LayoutUnit xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2; 140 140 paintRect.setWidth(paintRect.width() - xOff); 141 141 paintRect.setX(paintRect.x() + xOff); … … 157 157 // https://bugs.webkit.org/show_bug.cgi?id=47236 158 158 if (style()->isHorizontalWritingMode()) { 159 int clipTop = paintRect.y();160 int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());161 graphicsContext->clipOut( IntRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));159 LayoutUnit clipTop = paintRect.y(); 160 LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWidth()), legend->height()); 161 graphicsContext->clipOut(LayoutRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight)); 162 162 } else { 163 int clipLeft = paintRect.x();164 int clipWidth = max(static_cast<int>(style()->borderLeftWidth()), legend->width());165 graphicsContext->clipOut( IntRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));163 LayoutUnit clipLeft = paintRect.x(); 164 LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWidth()), legend->width()); 165 graphicsContext->clipOut(LayoutRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height())); 166 166 } 167 167 -
trunk/Source/WebCore/rendering/RenderFieldset.h
r89974 r89979 45 45 virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; } 46 46 47 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);47 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); 48 48 virtual void paintMask(PaintInfo&, const LayoutPoint&); 49 49 }; -
trunk/Source/WebCore/rendering/RenderTable.cpp
r89974 r89979 550 550 } 551 551 552 void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)552 void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 553 553 { 554 554 if (!paintInfo.shouldPaintWithinRoot(this)) 555 555 return; 556 556 557 IntRect rect(paintOffset, size());557 LayoutRect rect(paintOffset, size()); 558 558 subtractCaptionRect(rect); 559 559 -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r89974 r89979 997 997 } 998 998 999 void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)999 void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 1000 1000 { 1001 1001 if (!paintInfo.shouldPaintWithinRoot(this)) … … 1006 1006 return; 1007 1007 1008 IntRect paintRect = IntRect(paintOffset, size());1008 LayoutRect paintRect = LayoutRect(paintOffset, size()); 1009 1009 paintBoxShadow(paintInfo.context, paintRect, style(), Normal); 1010 1010 -
trunk/Source/WebCore/rendering/RenderTableCell.h
r89974 r89979 143 143 virtual void computeLogicalWidth(); 144 144 145 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);145 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); 146 146 virtual void paintMask(PaintInfo&, const LayoutPoint&); 147 147 -
trunk/Source/WebCore/rendering/RenderView.cpp
r89760 r89979 186 186 } 187 187 188 void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint&)188 void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&) 189 189 { 190 190 // Check to see if we are enclosed by a layer that requires complex painting rules. If so, we cannot blit -
trunk/Source/WebCore/rendering/RenderView.h
r89754 r89979 71 71 72 72 virtual void paint(PaintInfo&, const IntPoint&); 73 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);73 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); 74 74 75 75 enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld };
Note: See TracChangeset
for help on using the changeset viewer.