| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 if (childMargin <= 0) | 1364 if (childMargin <= 0) |
| 1365 return 0; | 1365 return 0; |
| 1366 LayoutUnit contentSideWithMargin = contentSide + childMargin; | 1366 LayoutUnit contentSideWithMargin = contentSide + childMargin; |
| 1367 if (offset > contentSideWithMargin) | 1367 if (offset > contentSideWithMargin) |
| 1368 return childMargin; | 1368 return childMargin; |
| 1369 return offset - contentSide; | 1369 return offset - contentSide; |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const | 1372 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const |
| 1373 { | 1373 { |
| 1374 LayoutUnit logicalTopPosition = logicalTop(); | 1374 LayoutUnit width = cb->availableLogicalWidthForLine(false) - std::max<Layout
Unit>(0, childMarginStart) - std::max<LayoutUnit>(0, childMarginEnd); |
| 1375 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - std::max<LayoutUnit>(0, childMarginStart) - std::max<LayoutUnit>(0, childMa
rginEnd); | |
| 1376 | 1375 |
| 1377 // We need to see if margins on either the start side or the end side can co
ntain the floats in question. If they can, | 1376 // We need to see if margins on either the start side or the end side can co
ntain the floats in question. If they can, |
| 1378 // then just using the line width is inaccurate. In the case where a float c
ompletely fits, we don't need to use the line | 1377 // then just using the line width is inaccurate. In the case where a float c
ompletely fits, we don't need to use the line |
| 1379 // offset at all, but can instead push all the way to the content edge of th
e containing block. In the case where the float | 1378 // offset at all, but can instead push all the way to the content edge of th
e containing block. In the case where the float |
| 1380 // doesn't fit, we can use the line offset, but we need to grow it by the ma
rgin to reflect the fact that the margin was | 1379 // doesn't fit, we can use the line offset, but we need to grow it by the ma
rgin to reflect the fact that the margin was |
| 1381 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. | 1380 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. |
| 1382 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(logicalTopPosition, false)); | 1381 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(false)); |
| 1383 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(logicalTopPosition, false)); | 1382 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(false)); |
| 1384 return width; | 1383 return width; |
| 1385 } | 1384 } |
| 1386 | 1385 |
| 1387 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const | 1386 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const |
| 1388 { | 1387 { |
| 1389 if (hasOverrideContainingBlockLogicalWidth()) | 1388 if (hasOverrideContainingBlockLogicalWidth()) |
| 1390 return overrideContainingBlockContentLogicalWidth(); | 1389 return overrideContainingBlockContentLogicalWidth(); |
| 1391 | 1390 |
| 1392 RenderBlock* cb = containingBlock(); | 1391 RenderBlock* cb = containingBlock(); |
| 1393 return cb->availableLogicalWidth(); | 1392 return cb->availableLogicalWidth(); |
| 1394 } | 1393 } |
| 1395 | 1394 |
| 1396 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei
ghtType heightType) const | 1395 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei
ghtType heightType) const |
| 1397 { | 1396 { |
| 1398 if (hasOverrideContainingBlockLogicalHeight()) | 1397 if (hasOverrideContainingBlockLogicalHeight()) |
| 1399 return overrideContainingBlockContentLogicalHeight(); | 1398 return overrideContainingBlockContentLogicalHeight(); |
| 1400 | 1399 |
| 1401 RenderBlock* cb = containingBlock(); | 1400 RenderBlock* cb = containingBlock(); |
| 1402 return cb->availableLogicalHeight(heightType); | 1401 return cb->availableLogicalHeight(heightType); |
| 1403 } | 1402 } |
| 1404 | 1403 |
| 1405 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const | 1404 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const |
| 1406 { | 1405 { |
| 1407 RenderBlock* cb = containingBlock(); | 1406 RenderBlock* cb = containingBlock(); |
| 1408 if (cb->isRenderBlockFlow()) | 1407 if (cb->isRenderBlockFlow()) |
| 1409 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(),
false, availableLogicalHeight(IncludeMarginBorderPadding)); | 1408 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(false); |
| 1410 return 0; | 1409 return 0; |
| 1411 } | 1410 } |
| 1412 | 1411 |
| 1413 LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const | 1412 LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const |
| 1414 { | 1413 { |
| 1415 if (hasOverrideContainingBlockLogicalHeight()) | 1414 if (hasOverrideContainingBlockLogicalHeight()) |
| 1416 return overrideContainingBlockContentLogicalHeight(); | 1415 return overrideContainingBlockContentLogicalHeight(); |
| 1417 | 1416 |
| 1418 RenderBlock* cb = containingBlock(); | 1417 RenderBlock* cb = containingBlock(); |
| 1419 if (cb->hasOverrideHeight()) | 1418 if (cb->hasOverrideHeight()) |
| (...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3849 | 3848 |
| 3850 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3849 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 3851 { | 3850 { |
| 3852 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3851 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 3853 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3852 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 3854 ASSERT(hasBackground == style.hasBackground()); | 3853 ASSERT(hasBackground == style.hasBackground()); |
| 3855 hasBorder = style.hasBorder(); | 3854 hasBorder = style.hasBorder(); |
| 3856 } | 3855 } |
| 3857 | 3856 |
| 3858 } // namespace blink | 3857 } // namespace blink |
| OLD | NEW |