OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 if (child.avoidsFloats() && containsFloats()) { | 624 if (child.avoidsFloats() && containsFloats()) { |
625 LayoutUnit positionToAvoidFloats = | 625 LayoutUnit positionToAvoidFloats = |
626 startOffsetForLine(logicalTopForChild(child), DoNotIndentText, | 626 startOffsetForLine(logicalTopForChild(child), DoNotIndentText, |
627 logicalHeightForChild(child)); | 627 logicalHeightForChild(child)); |
628 | 628 |
629 // If the child has an offset from the content edge to avoid floats then use | 629 // If the child has an offset from the content edge to avoid floats then use |
630 // that, otherwise let any negative margin pull it back over the content | 630 // that, otherwise let any negative margin pull it back over the content |
631 // edge or any positive margin push it out. | 631 // edge or any positive margin push it out. |
632 // If the child is being centred then the margin calculated to do that has | 632 // If the child is being centred then the margin calculated to do that has |
633 // factored in any offset required to avoid floats, so use it if necessary. | 633 // factored in any offset required to avoid floats, so use it if necessary. |
634 if (style()->textAlign() == ETextAlign::WebkitCenter || | 634 if (style()->textAlign() == ETextAlign::kWebkitCenter || |
635 child.style()->marginStartUsing(style()).isAuto()) | 635 child.style()->marginStartUsing(style()).isAuto()) |
636 newPosition = | 636 newPosition = |
637 std::max(newPosition, positionToAvoidFloats + childMarginStart); | 637 std::max(newPosition, positionToAvoidFloats + childMarginStart); |
638 else if (positionToAvoidFloats > initialStartPosition) | 638 else if (positionToAvoidFloats > initialStartPosition) |
639 newPosition = std::max(newPosition, positionToAvoidFloats); | 639 newPosition = std::max(newPosition, positionToAvoidFloats); |
640 } | 640 } |
641 | 641 |
642 setLogicalLeftForChild(child, style()->isLeftToRightDirection() | 642 setLogicalLeftForChild(child, style()->isLeftToRightDirection() |
643 ? newPosition | 643 ? newPosition |
644 : totalAvailableLogicalWidth - newPosition - | 644 : totalAvailableLogicalWidth - newPosition - |
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 logicalRightOffset = logicalRightOffsetForContent(); | 3464 logicalRightOffset = logicalRightOffsetForContent(); |
3465 | 3465 |
3466 LayoutUnit floatLogicalWidth = std::min( | 3466 LayoutUnit floatLogicalWidth = std::min( |
3467 logicalWidthForFloat(floatingObject), | 3467 logicalWidthForFloat(floatingObject), |
3468 logicalRightOffset - logicalLeftOffset); // The width we look for. | 3468 logicalRightOffset - logicalLeftOffset); // The width we look for. |
3469 | 3469 |
3470 LayoutUnit floatLogicalLeft; | 3470 LayoutUnit floatLogicalLeft; |
3471 | 3471 |
3472 bool insideFlowThread = flowThreadContainingBlock(); | 3472 bool insideFlowThread = flowThreadContainingBlock(); |
3473 | 3473 |
3474 if (childBox->style()->floating() == EFloat::Left) { | 3474 if (childBox->style()->floating() == EFloat::kLeft) { |
3475 LayoutUnit heightRemainingLeft = LayoutUnit(1); | 3475 LayoutUnit heightRemainingLeft = LayoutUnit(1); |
3476 LayoutUnit heightRemainingRight = LayoutUnit(1); | 3476 LayoutUnit heightRemainingRight = LayoutUnit(1); |
3477 floatLogicalLeft = logicalLeftOffsetForPositioningFloat( | 3477 floatLogicalLeft = logicalLeftOffsetForPositioningFloat( |
3478 logicalTopOffset, logicalLeftOffset, &heightRemainingLeft); | 3478 logicalTopOffset, logicalLeftOffset, &heightRemainingLeft); |
3479 while (logicalRightOffsetForPositioningFloat( | 3479 while (logicalRightOffsetForPositioningFloat( |
3480 logicalTopOffset, logicalRightOffset, &heightRemainingRight) - | 3480 logicalTopOffset, logicalRightOffset, &heightRemainingRight) - |
3481 floatLogicalLeft < | 3481 floatLogicalLeft < |
3482 floatLogicalWidth) { | 3482 floatLogicalWidth) { |
3483 logicalTopOffset += | 3483 logicalTopOffset += |
3484 std::min<LayoutUnit>(heightRemainingLeft, heightRemainingRight); | 3484 std::min<LayoutUnit>(heightRemainingLeft, heightRemainingRight); |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 4598 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
4599 } | 4599 } |
4600 | 4600 |
4601 void LayoutBlockFlow::invalidateDisplayItemClients( | 4601 void LayoutBlockFlow::invalidateDisplayItemClients( |
4602 PaintInvalidationReason invalidationReason) const { | 4602 PaintInvalidationReason invalidationReason) const { |
4603 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( | 4603 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( |
4604 invalidationReason); | 4604 invalidationReason); |
4605 } | 4605 } |
4606 | 4606 |
4607 } // namespace blink | 4607 } // namespace blink |
OLD | NEW |