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 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3199 LayoutUnit heightResult; | 3199 LayoutUnit heightResult; |
3200 LayoutRect boundingBox(flow->linesBoundingBox()); | 3200 LayoutRect boundingBox(flow->linesBoundingBox()); |
3201 if (containingBlock->isHorizontalWritingMode()) | 3201 if (containingBlock->isHorizontalWritingMode()) |
3202 heightResult = boundingBox.height(); | 3202 heightResult = boundingBox.height(); |
3203 else | 3203 else |
3204 heightResult = boundingBox.width(); | 3204 heightResult = boundingBox.width(); |
3205 heightResult -= (containingBlock->borderBefore() + containingBlock->borderAf ter()); | 3205 heightResult -= (containingBlock->borderBefore() + containingBlock->borderAf ter()); |
3206 return heightResult; | 3206 return heightResult; |
3207 } | 3207 } |
3208 | 3208 |
3209 static LayoutUnit accumulateStaticOffsetForFlowThread(LayoutBox& layoutBox, Layo utUnit inlinePosition, LayoutUnit& blockPosition) | |
3210 { | |
3211 if (layoutBox.isTableRow()) | |
3212 return LayoutUnit(); | |
3213 blockPosition += layoutBox.logicalTop(); | |
3214 if (!layoutBox.isLayoutFlowThread()) | |
3215 return LayoutUnit(); | |
3216 LayoutUnit previousInlinePosition = inlinePosition; | |
3217 // We're walking out of a flowthread here. This flow thread is not in the co ntaining block | |
3218 // chain, so we need to convert the position from the coordinate space of th is flowthread to | |
3219 // the containing coordinate space. | |
3220 toLayoutFlowThread(layoutBox).flowThreadToVisualLogicalPosition(blockPositio n, inlinePosition); | |
3221 return inlinePosition - previousInlinePosition; | |
3222 } | |
3223 | |
3209 void LayoutBox::computeInlineStaticDistance(Length& logicalLeft, Length& logical Right, const LayoutBox* child, const LayoutBoxModelObject* containerBlock, Layou tUnit containerLogicalWidth) | 3224 void LayoutBox::computeInlineStaticDistance(Length& logicalLeft, Length& logical Right, const LayoutBox* child, const LayoutBoxModelObject* containerBlock, Layou tUnit containerLogicalWidth) |
3210 { | 3225 { |
3211 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) | 3226 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) |
3212 return; | 3227 return; |
3213 | 3228 |
3229 // For multicol we also need to keep track of the block position, since that determines which | |
3230 // column we're in and thus affects the inline position. | |
3231 LayoutUnit staticBlockPosition = child->layer()->staticBlockPosition(); | |
3232 | |
3214 // FIXME: The static distance computation has not been patched for mixed wri ting modes yet. | 3233 // FIXME: The static distance computation has not been patched for mixed wri ting modes yet. |
3215 if (child->parent()->style()->direction() == LTR) { | 3234 if (child->parent()->style()->direction() == LTR) { |
3216 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con tainerBlock->borderLogicalLeft(); | 3235 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con tainerBlock->borderLogicalLeft(); |
3217 for (LayoutObject* curr = child->parent(); curr && curr != containerBloc k; curr = curr->container()) { | 3236 for (LayoutObject* curr = child->parent(); curr && curr != containerBloc k; curr = curr->container()) { |
3218 if (curr->isBox()) { | 3237 if (curr->isBox()) { |
3219 staticPosition += toLayoutBox(curr)->logicalLeft(); | 3238 staticPosition += toLayoutBox(curr)->logicalLeft(); |
3220 if (toLayoutBox(curr)->isInFlowPositioned()) | 3239 if (toLayoutBox(curr)->isInFlowPositioned()) |
3221 staticPosition += toLayoutBox(curr)->offsetForInFlowPosition ().width(); | 3240 staticPosition += toLayoutBox(curr)->offsetForInFlowPosition ().width(); |
3241 if (curr->isInsideFlowThread()) | |
3242 staticPosition += accumulateStaticOffsetForFlowThread(*toLay outBox(curr), staticPosition, staticBlockPosition); | |
3222 } else if (curr->isInline()) { | 3243 } else if (curr->isInline()) { |
3223 if (curr->isInFlowPositioned()) { | 3244 if (curr->isInFlowPositioned()) { |
3224 if (!curr->style()->logicalLeft().isAuto()) | 3245 if (!curr->style()->logicalLeft().isAuto()) |
3225 staticPosition += valueForLength(curr->style()->logicalL eft(), curr->containingBlock()->availableWidth()); | 3246 staticPosition += valueForLength(curr->style()->logicalL eft(), curr->containingBlock()->availableWidth()); |
3226 else | 3247 else |
3227 staticPosition -= valueForLength(curr->style()->logicalR ight(), curr->containingBlock()->availableWidth()); | 3248 staticPosition -= valueForLength(curr->style()->logicalR ight(), curr->containingBlock()->availableWidth()); |
3228 } | 3249 } |
3229 } | 3250 } |
3230 } | 3251 } |
3231 logicalLeft.setValue(Fixed, staticPosition); | 3252 logicalLeft.setValue(Fixed, staticPosition); |
3232 } else { | 3253 } else { |
3233 LayoutBox* enclosingBox = child->parent()->enclosingBox(); | 3254 LayoutBox* enclosingBox = child->parent()->enclosingBox(); |
3234 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con tainerLogicalWidth + containerBlock->borderLogicalLeft(); | 3255 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con tainerLogicalWidth + containerBlock->borderLogicalLeft(); |
3235 for (LayoutObject* curr = child->parent(); curr; curr = curr->container( )) { | 3256 for (LayoutObject* curr = child->parent(); curr; curr = curr->container( )) { |
3236 if (curr->isBox()) { | 3257 if (curr->isBox()) { |
3258 if (curr == enclosingBox) | |
3259 staticPosition -= enclosingBox->logicalWidth(); | |
3237 if (curr != containerBlock) { | 3260 if (curr != containerBlock) { |
3238 staticPosition -= toLayoutBox(curr)->logicalLeft(); | 3261 staticPosition -= toLayoutBox(curr)->logicalLeft(); |
3239 if (toLayoutBox(curr)->isInFlowPositioned()) | 3262 if (toLayoutBox(curr)->isInFlowPositioned()) |
3240 staticPosition -= toLayoutBox(curr)->offsetForInFlowPosi tion().width(); | 3263 staticPosition -= toLayoutBox(curr)->offsetForInFlowPosi tion().width(); |
3264 if (curr->isInsideFlowThread()) | |
3265 staticPosition -= accumulateStaticOffsetForFlowThread(*t oLayoutBox(curr), staticPosition, staticBlockPosition); | |
3241 } | 3266 } |
3242 if (curr == enclosingBox) | |
3243 staticPosition -= enclosingBox->logicalWidth(); | |
3244 } else if (curr->isInline()) { | 3267 } else if (curr->isInline()) { |
3245 if (curr->isInFlowPositioned()) { | 3268 if (curr->isInFlowPositioned()) { |
3246 if (!curr->style()->logicalLeft().isAuto()) | 3269 if (!curr->style()->logicalLeft().isAuto()) |
3247 staticPosition -= valueForLength(curr->style()->logicalL eft(), curr->containingBlock()->availableWidth()); | 3270 staticPosition -= valueForLength(curr->style()->logicalL eft(), curr->containingBlock()->availableWidth()); |
3248 else | 3271 else |
3249 staticPosition += valueForLength(curr->style()->logicalR ight(), curr->containingBlock()->availableWidth()); | 3272 staticPosition += valueForLength(curr->style()->logicalR ight(), curr->containingBlock()->availableWidth()); |
3250 } | 3273 } |
3251 } | 3274 } |
3252 if (curr == containerBlock) | 3275 if (curr == containerBlock) |
3253 break; | 3276 break; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3567 computedValues.m_position = logicalLeftValue + marginLogicalLeftValue; | 3590 computedValues.m_position = logicalLeftValue + marginLogicalLeftValue; |
3568 computeLogicalLeftPositionedOffset(computedValues.m_position, this, computed Values.m_extent, containerBlock, containerLogicalWidth); | 3591 computeLogicalLeftPositionedOffset(computedValues.m_position, this, computed Values.m_extent, containerBlock, containerLogicalWidth); |
3569 } | 3592 } |
3570 | 3593 |
3571 void LayoutBox::computeBlockStaticDistance(Length& logicalTop, Length& logicalBo ttom, const LayoutBox* child, const LayoutBoxModelObject* containerBlock) | 3594 void LayoutBox::computeBlockStaticDistance(Length& logicalTop, Length& logicalBo ttom, const LayoutBox* child, const LayoutBoxModelObject* containerBlock) |
3572 { | 3595 { |
3573 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) | 3596 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) |
3574 return; | 3597 return; |
3575 | 3598 |
3576 // FIXME: The static distance computation has not been patched for mixed wri ting modes. | 3599 // FIXME: The static distance computation has not been patched for mixed wri ting modes. |
3577 LayoutUnit staticLogicalTop = child->layer()->staticBlockPosition() - contai nerBlock->borderBefore(); | 3600 LayoutUnit staticLogicalTop = child->layer()->staticBlockPosition(); |
3578 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; c urr = curr->container()) { | 3601 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; c urr = curr->container()) { |
3579 if (curr->isBox() && !curr->isTableRow()) | 3602 if (!curr->isBox() || curr->isTableRow()) |
3580 staticLogicalTop += toLayoutBox(curr)->logicalTop(); | 3603 continue; |
3604 LayoutBox& box = *toLayoutBox(curr); | |
eae
2016/08/16 18:23:45
const?
mstensho (USE GERRIT)
2016/08/16 18:55:27
Done.
flowThreadToVisualLogicalPosition() didn't
| |
3605 staticLogicalTop += box.logicalTop(); | |
3606 if (!box.isLayoutFlowThread()) | |
3607 continue; | |
3608 // We're walking out of a flowthread here. This flow thread is not in th e containing block | |
3609 // chain, so we need to convert the position from the coordinate space o f this flowthread | |
3610 // to the containing coordinate space. The inline position cannot affect the block | |
3611 // position, so we don't bother calculating it. | |
3612 LayoutUnit dummyInlinePosition; | |
3613 toLayoutFlowThread(box).flowThreadToVisualLogicalPosition(staticLogicalT op, dummyInlinePosition); | |
3581 } | 3614 } |
3582 logicalTop.setValue(Fixed, staticLogicalTop); | 3615 logicalTop.setValue(Fixed, staticLogicalTop - containerBlock->borderBefore() ); |
3583 } | 3616 } |
3584 | 3617 |
3585 void LayoutBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp utedValues) const | 3618 void LayoutBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp utedValues) const |
3586 { | 3619 { |
3587 // The following is based off of the W3C Working Draft from April 11, 2006 o f | 3620 // The following is based off of the W3C Working Draft from April 11, 2006 o f |
3588 // CSS 2.1: Section 10.6.4 "Absolutely positioned, non-replaced elements" | 3621 // CSS 2.1: Section 10.6.4 "Absolutely positioned, non-replaced elements" |
3589 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-non-replace d-height> | 3622 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-non-replace d-height> |
3590 // (block-style-comments in this function and in computePositionedLogicalHei ghtUsing() | 3623 // (block-style-comments in this function and in computePositionedLogicalHei ghtUsing() |
3591 // correspond to text from the spec) | 3624 // correspond to text from the spec) |
3592 | 3625 |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4797 m_rareData->m_snapAreas->remove(&snapArea); | 4830 m_rareData->m_snapAreas->remove(&snapArea); |
4798 } | 4831 } |
4799 } | 4832 } |
4800 | 4833 |
4801 SnapAreaSet* LayoutBox::snapAreas() const | 4834 SnapAreaSet* LayoutBox::snapAreas() const |
4802 { | 4835 { |
4803 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4836 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
4804 } | 4837 } |
4805 | 4838 |
4806 } // namespace blink | 4839 } // namespace blink |
OLD | NEW |