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 3674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3685 LayoutUnit containerLogicalWidth) { | 3685 LayoutUnit containerLogicalWidth) { |
3686 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) | 3686 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) |
3687 return; | 3687 return; |
3688 | 3688 |
3689 // For multicol we also need to keep track of the block position, since that | 3689 // For multicol we also need to keep track of the block position, since that |
3690 // determines which column we're in and thus affects the inline position. | 3690 // determines which column we're in and thus affects the inline position. |
3691 LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition(); | 3691 LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition(); |
3692 | 3692 |
3693 // FIXME: The static distance computation has not been patched for mixed | 3693 // FIXME: The static distance computation has not been patched for mixed |
3694 // writing modes yet. | 3694 // writing modes yet. |
3695 if (child->parent()->style()->direction() == LTR) { | 3695 if (child->parent()->style()->direction() == TextDirection::Ltr) { |
3696 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - | 3696 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - |
3697 containerBlock->borderLogicalLeft(); | 3697 containerBlock->borderLogicalLeft(); |
3698 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; | 3698 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; |
3699 curr = curr->container()) { | 3699 curr = curr->container()) { |
3700 if (curr->isBox()) { | 3700 if (curr->isBox()) { |
3701 staticPosition += toLayoutBox(curr)->logicalLeft(); | 3701 staticPosition += toLayoutBox(curr)->logicalLeft(); |
3702 if (toLayoutBox(curr)->isInFlowPositioned()) | 3702 if (toLayoutBox(curr)->isInFlowPositioned()) |
3703 staticPosition += | 3703 staticPosition += |
3704 toLayoutBox(curr)->offsetForInFlowPosition().width(); | 3704 toLayoutBox(curr)->offsetForInFlowPosition().width(); |
3705 if (curr->isInsideFlowThread()) | 3705 if (curr->isInsideFlowThread()) |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3983 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { | 3983 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { |
3984 // Both margins auto, solve for equality | 3984 // Both margins auto, solve for equality |
3985 if (availableSpace >= 0) { | 3985 if (availableSpace >= 0) { |
3986 marginLogicalLeftValue = availableSpace / 2; // split the difference | 3986 marginLogicalLeftValue = availableSpace / 2; // split the difference |
3987 marginLogicalRightValue = | 3987 marginLogicalRightValue = |
3988 availableSpace - | 3988 availableSpace - |
3989 marginLogicalLeftValue; // account for odd valued differences | 3989 marginLogicalLeftValue; // account for odd valued differences |
3990 } else { | 3990 } else { |
3991 // Use the containing block's direction rather than the parent block's | 3991 // Use the containing block's direction rather than the parent block's |
3992 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. | 3992 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. |
3993 if (containerDirection == LTR) { | 3993 if (containerDirection == TextDirection::Ltr) { |
3994 marginLogicalLeftValue = LayoutUnit(); | 3994 marginLogicalLeftValue = LayoutUnit(); |
3995 marginLogicalRightValue = availableSpace; // will be negative | 3995 marginLogicalRightValue = availableSpace; // will be negative |
3996 } else { | 3996 } else { |
3997 marginLogicalLeftValue = availableSpace; // will be negative | 3997 marginLogicalLeftValue = availableSpace; // will be negative |
3998 marginLogicalRightValue = LayoutUnit(); | 3998 marginLogicalRightValue = LayoutUnit(); |
3999 } | 3999 } |
4000 } | 4000 } |
4001 } else if (marginLogicalLeft.isAuto()) { | 4001 } else if (marginLogicalLeft.isAuto()) { |
4002 // Solve for left margin | 4002 // Solve for left margin |
4003 marginLogicalRightValue = | 4003 marginLogicalRightValue = |
4004 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); | 4004 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); |
4005 marginLogicalLeftValue = availableSpace - marginLogicalRightValue; | 4005 marginLogicalLeftValue = availableSpace - marginLogicalRightValue; |
4006 } else if (marginLogicalRight.isAuto()) { | 4006 } else if (marginLogicalRight.isAuto()) { |
4007 // Solve for right margin | 4007 // Solve for right margin |
4008 marginLogicalLeftValue = | 4008 marginLogicalLeftValue = |
4009 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); | 4009 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); |
4010 marginLogicalRightValue = availableSpace - marginLogicalLeftValue; | 4010 marginLogicalRightValue = availableSpace - marginLogicalLeftValue; |
4011 } else { | 4011 } else { |
4012 // Over-constrained, solve for left if direction is RTL | 4012 // Over-constrained, solve for left if direction is RTL |
4013 marginLogicalLeftValue = | 4013 marginLogicalLeftValue = |
4014 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); | 4014 valueForLength(marginLogicalLeft, containerRelativeLogicalWidth); |
4015 marginLogicalRightValue = | 4015 marginLogicalRightValue = |
4016 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); | 4016 valueForLength(marginLogicalRight, containerRelativeLogicalWidth); |
4017 | 4017 |
4018 // Use the containing block's direction rather than the parent block's | 4018 // Use the containing block's direction rather than the parent block's |
4019 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. | 4019 // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. |
4020 if (containerDirection == RTL) | 4020 if (containerDirection == TextDirection::Rtl) |
4021 logicalLeftValue = (availableSpace + logicalLeftValue) - | 4021 logicalLeftValue = (availableSpace + logicalLeftValue) - |
4022 marginLogicalLeftValue - marginLogicalRightValue; | 4022 marginLogicalLeftValue - marginLogicalRightValue; |
4023 } | 4023 } |
4024 } else { | 4024 } else { |
4025 // ------------------------------------------------------------------------- | 4025 // ------------------------------------------------------------------------- |
4026 // Otherwise, set 'auto' values for 'margin-left' and 'margin-right' | 4026 // Otherwise, set 'auto' values for 'margin-left' and 'margin-right' |
4027 // to 0, and pick the one of the following six rules that applies. | 4027 // to 0, and pick the one of the following six rules that applies. |
4028 // | 4028 // |
4029 // 1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the | 4029 // 1. 'left' and 'width' are 'auto' and 'right' is not 'auto', then the |
4030 // width is shrink-to-fit. Then solve for 'left' | 4030 // width is shrink-to-fit. Then solve for 'left' |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5623 LayoutRect rect = frameRect(); | 5623 LayoutRect rect = frameRect(); |
5624 | 5624 |
5625 LayoutBlock* block = containingBlock(); | 5625 LayoutBlock* block = containingBlock(); |
5626 if (block) | 5626 if (block) |
5627 block->adjustChildDebugRect(rect); | 5627 block->adjustChildDebugRect(rect); |
5628 | 5628 |
5629 return rect; | 5629 return rect; |
5630 } | 5630 } |
5631 | 5631 |
5632 } // namespace blink | 5632 } // namespace blink |
OLD | NEW |