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

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

Issue 550363004: Factor painting code out of RenderBox into a new class called BoxPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Created 6 years, 3 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 | Annotate | Revision Log
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 25 matching lines...) Expand all
36 #include "platform/geometry/FloatQuad.h" 36 #include "platform/geometry/FloatQuad.h"
37 #include "platform/geometry/TransformState.h" 37 #include "platform/geometry/TransformState.h"
38 #include "platform/graphics/GraphicsContextStateSaver.h" 38 #include "platform/graphics/GraphicsContextStateSaver.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 using namespace HTMLNames; 42 using namespace HTMLNames;
43 43
44 struct SameSizeAsRenderTableCell : public RenderBlockFlow { 44 struct SameSizeAsRenderTableCell : public RenderBlockFlow {
45 unsigned bitfields; 45 unsigned bitfields;
46 int paddings[2]; 46 int paddings[4];
47 }; 47 };
48 48
49 COMPILE_ASSERT(sizeof(RenderTableCell) == sizeof(SameSizeAsRenderTableCell), Ren derTableCell_should_stay_small); 49 COMPILE_ASSERT(sizeof(RenderTableCell) == sizeof(SameSizeAsRenderTableCell), Ren derTableCell_should_stay_small);
50 COMPILE_ASSERT(sizeof(CollapsedBorderValue) == 8, CollapsedBorderValue_should_st ay_small); 50 COMPILE_ASSERT(sizeof(CollapsedBorderValue) == 8, CollapsedBorderValue_should_st ay_small);
51 51
52 RenderTableCell::RenderTableCell(Element* element) 52 RenderTableCell::RenderTableCell(Element* element)
53 : RenderBlockFlow(element) 53 : RenderBlockFlow(element)
54 , m_column(unsetColumnIndex) 54 , m_column(unsetColumnIndex)
55 , m_cellWidthChanged(false) 55 , m_cellWidthChanged(false)
56 , m_intrinsicPaddingBefore(0) 56 , m_intrinsicPaddingBefore(0)
57 , m_intrinsicPaddingAfter(0) 57 , m_intrinsicPaddingAfter(0)
58 , m_boxPainter(BoxPainter(*this))
58 { 59 {
59 // We only update the flags when notified of DOM changes in colSpanOrRowSpan Changed() 60 // We only update the flags when notified of DOM changes in colSpanOrRowSpan Changed()
60 // so we need to set their initial values here in case something asks for co lSpan()/rowSpan() before then. 61 // so we need to set their initial values here in case something asks for co lSpan()/rowSpan() before then.
61 updateColAndRowSpanFlags(); 62 updateColAndRowSpanFlags();
62 } 63 }
63 64
64 void RenderTableCell::willBeRemovedFromTree() 65 void RenderTableCell::willBeRemovedFromTree()
65 { 66 {
66 RenderBlockFlow::willBeRemovedFromTree(); 67 RenderBlockFlow::willBeRemovedFromTree();
67 68
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 if (bgLayer.hasImage() || c.alpha()) { 1178 if (bgLayer.hasImage() || c.alpha()) {
1178 // We have to clip here because the background would paint 1179 // We have to clip here because the background would paint
1179 // on top of the borders otherwise. This only matters for cells and row s. 1180 // on top of the borders otherwise. This only matters for cells and row s.
1180 bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == t his || backgroundObject == parent()) && tableElt->collapseBorders(); 1181 bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == t his || backgroundObject == parent()) && tableElt->collapseBorders();
1181 GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip); 1182 GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip);
1182 if (shouldClip) { 1183 if (shouldClip) {
1183 LayoutRect clipRect(adjustedPaintOffset.x() + borderLeft(), adjusted PaintOffset.y() + borderTop(), 1184 LayoutRect clipRect(adjustedPaintOffset.x() + borderLeft(), adjusted PaintOffset.y() + borderTop(),
1184 width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom()); 1185 width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
1185 paintInfo.context->clip(clipRect); 1186 paintInfo.context->clip(clipRect);
1186 } 1187 }
1187 paintFillLayers(paintInfo, c, bgLayer, LayoutRect(adjustedPaintOffset, p ixelSnappedSize()), BackgroundBleedNone, CompositeSourceOver, backgroundObject); 1188 m_boxPainter.paintFillLayers(paintInfo, c, bgLayer, LayoutRect(adjustedP aintOffset, pixelSnappedSize()), BackgroundBleedNone, CompositeSourceOver, backg roundObject);
1188 } 1189 }
1189 } 1190 }
1190 1191
1191 void RenderTableCell::paintBoxDecorationBackground(PaintInfo& paintInfo, const L ayoutPoint& paintOffset) 1192 void RenderTableCell::paintBoxDecorationBackground(PaintInfo& paintInfo, const L ayoutPoint& paintOffset)
1192 { 1193 {
1193 if (!paintInfo.shouldPaintWithinRoot(this)) 1194 if (!paintInfo.shouldPaintWithinRoot(this))
1194 return; 1195 return;
1195 1196
1196 RenderTable* tableElt = table(); 1197 RenderTable* tableElt = table();
1197 if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstC hild()) 1198 if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstC hild())
(...skipping 15 matching lines...) Expand all
1213 1214
1214 void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOf fset) 1215 void RenderTableCell::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOf fset)
1215 { 1216 {
1216 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 1217 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
1217 return; 1218 return;
1218 1219
1219 RenderTable* tableElt = table(); 1220 RenderTable* tableElt = table();
1220 if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstC hild()) 1221 if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstC hild())
1221 return; 1222 return;
1222 1223
1223 paintMaskImages(paintInfo, LayoutRect(paintOffset, pixelSnappedSize())); 1224 m_boxPainter.paintMaskImages(paintInfo, LayoutRect(paintOffset, pixelSnapped Size()));
1224 } 1225 }
1225 1226
1226 bool RenderTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoida nce, InlineFlowBox*) const 1227 bool RenderTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoida nce, InlineFlowBox*) const
1227 { 1228 {
1228 return false; 1229 return false;
1229 } 1230 }
1230 1231
1231 void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool ve rticalScrollbarChanged) 1232 void RenderTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool ve rticalScrollbarChanged)
1232 { 1233 {
1233 LayoutUnit scrollbarHeight = scrollbarLogicalHeight(); 1234 LayoutUnit scrollbarHeight = scrollbarLogicalHeight();
(...skipping 27 matching lines...) Expand all
1261 1262
1262 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const Render Object* parent) 1263 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const Render Object* parent)
1263 { 1264 {
1264 RenderTableCell* newCell = RenderTableCell::createAnonymous(&parent->documen t()); 1265 RenderTableCell* newCell = RenderTableCell::createAnonymous(&parent->documen t());
1265 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), TABLE_CELL); 1266 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parent->style(), TABLE_CELL);
1266 newCell->setStyle(newStyle.release()); 1267 newCell->setStyle(newStyle.release());
1267 return newCell; 1268 return newCell;
1268 } 1269 }
1269 1270
1270 } // namespace blink 1271 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698