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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
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 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 LayoutUnit containerLogicalWidth) { | 3700 LayoutUnit containerLogicalWidth) { |
3701 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) | 3701 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) |
3702 return; | 3702 return; |
3703 | 3703 |
3704 // For multicol we also need to keep track of the block position, since that | 3704 // For multicol we also need to keep track of the block position, since that |
3705 // determines which column we're in and thus affects the inline position. | 3705 // determines which column we're in and thus affects the inline position. |
3706 LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition(); | 3706 LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition(); |
3707 | 3707 |
3708 // FIXME: The static distance computation has not been patched for mixed | 3708 // FIXME: The static distance computation has not been patched for mixed |
3709 // writing modes yet. | 3709 // writing modes yet. |
3710 if (child->parent()->style()->direction() == LTR) { | 3710 if (child->parent()->style()->direction() == TextDirection::Ltr) { |
3711 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - | 3711 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - |
3712 containerBlock->borderLogicalLeft(); | 3712 containerBlock->borderLogicalLeft(); |
3713 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; | 3713 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; |
3714 curr = curr->container()) { | 3714 curr = curr->container()) { |
3715 if (curr->isBox()) { | 3715 if (curr->isBox()) { |
3716 staticPosition += toLayoutBox(curr)->logicalLeft(); | 3716 staticPosition += toLayoutBox(curr)->logicalLeft(); |
3717 if (toLayoutBox(curr)->isInFlowPositioned()) | 3717 if (toLayoutBox(curr)->isInFlowPositioned()) |
3718 staticPosition += | 3718 staticPosition += |
3719 toLayoutBox(curr)->offsetForInFlowPosition().width(); | 3719 toLayoutBox(curr)->offsetForInFlowPosition().width(); |
3720 if (curr->isInsideFlowThread()) | 3720 if (curr->isInsideFlowThread()) |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3998 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { | 3998 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { |
3999 // Both margins auto, solve for equality | 3999 // Both margins auto, solve for equality |
4000 if (availableSpace >= 0) { | 4000 if (availableSpace >= 0) { |
4001 marginLogicalLeftValue = availableSpace / 2; // split the difference | 4001 marginLogicalLeftValue = availableSpace / 2; // split the difference |
4002 marginLogicalRightValue = | 4002 marginLogicalRightValue = |
4003 availableSpace - | 4003 availableSpace - |
4004 marginLogicalLeftValue; // account for odd valued differences | 4004 marginLogicalLeftValue; // account for odd valued differences |
4005 } else { | 4005 } else { |
4006 // Use the containing block's direction rather than the parent block's | 4006 // Use the containing block's direction rather than the parent block's |
4007 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. | 4007 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. |
4008 if (containerDirection == LTR) { | 4008 if (containerDirection == TextDirection::Ltr) { |
4009 marginLogicalLeftValue = LayoutUnit(); | 4009 marginLogicalLeftValue = LayoutUnit(); |
4010 marginLogicalRightValue = availableSpace; // will be negative | 4010 marginLogicalRightValue = availableSpace; // will be negative |
4011 } else { | 4011 } else { |
4012 marginLogicalLeftValue = availableSpace; // will be negative | 4012 marginLogicalLeftValue = availableSpace; // will be negative |
4013 marginLogicalRightValue = LayoutUnit(); | 4013 marginLogicalRightValue = LayoutUnit(); |
4014 } | 4014 } |
4015 } | 4015 } |
4016 } else if (marginLogicalLeft.isAuto()) { | 4016 } else if (marginLogicalLeft.isAuto()) { |
4017 // Solve for left margin | 4017 // Solve for left margin |
4018 marginLogicalRightValue = | 4018 marginLogicalRightValue = |
4019 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); | 4019 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); |
4020 marginLogicalLeftValue = availableSpace - marginLogicalRightValue; | 4020 marginLogicalLeftValue = availableSpace - marginLogicalRightValue; |
4021 } else if (marginLogicalRight.isAuto()) { | 4021 } else if (marginLogicalRight.isAuto()) { |
4022 // Solve for right margin | 4022 // Solve for right margin |
4023 marginLogicalLeftValue = | 4023 marginLogicalLeftValue = |
4024 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); | 4024 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); |
4025 marginLogicalRightValue = availableSpace - marginLogicalLeftValue; | 4025 marginLogicalRightValue = availableSpace - marginLogicalLeftValue; |
4026 } else { | 4026 } else { |
4027 // Over-constrained, solve for left if direction is RTL | 4027 // Over-constrained, solve for left if direction is RTL |
4028 marginLogicalLeftValue = | 4028 marginLogicalLeftValue = |
4029 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); | 4029 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); |
4030 marginLogicalRightValue = | 4030 marginLogicalRightValue = |
4031 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); | 4031 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); |
4032 | 4032 |
4033 // Use the containing block's direction rather than the parent block's | 4033 // Use the containing block's direction rather than the parent block's |
4034 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. | 4034 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. |
4035 if (containerDirection == RTL) | 4035 if (containerDirection == TextDirection::Rtl) |
4036 logicalLeftValue = (availableSpace + logicalLeftValue) - | 4036 logicalLeftValue = (availableSpace + logicalLeftValue) - |
4037 marginLogicalLeftValue - marginLogicalRightValue; | 4037 marginLogicalLeftValue - marginLogicalRightValue; |
4038 } | 4038 } |
4039 } else { | 4039 } else { |
4040 // ------------------------------------------------------------------------- | 4040 // ------------------------------------------------------------------------- |
4041 // Otherwise, set 'auto' values for 'margin-left' and 'margin-right' | 4041 // Otherwise, set 'auto' values for 'margin-left' and 'margin-right' |
4042 // to 0, and pick the one of the following six rules that applies. | 4042 // to 0, and pick the one of the following six rules that applies. |
4043 // | 4043 // |
4044 // 1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the | 4044 // 1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the |
4045 // width is shrink-to-fit. Then solve for 'left' | 4045 // width is shrink-to-fit. Then solve for 'left' |
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 block->adjustChildDebugRect(rect); | 5660 block->adjustChildDebugRect(rect); |
5661 | 5661 |
5662 return rect; | 5662 return rect; |
5663 } | 5663 } |
5664 | 5664 |
5665 bool LayoutBox::shouldClipOverflow() const { | 5665 bool LayoutBox::shouldClipOverflow() const { |
5666 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); | 5666 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); |
5667 } | 5667 } |
5668 | 5668 |
5669 } // namespace blink | 5669 } // namespace blink |
OLD | NEW |