Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: Source/core/rendering/RenderTableCell.cpp

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 int RenderTableCell::borderHalfAfter(bool outer) const 978 int RenderTableCell::borderHalfAfter(bool outer) const
979 { 979 {
980 CollapsedBorderValue border = collapsedAfterBorder(DoNotIncludeBorderColor); 980 CollapsedBorderValue border = collapsedAfterBorder(DoNotIncludeBorderColor);
981 if (border.exists()) 981 if (border.exists())
982 return (border.width() + ((styleForCellFlow()->isFlippedBlocksWritingMod e() ^ outer) ? 1 : 0)) / 2; 982 return (border.width() + ((styleForCellFlow()->isFlippedBlocksWritingMod e() ^ outer) ? 1 : 0)) / 2;
983 return 0; 983 return 0;
984 } 984 }
985 985
986 void RenderTableCell::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset ) 986 void RenderTableCell::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset )
987 { 987 {
988 ASSERT(paintInfo.phase != PaintPhaseCollapsedTableBorders); 988 ASSERT(paintInfo.getPhase() != PaintPhaseCollapsedTableBorders);
989 RenderBlock::paint(paintInfo, paintOffset); 989 RenderBlock::paint(paintInfo, paintOffset);
990 } 990 }
991 991
992 static EBorderStyle collapsedBorderStyle(EBorderStyle style) 992 static EBorderStyle collapsedBorderStyle(EBorderStyle style)
993 { 993 {
994 if (style == OUTSET) 994 if (style == OUTSET)
995 return GROOVE; 995 return GROOVE;
996 if (style == INSET) 996 if (style == INSET)
997 return RIDGE; 997 return RIDGE;
998 return style; 998 return style;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 } 1078 }
1079 1079
1080 void RenderTableCell::sortBorderValues(RenderTable::CollapsedBorderValues& borde rValues) 1080 void RenderTableCell::sortBorderValues(RenderTable::CollapsedBorderValues& borde rValues)
1081 { 1081 {
1082 qsort(borderValues.data(), borderValues.size(), sizeof(CollapsedBorderValue) , 1082 qsort(borderValues.data(), borderValues.size(), sizeof(CollapsedBorderValue) ,
1083 compareBorderValuesForQSort); 1083 compareBorderValuesForQSort);
1084 } 1084 }
1085 1085
1086 void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo int& paintOffset) 1086 void RenderTableCell::paintCollapsedBorders(PaintInfo& paintInfo, const LayoutPo int& paintOffset)
1087 { 1087 {
1088 ASSERT(paintInfo.phase == PaintPhaseCollapsedTableBorders); 1088 ASSERT(paintInfo.getPhase() == PaintPhaseCollapsedTableBorders);
1089 1089
1090 if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIB LE) 1090 if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIB LE)
1091 return; 1091 return;
1092 1092
1093 LayoutRect localRepaintRect = paintInfo.rect; 1093 LayoutRect localRepaintRect = paintInfo.getRect();
1094 localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase)); 1094 localRepaintRect.inflate(maximalOutlineSize(paintInfo.getPhase()));
1095 1095
1096 LayoutRect paintRect = LayoutRect(paintOffset + location(), pixelSnappedSize ()); 1096 LayoutRect paintRect = LayoutRect(paintOffset + location(), pixelSnappedSize ());
1097 if (paintRect.y() - table()->outerBorderTop() >= localRepaintRect.maxY()) 1097 if (paintRect.y() - table()->outerBorderTop() >= localRepaintRect.maxY())
1098 return; 1098 return;
1099 1099
1100 if (paintRect.maxY() + table()->outerBorderBottom() <= localRepaintRect.y()) 1100 if (paintRect.maxY() + table()->outerBorderBottom() <= localRepaintRect.y())
1101 return; 1101 return;
1102 1102
1103 GraphicsContext* graphicsContext = paintInfo.context; 1103 GraphicsContext* graphicsContext = paintInfo.getContext();
1104 if (!table()->currentBorderValue() || graphicsContext->paintingDisabled()) 1104 if (!table()->currentBorderValue() || graphicsContext->paintingDisabled())
1105 return; 1105 return;
1106 1106
1107 const RenderStyle* styleForCellFlow = this->styleForCellFlow(); 1107 const RenderStyle* styleForCellFlow = this->styleForCellFlow();
1108 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow); 1108 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow);
1109 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow) ; 1109 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow) ;
1110 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow); 1110 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow);
1111 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlo w); 1111 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlo w);
1112 1112
1113 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location. 1113 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 if (backgroundObject != this) 1168 if (backgroundObject != this)
1169 adjustedPaintOffset.moveBy(location()); 1169 adjustedPaintOffset.moveBy(location());
1170 1170
1171 StyleColor c = backgroundObject->resolveStyleColor(CSSPropertyBackgroundColo r); 1171 StyleColor c = backgroundObject->resolveStyleColor(CSSPropertyBackgroundColo r);
1172 const FillLayer* bgLayer = backgroundObject->style()->backgroundLayers(); 1172 const FillLayer* bgLayer = backgroundObject->style()->backgroundLayers();
1173 1173
1174 if (bgLayer->hasImage() || c.isValid()) { 1174 if (bgLayer->hasImage() || c.isValid()) {
1175 // We have to clip here because the background would paint 1175 // We have to clip here because the background would paint
1176 // on top of the borders otherwise. This only matters for cells and row s. 1176 // on top of the borders otherwise. This only matters for cells and row s.
1177 bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == t his || backgroundObject == parent()) && tableElt->collapseBorders(); 1177 bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == t his || backgroundObject == parent()) && tableElt->collapseBorders();
1178 GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip); 1178 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()), shouldCl ip);
1179 if (shouldClip) { 1179 if (shouldClip) {
1180 LayoutRect clipRect(adjustedPaintOffset.x() + borderLeft(), adjusted PaintOffset.y() + borderTop(), 1180 LayoutRect clipRect(adjustedPaintOffset.x() + borderLeft(), adjusted PaintOffset.y() + borderTop(),
1181 width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom()); 1181 width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
1182 paintInfo.context->clip(clipRect); 1182 paintInfo.getContext()->clip(clipRect);
1183 } 1183 }
1184 paintFillLayers(paintInfo, c.color(), bgLayer, LayoutRect(adjustedPaintO ffset, pixelSnappedSize()), BackgroundBleedNone, CompositeSourceOver, background Object); 1184 paintFillLayers(paintInfo, c.color(), bgLayer, LayoutRect(adjustedPaintO ffset, pixelSnappedSize()), BackgroundBleedNone, CompositeSourceOver, background Object);
1185 } 1185 }
1186 } 1186 }
1187 1187
1188 void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoin t& paintOffset) 1188 void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoin t& paintOffset)
1189 { 1189 {
1190 if (!paintInfo.shouldPaintWithinRoot(this)) 1190 if (!paintInfo.shouldPaintWithinRoot(this))
1191 return; 1191 return;
1192 1192
(...skipping 10 matching lines...) Expand all
1203 paintBoxShadow(paintInfo, paintRect, style(), Inset); 1203 paintBoxShadow(paintInfo, paintRect, style(), Inset);
1204 1204
1205 if (!style()->hasBorder() || tableElt->collapseBorders()) 1205 if (!style()->hasBorder() || tableElt->collapseBorders())
1206 return; 1206 return;
1207 1207
1208 paintBorder(paintInfo, paintRect, style()); 1208 paintBorder(paintInfo, paintRect, style());
1209 } 1209 }
1210 1210
1211 void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 1211 void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
1212 { 1212 {
1213 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 1213 if (style()->visibility() != VISIBLE || paintInfo.getPhase() != PaintPhaseMa sk)
1214 return; 1214 return;
1215 1215
1216 RenderTable* tableElt = table(); 1216 RenderTable* tableElt = table();
1217 if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstC hild()) 1217 if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstC hild())
1218 return; 1218 return;
1219 1219
1220 paintMaskImages(paintInfo, LayoutRect(paintOffset, pixelSnappedSize())); 1220 paintMaskImages(paintInfo, LayoutRect(paintOffset, pixelSnappedSize()));
1221 } 1221 }
1222 1222
1223 bool RenderTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoida nce, InlineFlowBox*) const 1223 bool RenderTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoida nce, InlineFlowBox*) const
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 1258
1259 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const Render Object* parent) 1259 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const Render Object* parent)
1260 { 1260 {
1261 RenderTableCell* newCell = RenderTableCell::createAnonymous(parent->document ()); 1261 RenderTableCell* newCell = RenderTableCell::createAnonymous(parent->document ());
1262 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), TABLE_CELL); 1262 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), TABLE_CELL);
1263 newCell->setStyle(newStyle.release()); 1263 newCell->setStyle(newStyle.release());
1264 return newCell; 1264 return newCell;
1265 } 1265 }
1266 1266
1267 } // namespace WebCore 1267 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698