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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent(); | 233 LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent(); |
234 bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode(
) != style()->isHorizontalWritingMode(); | 234 bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode(
) != style()->isHorizontalWritingMode(); |
235 LayoutUnit containerWidthInInlineDirection = hasPerpendicularContainingBlock
? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth; | 235 LayoutUnit containerWidthInInlineDirection = hasPerpendicularContainingBlock
? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth; |
236 | 236 |
237 LengthType logicalWidthType = style()->logicalWidth().type(); | 237 LengthType logicalWidthType = style()->logicalWidth().type(); |
238 if (logicalWidthType > Relative && style()->logicalWidth().isPositive()) { | 238 if (logicalWidthType > Relative && style()->logicalWidth().isPositive()) { |
239 // Percent or fixed table | 239 // Percent or fixed table |
240 // HTML tables size as though CSS width includes border/padding, CSS tab
les do not. | 240 // HTML tables size as though CSS width includes border/padding, CSS tab
les do not. |
241 LayoutUnit borders = 0; | 241 LayoutUnit borders = 0; |
242 if (!node()->hasTagName(tableTag)) { | 242 if (!node() || !node()->hasTagName(tableTag)) { |
243 bool collapsing = collapseBorders(); | 243 bool collapsing = collapseBorders(); |
244 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0
: paddingBefore()); | 244 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0
: paddingBefore()); |
245 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 :
paddingAfter()); | 245 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 :
paddingAfter()); |
246 borders = borderAndPaddingBefore + borderAndPaddingAfter; | 246 borders = borderAndPaddingBefore + borderAndPaddingAfter; |
247 } | 247 } |
248 setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInl
ineDirection) + borders); | 248 setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInl
ineDirection) + borders); |
249 setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth())); | 249 setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth())); |
250 } else { | 250 } else { |
251 // Subtract out any fixed margins from our available width for auto widt
h tables. | 251 // Subtract out any fixed margins from our available width for auto widt
h tables. |
252 LayoutUnit marginTotal = 0; | 252 LayoutUnit marginTotal = 0; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); | 363 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); |
364 | 364 |
365 if (!isPositioned()) | 365 if (!isPositioned()) |
366 computeLogicalHeight(); | 366 computeLogicalHeight(); |
367 | 367 |
368 Length logicalHeightLength = style()->logicalHeight(); | 368 Length logicalHeightLength = style()->logicalHeight(); |
369 LayoutUnit computedLogicalHeight = 0; | 369 LayoutUnit computedLogicalHeight = 0; |
370 if (logicalHeightLength.isFixed()) { | 370 if (logicalHeightLength.isFixed()) { |
371 // HTML tables size as though CSS height includes border/padding, CSS ta
bles do not. | 371 // HTML tables size as though CSS height includes border/padding, CSS ta
bles do not. |
372 LayoutUnit borders = node()->hasTagName(tableTag) ? (borderAndPaddingBef
ore + borderAndPaddingAfter) : 0; | 372 LayoutUnit borders = node() && node()->hasTagName(tableTag) ? (borderAnd
PaddingBefore + borderAndPaddingAfter) : 0; |
373 computedLogicalHeight = logicalHeightLength.value() - borders; | 373 computedLogicalHeight = logicalHeightLength.value() - borders; |
374 } else if (logicalHeightLength.isPercent()) | 374 } else if (logicalHeightLength.isPercent()) |
375 computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLeng
th); | 375 computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLeng
th); |
376 computedLogicalHeight = max<LayoutUnit>(0, computedLogicalHeight); | 376 computedLogicalHeight = max<LayoutUnit>(0, computedLogicalHeight); |
377 | 377 |
378 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) { | 378 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) { |
379 if (child->isTableSection()) | 379 if (child->isTableSection()) |
380 // FIXME: Distribute extra height between all table body sections in
stead of giving it all to the first one. | 380 // FIXME: Distribute extra height between all table body sections in
stead of giving it all to the first one. |
381 toRenderTableSection(child)->layoutRows(child == m_firstBody ? max<L
ayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0); | 381 toRenderTableSection(child)->layoutRows(child == m_firstBody ? max<L
ayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0); |
382 } | 382 } |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 if (visibleToHitTesting() && (action == HitTestBlockBackground || action ==
HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI
nContainer))) { | 1230 if (visibleToHitTesting() && (action == HitTestBlockBackground || action ==
HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI
nContainer))) { |
1231 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo
utSize(adjustedLocation))); | 1231 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo
utSize(adjustedLocation))); |
1232 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound
sRect)) | 1232 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound
sRect)) |
1233 return true; | 1233 return true; |
1234 } | 1234 } |
1235 | 1235 |
1236 return false; | 1236 return false; |
1237 } | 1237 } |
1238 | 1238 |
1239 } | 1239 } |
OLD | NEW |