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, 2010 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. |
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 setMarginStart(0); | 259 setMarginStart(0); |
260 setMarginEnd(0); | 260 setMarginEnd(0); |
261 if (!hasPerpendicularContainingBlock) | 261 if (!hasPerpendicularContainingBlock) |
262 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth())
; | 262 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth())
; |
263 else { | 263 else { |
264 setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth
)); | 264 setMarginStart(style()->marginStart().calcMinValue(availableLogicalWidth
)); |
265 setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth)); | 265 setMarginEnd(style()->marginEnd().calcMinValue(availableLogicalWidth)); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 void RenderTable::adjustLogicalHeightForCaption(RenderBlock* caption) | 269 void RenderTable::layoutCaption(RenderTableCaption* caption) |
270 { | 270 { |
271 IntRect captionRect(caption->x(), caption->y(), caption->width(), caption->h
eight()); | 271 IntRect captionRect(caption->x(), caption->y(), caption->width(), caption->h
eight()); |
272 | 272 |
| 273 if (caption->needsLayout()) { |
| 274 // The margins may not be available but ensure the caption is at least l
ocated beneath any previous sibling caption |
| 275 // so that it does not mistakenly think any floats in the previous capti
on intrude into it. |
| 276 caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->ma
rginBefore() + logicalHeight())); |
| 277 // If RenderTableCaption ever gets a layout() function, use it here. |
| 278 caption->layoutIfNeeded(); |
| 279 } |
| 280 // Apply the margins to the location now that they are definitely available
from layout |
273 caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->margin
Before() + logicalHeight())); | 281 caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->margin
Before() + logicalHeight())); |
| 282 |
274 if (!selfNeedsLayout() && caption->checkForRepaintDuringLayout()) | 283 if (!selfNeedsLayout() && caption->checkForRepaintDuringLayout()) |
275 caption->repaintDuringLayoutIfMoved(captionRect); | 284 caption->repaintDuringLayoutIfMoved(captionRect); |
276 | 285 |
277 setLogicalHeight(logicalHeight() + caption->logicalHeight() + caption->margi
nBefore() + caption->marginAfter()); | 286 setLogicalHeight(logicalHeight() + caption->logicalHeight() + caption->margi
nBefore() + caption->marginAfter()); |
278 } | 287 } |
279 | 288 |
280 void RenderTable::layout() | 289 void RenderTable::layout() |
281 { | 290 { |
282 ASSERT(needsLayout()); | 291 ASSERT(needsLayout()); |
283 | 292 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 totalSectionLogicalHeight += section->calcRowLogicalHeight(); | 333 totalSectionLogicalHeight += section->calcRowLogicalHeight(); |
325 if (collapsing) | 334 if (collapsing) |
326 section->recalcOuterBorder(); | 335 section->recalcOuterBorder(); |
327 ASSERT(!section->needsLayout()); | 336 ASSERT(!section->needsLayout()); |
328 } else if (child->isTableCol()) { | 337 } else if (child->isTableCol()) { |
329 child->layoutIfNeeded(); | 338 child->layoutIfNeeded(); |
330 ASSERT(!child->needsLayout()); | 339 ASSERT(!child->needsLayout()); |
331 } | 340 } |
332 } | 341 } |
333 | 342 |
334 // Only lay out one caption, since it's the only one we're going to end up p
ainting. | |
335 for (unsigned i = 0; i < m_captions.size(); i++) | |
336 m_captions[i]->layoutIfNeeded(); | |
337 | |
338 // If any table section moved vertically, we will just repaint everything fr
om that | 343 // If any table section moved vertically, we will just repaint everything fr
om that |
339 // section down (it is quite unlikely that any of the following sections | 344 // section down (it is quite unlikely that any of the following sections |
340 // did not shift). | 345 // did not shift). |
341 bool sectionMoved = false; | 346 bool sectionMoved = false; |
342 LayoutUnit movedSectionLogicalTop = 0; | 347 LayoutUnit movedSectionLogicalTop = 0; |
343 | 348 |
344 // FIXME: Collapse caption margin. | 349 // FIXME: Collapse caption margin. |
345 if (!m_captions.isEmpty()) { | 350 if (!m_captions.isEmpty()) { |
346 for (unsigned i = 0; i < m_captions.size(); i++) { | 351 for (unsigned i = 0; i < m_captions.size(); i++) { |
347 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) | 352 if (m_captions[i]->style()->captionSide() == CAPBOTTOM) |
348 continue; | 353 continue; |
349 adjustLogicalHeightForCaption(m_captions[i]); | 354 layoutCaption(m_captions[i]); |
350 } | 355 } |
351 if (logicalHeight() != oldTableLogicalTop) { | 356 if (logicalHeight() != oldTableLogicalTop) { |
352 sectionMoved = true; | 357 sectionMoved = true; |
353 movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop); | 358 movedSectionLogicalTop = min(logicalHeight(), oldTableLogicalTop); |
354 } | 359 } |
355 } | 360 } |
356 | 361 |
357 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddi
ngBefore()); | 362 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddi
ngBefore()); |
358 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : padding
After()); | 363 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : padding
After()); |
359 | 364 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 404 |
400 setLogicalHeight(logicalHeight() + section->logicalHeight()); | 405 setLogicalHeight(logicalHeight() + section->logicalHeight()); |
401 section = sectionBelow(section); | 406 section = sectionBelow(section); |
402 } | 407 } |
403 | 408 |
404 setLogicalHeight(logicalHeight() + borderAndPaddingAfter); | 409 setLogicalHeight(logicalHeight() + borderAndPaddingAfter); |
405 | 410 |
406 for (unsigned i = 0; i < m_captions.size(); i++) { | 411 for (unsigned i = 0; i < m_captions.size(); i++) { |
407 if (m_captions[i]->style()->captionSide() != CAPBOTTOM) | 412 if (m_captions[i]->style()->captionSide() != CAPBOTTOM) |
408 continue; | 413 continue; |
409 adjustLogicalHeightForCaption(m_captions[i]); | 414 layoutCaption(m_captions[i]); |
410 } | 415 } |
411 | 416 |
412 if (isPositioned()) | 417 if (isPositioned()) |
413 computeLogicalHeight(); | 418 computeLogicalHeight(); |
414 | 419 |
415 // table can be containing block of positioned elements. | 420 // table can be containing block of positioned elements. |
416 // FIXME: Only pass true if width or height changed. | 421 // FIXME: Only pass true if width or height changed. |
417 layoutPositionedObjects(true); | 422 layoutPositionedObjects(true); |
418 | 423 |
419 updateLayerTransform(); | 424 updateLayerTransform(); |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 if (visibleToHitTesting() && (action == HitTestBlockBackground || action ==
HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI
nContainer))) { | 1234 if (visibleToHitTesting() && (action == HitTestBlockBackground || action ==
HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI
nContainer))) { |
1230 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo
utSize(adjustedLocation))); | 1235 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo
utSize(adjustedLocation))); |
1231 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound
sRect)) | 1236 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound
sRect)) |
1232 return true; | 1237 return true; |
1233 } | 1238 } |
1234 | 1239 |
1235 return false; | 1240 return false; |
1236 } | 1241 } |
1237 | 1242 |
1238 } | 1243 } |
OLD | NEW |