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 = LayoutBlockFlow::offsetFromContainer(o); | 311 LayoutSize offset = LayoutBlockFlow::offsetFromContainer(o); |
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 LayoutTableCell::clippedOverflowRectForPaintInvalidation(const Layout
BoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI
nvalidationState) const | 318 LayoutRect LayoutTableCell::localOverflowRectForPaintInvalidation() 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 issue a paint in
validation of its current rect, which | 322 // the table is going to recalculate the grid, relayout and issue a paint in
validation of its current 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 LayoutBlockFlow::clippedOverflowRectForPaintInvalidation(paintInv
alidationContainer, paintInvalidationState); | 325 return LayoutBlockFlow::localOverflowRectForPaintInvalidation(); |
326 | 326 |
327 bool rtl = !styleForCellFlow().isLeftToRightDirection(); | 327 bool rtl = !styleForCellFlow().isLeftToRightDirection(); |
328 int outlineOutset = style()->outlineOutsetExtent(); | 328 int outlineOutset = style()->outlineOutsetExtent(); |
329 int left = std::max(borderHalfLeft(true), outlineOutset); | 329 int left = std::max(borderHalfLeft(true), outlineOutset); |
330 int right = std::max(borderHalfRight(true), outlineOutset); | 330 int right = std::max(borderHalfRight(true), outlineOutset); |
331 int top = std::max(borderHalfTop(true), outlineOutset); | 331 int top = std::max(borderHalfTop(true), outlineOutset); |
332 int bottom = std::max(borderHalfBottom(true), outlineOutset); | 332 int bottom = std::max(borderHalfBottom(true), outlineOutset); |
333 if ((left && !rtl) || (right && rtl)) { | 333 if ((left && !rtl) || (right && rtl)) { |
334 if (LayoutTableCell* before = table()->cellBefore(this)) { | 334 if (LayoutTableCell* before = table()->cellBefore(this)) { |
335 top = std::max(top, before->borderHalfTop(true)); | 335 top = std::max(top, before->borderHalfTop(true)); |
(...skipping 12 matching lines...) Expand all Loading... |
348 right = std::max(right, above->borderHalfRight(true)); | 348 right = std::max(right, above->borderHalfRight(true)); |
349 } | 349 } |
350 } | 350 } |
351 if (bottom) { | 351 if (bottom) { |
352 if (LayoutTableCell* below = table()->cellBelow(this)) { | 352 if (LayoutTableCell* 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(size().wi
dth() + right, visualOverflowRect().maxX()), location.y() + std::max(size().heig
ht() + bottom, visualOverflowRect().maxY())); | 358 return LayoutRect(-location.x(), -location.y(), location.x() + std::max(size
().width() + right, visualOverflowRect().maxX()), location.y() + std::max(size()
.height() + bottom, visualOverflowRect().maxY())); |
359 | |
360 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalida
tionState); | |
361 return r; | |
362 } | 359 } |
363 | 360 |
364 bool LayoutTableCell::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject
* ancestor, LayoutRect& r, const PaintInvalidationState* paintInvalidationState,
VisibleRectFlags visibleRectFlags) const | 361 bool LayoutTableCell::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject
* ancestor, LayoutRect& r, const PaintInvalidationState* paintInvalidationState,
VisibleRectFlags visibleRectFlags) const |
365 { | 362 { |
366 if (ancestor == this) | 363 if (ancestor == this) |
367 return true; | 364 return true; |
368 r.setY(r.y()); | |
369 if ((!paintInvalidationState || !paintInvalidationState->canMapToAncestor(an
cestor)) && parent()) | 365 if ((!paintInvalidationState || !paintInvalidationState->canMapToAncestor(an
cestor)) && parent()) |
370 r.moveBy(-parentBox()->location()); // Rows are in the same coordinate s
pace, so don't add their offset in. | 366 r.moveBy(-parentBox()->location()); // Rows are in the same coordinate s
pace, so don't add their offset in. |
371 return LayoutBlockFlow::mapToVisibleRectInAncestorSpace(ancestor, r, paintIn
validationState, visibleRectFlags); | 367 return LayoutBlockFlow::mapToVisibleRectInAncestorSpace(ancestor, r, paintIn
validationState, visibleRectFlags); |
372 } | 368 } |
373 | 369 |
374 int LayoutTableCell::cellBaselinePosition() const | 370 int LayoutTableCell::cellBaselinePosition() const |
375 { | 371 { |
376 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>:
The baseline of a cell is the baseline of | 372 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>:
The baseline of a cell is the baseline of |
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 | 373 // the first in-flow line box in the cell, or the first in-flow table-row in
the cell, whichever comes first. If there |
378 // is no such line box or table-row, the baseline is the bottom of content e
dge of the cell box. | 374 // is no such line box or table-row, the baseline is the bottom of content e
dge of the cell box. |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const | 993 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const |
998 { | 994 { |
999 // If this object has layer, the area of collapsed borders should be transpa
rent | 995 // If this object has layer, the area of collapsed borders should be transpa
rent |
1000 // to expose the collapsed borders painted on the underlying layer. | 996 // to expose the collapsed borders painted on the underlying layer. |
1001 if (hasLayer() && table()->collapseBorders()) | 997 if (hasLayer() && table()->collapseBorders()) |
1002 return false; | 998 return false; |
1003 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); | 999 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); |
1004 } | 1000 } |
1005 | 1001 |
1006 } // namespace blink | 1002 } // namespace blink |
OLD | NEW |