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 void LayoutTableCell::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject * ancestor, LayoutRect& r, const PaintInvalidationState* paintInvalidationState) const | 361 void LayoutTableCell::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject * ancestor, LayoutRect& r) const |
365 { | 362 { |
366 if (ancestor == this) | 363 if (ancestor == this) |
367 return; | 364 return; |
368 r.setY(r.y()); | 365 r.moveBy(-parentBox()->location()); // Rows are in the same coordinate space , so don't add their offset in. |
chrishtr
2016/03/24 01:05:42
What about this line?
chrishtr
2016/03/24 16:58:53
Is this now compensated for in the code I commente
trchen
2016/03/25 00:00:45
This looks like a no-op to me.
Xianzhu
2016/03/25 16:35:54
Isn't this a no-op?
| |
369 if ((!paintInvalidationState || !paintInvalidationState->canMapToAncestor(an cestor)) && parent()) | 366 LayoutBlockFlow::mapToVisibleRectInAncestorSpace(ancestor, r); |
370 r.moveBy(-parentBox()->location()); // Rows are in the same coordinate s pace, so don't add their offset in. | |
371 LayoutBlockFlow::mapToVisibleRectInAncestorSpace(ancestor, r, paintInvalidat ionState); | |
372 } | 367 } |
373 | 368 |
374 int LayoutTableCell::cellBaselinePosition() const | 369 int LayoutTableCell::cellBaselinePosition() const |
375 { | 370 { |
376 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of | 371 // <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 | 372 // 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. | 373 // is no such line box or table-row, the baseline is the bottom of content e dge of the cell box. |
379 int firstLineBaseline = firstLineBoxBaseline(); | 374 int firstLineBaseline = firstLineBoxBaseline(); |
380 if (firstLineBaseline != -1) | 375 if (firstLineBaseline != -1) |
381 return firstLineBaseline; | 376 return firstLineBaseline; |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const | 992 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const |
998 { | 993 { |
999 // If this object has layer, the area of collapsed borders should be transpa rent | 994 // 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. | 995 // to expose the collapsed borders painted on the underlying layer. |
1001 if (hasLayer() && table()->collapseBorders()) | 996 if (hasLayer() && table()->collapseBorders()) |
1002 return false; | 997 return false; |
1003 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); | 998 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); |
1004 } | 999 } |
1005 | 1000 |
1006 } // namespace blink | 1001 } // namespace blink |
OLD | NEW |