Changeset 86384 in webkit
- Timestamp:
- May 12, 2011 3:00:39 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86383 r86384 1 2011-05-12 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch paintBoxShadow to use IntRect 6 https://bugs.webkit.org/show_bug.cgi?id=60713 7 8 Switching paintBoxShadow from taking four ints to taking an IntRect. 9 10 No new tests since this is refactoring. 11 12 * rendering/InlineFlowBox.cpp: 13 (WebCore::InlineFlowBox::paintBoxShadow): 14 (WebCore::InlineFlowBox::paintBoxDecorations): 15 * rendering/InlineFlowBox.h: 16 * rendering/RenderBox.cpp: 17 (WebCore::RenderBox::paintBoxDecorationsWithSize): 18 * rendering/RenderBoxModelObject.cpp: 19 (WebCore::RenderBoxModelObject::paintBoxShadow): 20 * rendering/RenderBoxModelObject.h: 21 * rendering/RenderFieldset.cpp: 22 (WebCore::RenderFieldset::paintBoxDecorations): 23 * rendering/RenderTable.cpp: 24 (WebCore::RenderTable::paintBoxDecorations): 25 * rendering/RenderTableCell.cpp: 26 (WebCore::RenderTableCell::paintBoxDecorations): 27 1 28 2011-05-12 Maciej Stachowiak <mjs@apple.com> 2 29 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r86303 r86384 1064 1064 } 1065 1065 1066 void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, ShadowStyle shadowStyle, int tx, int ty, int w, int h)1066 void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, ShadowStyle shadowStyle, const IntRect& paintRect) 1067 1067 { 1068 1068 if ((!prevLineBox() && !nextLineBox()) || !parent()) 1069 boxModelObject()->paintBoxShadow(context, tx, ty, w, h, s, shadowStyle);1069 boxModelObject()->paintBoxShadow(context, paintRect, s, shadowStyle); 1070 1070 else { 1071 1071 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 1072 1072 // protrude incorrectly at the edges, and we want to possibly include shadows cast from the previous/following lines 1073 boxModelObject()->paintBoxShadow(context, tx, ty, w, h, s, shadowStyle, includeLogicalLeftEdge(), includeLogicalRightEdge());1073 boxModelObject()->paintBoxShadow(context, paintRect, s, shadowStyle, includeLogicalLeftEdge(), includeLogicalRightEdge()); 1074 1074 } 1075 1075 } … … 1110 1110 RenderStyle* styleToUse = renderer()->style(m_firstLine); 1111 1111 if ((!parent() && m_firstLine && styleToUse != renderer()->style()) || (parent() && renderer()->hasBoxDecorations())) { 1112 IntRect paintRect = IntRect(tx, ty, w, h); 1112 1113 // Shadow comes first and is behind the background and border. 1113 paintBoxShadow(context, styleToUse, Normal, tx, ty, w, h);1114 paintBoxShadow(context, styleToUse, Normal, paintRect); 1114 1115 1115 1116 Color c = styleToUse->visitedDependentColor(CSSPropertyBackgroundColor); 1116 paintFillLayers(paintInfo, c, styleToUse->backgroundLayers(), IntRect(tx, ty, w, h));1117 paintBoxShadow(context, styleToUse, Inset, tx, ty, w, h);1117 paintFillLayers(paintInfo, c, styleToUse->backgroundLayers(), paintRect); 1118 paintBoxShadow(context, styleToUse, Inset, paintRect); 1118 1119 1119 1120 // :first-line cannot be used to put borders on a line. Always paint borders with our … … 1128 1129 // cases only a single call to draw is required. 1129 1130 if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) 1130 boxModelObject()->paintBorder(context, IntRect(tx, ty, w, h), renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge());1131 boxModelObject()->paintBorder(context, paintRect, renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge()); 1131 1132 else { 1132 1133 // We have a border image that spans multiple lines. -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r86303 r86384 108 108 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver); 109 109 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver); 110 void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, int tx, int ty, int w, int h);110 void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const IntRect&); 111 111 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom); 112 112 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, int lineTop, int lineBottom); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r86377 r86384 842 842 // FIXME: Should eventually give the theme control over whether the box shadow should paint, since controls could have 843 843 // custom shadows of their own. 844 paintBoxShadow(paintInfo.context, paintRect .x(), paintRect.y(), paintRect.width(), paintRect.height(), style(), Normal);844 paintBoxShadow(paintInfo.context, paintRect, style(), Normal); 845 845 846 846 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance(paintInfo.context); … … 871 871 theme()->paintDecorations(this, paintInfo, paintRect); 872 872 } 873 paintBoxShadow(paintInfo.context, paintRect .x(), paintRect.y(), paintRect.width(), paintRect.height(), style(), Inset);873 paintBoxShadow(paintInfo.context, paintRect, style(), Inset); 874 874 875 875 // The theme will tell us whether or not we should also paint the CSS border. -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r86359 r86384 2081 2081 } 2082 2082 2083 void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)2083 void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, const IntRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 2084 2084 { 2085 2085 // FIXME: Deal with border-image. Would be great to use border-image as a mask. … … 2088 2088 return; 2089 2089 2090 IntRect borderRect(tx, ty, w, h); 2091 RoundedIntRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge) 2092 : s->getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge); 2090 RoundedIntRect border = (shadowStyle == Inset) ? s->getRoundedInnerBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge) 2091 : s->getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge); 2093 2092 2094 2093 bool hasBorderRadius = s->hasBorderRadius(); … … 2124 2123 // Move the fill just outside the clip, adding 1 pixel separation so that the fill does not 2125 2124 // bleed in (due to antialiasing) if the context is transformed. 2126 IntSize extraOffset( w+ max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);2125 IntSize extraOffset(paintRect.width() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0); 2127 2126 shadowOffset -= extraOffset; 2128 2127 fillRect.move(extraOffset); … … 2209 2208 context->clip(border.rect()); 2210 2209 2211 IntSize extraOffset(2 * w+ max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);2210 IntSize extraOffset(2 * paintRect.width() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0); 2212 2211 context->translate(extraOffset.width(), extraOffset.height()); 2213 2212 shadowOffset -= extraOffset; -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r86359 r86384 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*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);123 void paintBoxShadow(GraphicsContext*, const IntRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 124 124 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const IntSize& = IntSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); 125 125 -
trunk/Source/WebCore/rendering/RenderFieldset.cpp
r86377 r86384 143 143 } 144 144 145 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal); 146 147 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), IntRect(tx, ty, w, h)); 148 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset); 145 IntRect paintRect = IntRect(tx, ty, w, h); 146 147 paintBoxShadow(paintInfo.context, paintRect, style(), Normal); 148 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), paintRect); 149 paintBoxShadow(paintInfo.context, paintRect, style(), Inset); 149 150 150 151 if (!style()->hasBorder()) … … 168 169 } 169 170 170 paintBorder(paintInfo.context, IntRect(tx, ty, w, h), style());171 paintBorder(paintInfo.context, paintRect, style()); 171 172 } 172 173 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r86377 r86384 559 559 subtractCaptionRect(rect); 560 560 561 paintBoxShadow(paintInfo.context, rect .x(), rect.y(), rect.width(), rect.height(), style(), Normal);561 paintBoxShadow(paintInfo.context, rect, style(), Normal); 562 562 563 563 if (isRoot()) … … 568 568 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), rect); 569 569 570 paintBoxShadow(paintInfo.context, rect .x(), rect.y(), rect.width(), rect.height(), style(), Inset);570 paintBoxShadow(paintInfo.context, rect, style(), Inset); 571 571 572 572 if (style()->hasBorder() && !collapseBorders()) -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r86377 r86384 1008 1008 return; 1009 1009 1010 int w = width(); 1011 int h = height(); 1012 1013 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal); 1010 IntRect paintRect = IntRect(IntPoint(tx, ty), size()); 1011 paintBoxShadow(paintInfo.context, paintRect, style(), Normal); 1014 1012 1015 1013 // Paint our cell background. 1016 1014 paintBackgroundsBehindCell(paintInfo, tx, ty, this); 1017 1015 1018 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);1016 paintBoxShadow(paintInfo.context, paintRect, style(), Inset); 1019 1017 1020 1018 if (!style()->hasBorder() || tableElt->collapseBorders()) 1021 1019 return; 1022 1020 1023 paintBorder(paintInfo.context, IntRect(tx, ty, w, h), style());1021 paintBorder(paintInfo.context, paintRect, style()); 1024 1022 } 1025 1023
Note: See TracChangeset
for help on using the changeset viewer.