OLD | NEW |
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 { | 308 { |
309 ASSERT(o == container()); | 309 ASSERT(o == container()); |
310 | 310 |
311 LayoutSize offset = RenderBlockFlow::offsetFromContainer(o, point, offsetDep
endsOnPoint); | 311 LayoutSize offset = RenderBlockFlow::offsetFromContainer(o, point, offsetDep
endsOnPoint); |
312 if (parent()) | 312 if (parent()) |
313 offset -= parentBox()->locationOffset(); | 313 offset -= parentBox()->locationOffset(); |
314 | 314 |
315 return offset; | 315 return offset; |
316 } | 316 } |
317 | 317 |
318 LayoutRect RenderTableCell::clippedOverflowRectForPaintInvalidation(const Render
LayerModelObject* paintInvalidationContainer) const | 318 LayoutRect RenderTableCell::clippedOverflowRectForPaintInvalidation(const Render
LayerModelObject* paintInvalidationContainer, const PaintInvalidationState* pain
tInvalidationState) const |
319 { | 319 { |
320 // If the table grid is dirty, we cannot get reliable information about adjo
ining cells, | 320 // If the table grid is dirty, we cannot get reliable information about adjo
ining cells, |
321 // so we ignore outside borders. This should not be a problem because it mea
ns that | 321 // so we ignore outside borders. This should not be a problem because it mea
ns that |
322 // the table is going to recalculate the grid, relayout and repaint its curr
ent rect, which | 322 // the table is going to recalculate the grid, relayout and repaint its curr
ent rect, which |
323 // includes any outside borders of this cell. | 323 // includes any outside borders of this cell. |
324 if (!table()->collapseBorders() || table()->needsSectionRecalc()) | 324 if (!table()->collapseBorders() || table()->needsSectionRecalc()) |
325 return RenderBlockFlow::clippedOverflowRectForPaintInvalidation(paintInv
alidationContainer); | 325 return RenderBlockFlow::clippedOverflowRectForPaintInvalidation(paintInv
alidationContainer, paintInvalidationState); |
326 | 326 |
327 bool rtl = !styleForCellFlow()->isLeftToRightDirection(); | 327 bool rtl = !styleForCellFlow()->isLeftToRightDirection(); |
328 int outlineSize = style()->outlineSize(); | 328 int outlineSize = style()->outlineSize(); |
329 int left = std::max(borderHalfLeft(true), outlineSize); | 329 int left = std::max(borderHalfLeft(true), outlineSize); |
330 int right = std::max(borderHalfRight(true), outlineSize); | 330 int right = std::max(borderHalfRight(true), outlineSize); |
331 int top = std::max(borderHalfTop(true), outlineSize); | 331 int top = std::max(borderHalfTop(true), outlineSize); |
332 int bottom = std::max(borderHalfBottom(true), outlineSize); | 332 int bottom = std::max(borderHalfBottom(true), outlineSize); |
333 if ((left && !rtl) || (right && rtl)) { | 333 if ((left && !rtl) || (right && rtl)) { |
334 if (RenderTableCell* before = table()->cellBefore(this)) { | 334 if (RenderTableCell* before = table()->cellBefore(this)) { |
335 top = std::max(top, before->borderHalfTop(true)); | 335 top = std::max(top, before->borderHalfTop(true)); |
(...skipping 14 matching lines...) Expand all Loading... |
350 } | 350 } |
351 if (bottom) { | 351 if (bottom) { |
352 if (RenderTableCell* below = table()->cellBelow(this)) { | 352 if (RenderTableCell* below = table()->cellBelow(this)) { |
353 left = std::max(left, below->borderHalfLeft(true)); | 353 left = std::max(left, below->borderHalfLeft(true)); |
354 right = std::max(right, below->borderHalfRight(true)); | 354 right = std::max(right, below->borderHalfRight(true)); |
355 } | 355 } |
356 } | 356 } |
357 LayoutPoint location(std::max<LayoutUnit>(left, -visualOverflowRect().x()),
std::max<LayoutUnit>(top, -visualOverflowRect().y())); | 357 LayoutPoint location(std::max<LayoutUnit>(left, -visualOverflowRect().x()),
std::max<LayoutUnit>(top, -visualOverflowRect().y())); |
358 LayoutRect r(-location.x(), -location.y(), location.x() + std::max(width() +
right, visualOverflowRect().maxX()), location.y() + std::max(height() + bottom,
visualOverflowRect().maxY())); | 358 LayoutRect r(-location.x(), -location.y(), location.x() + std::max(width() +
right, visualOverflowRect().maxX()), location.y() + std::max(height() + bottom,
visualOverflowRect().maxY())); |
359 | 359 |
360 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r); | 360 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, false /* fi
xed */, paintInvalidationState); |
361 return r; | 361 return r; |
362 } | 362 } |
363 | 363 |
364 void RenderTableCell::mapRectToPaintInvalidationBacking(const RenderLayerModelOb
ject* paintInvalidationContainer, LayoutRect& r, bool fixed) const | 364 void RenderTableCell::mapRectToPaintInvalidationBacking(const RenderLayerModelOb
ject* paintInvalidationContainer, LayoutRect& r, bool fixed, const PaintInvalida
tionState* paintInvalidationState) const |
365 { | 365 { |
366 if (paintInvalidationContainer == this) | 366 if (paintInvalidationContainer == this) |
367 return; | 367 return; |
368 r.setY(r.y()); | 368 r.setY(r.y()); |
369 RenderView* v = view(); | 369 if ((!paintInvalidationState || !paintInvalidationState->canMapToContainer(p
aintInvalidationContainer)) && parent()) |
370 if ((!v || !v->canMapUsingLayoutStateForContainer(paintInvalidationContainer
)) && parent()) | |
371 r.moveBy(-parentBox()->location()); // Rows are in the same coordinate s
pace, so don't add their offset in. | 370 r.moveBy(-parentBox()->location()); // Rows are in the same coordinate s
pace, so don't add their offset in. |
372 RenderBlockFlow::mapRectToPaintInvalidationBacking(paintInvalidationContaine
r, r, fixed); | 371 RenderBlockFlow::mapRectToPaintInvalidationBacking(paintInvalidationContaine
r, r, fixed, paintInvalidationState); |
373 } | 372 } |
374 | 373 |
375 LayoutUnit RenderTableCell::cellBaselinePosition() const | 374 LayoutUnit RenderTableCell::cellBaselinePosition() const |
376 { | 375 { |
377 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>:
The baseline of a cell is the baseline of | 376 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>:
The baseline of a cell is the baseline of |
378 // the first in-flow line box in the cell, or the first in-flow table-row in
the cell, whichever comes first. If there | 377 // the first in-flow line box in the cell, or the first in-flow table-row in
the cell, whichever comes first. If there |
379 // is no such line box or table-row, the baseline is the bottom of content e
dge of the cell box. | 378 // is no such line box or table-row, the baseline is the bottom of content e
dge of the cell box. |
380 LayoutUnit firstLineBaseline = firstLineBoxBaseline(); | 379 LayoutUnit firstLineBaseline = firstLineBoxBaseline(); |
381 if (firstLineBaseline != -1) | 380 if (firstLineBaseline != -1) |
382 return firstLineBaseline; | 381 return firstLineBaseline; |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 | 1261 |
1263 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const Render
Object* parent) | 1262 RenderTableCell* RenderTableCell::createAnonymousWithParentRenderer(const Render
Object* parent) |
1264 { | 1263 { |
1265 RenderTableCell* newCell = RenderTableCell::createAnonymous(&parent->documen
t()); | 1264 RenderTableCell* newCell = RenderTableCell::createAnonymous(&parent->documen
t()); |
1266 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), TABLE_CELL); | 1265 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), TABLE_CELL); |
1267 newCell->setStyle(newStyle.release()); | 1266 newCell->setStyle(newStyle.release()); |
1268 return newCell; | 1267 return newCell; |
1269 } | 1268 } |
1270 | 1269 |
1271 } // namespace WebCore | 1270 } // namespace WebCore |
OLD | NEW |