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 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 } | 3443 } |
3444 } | 3444 } |
3445 | 3445 |
3446 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const
RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con
tainerBlock, LayoutUnit containerLogicalWidth) | 3446 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const
RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con
tainerBlock, LayoutUnit containerLogicalWidth) |
3447 { | 3447 { |
3448 // Deal with differing writing modes here. Our offset needs to be in the co
ntaining block's coordinate space. If the containing block is flipped | 3448 // Deal with differing writing modes here. Our offset needs to be in the co
ntaining block's coordinate space. If the containing block is flipped |
3449 // along this axis, then we need to flip the coordinate. This can only happ
en if the containing block is both a flipped mode and perpendicular to us. | 3449 // along this axis, then we need to flip the coordinate. This can only happ
en if the containing block is both a flipped mode and perpendicular to us. |
3450 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM
ode() && containerBlock->style()->isFlippedBlocksWritingMode()) { | 3450 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM
ode() && containerBlock->style()->isFlippedBlocksWritingMode()) { |
3451 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft
Pos; | 3451 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft
Pos; |
3452 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderRight() : containerBlock->borderBottom()); | 3452 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderRight() : containerBlock->borderBottom()); |
3453 } else | 3453 } else if (child->isHorizontalWritingMode()) { |
3454 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderLeft() : containerBlock->borderTop()); | 3454 RenderStyle* blockStyle = containerBlock->style(); |
| 3455 bool containerBlockIsLTR = isLeftToRightDirection(blockStyle->direction(
)); |
| 3456 ETextAlign textAlignForContainerBlock = containerBlock->simplifiedTextAl
ign(blockStyle->textAlign()); |
| 3457 if (containerBlockIsLTR && textAlignForContainerBlock == RIGHT) { |
| 3458 logicalLeftPos = containerLogicalWidth - (logicalWidthValue + child-
>borderLogicalWidth() + child->style()->logicalRight().value()); |
| 3459 logicalLeftPos += containerBlock->borderLogicalRight(); |
| 3460 } else if (!containerBlockIsLTR && textAlignForContainerBlock == LEFT) { |
| 3461 logicalLeftPos += containerBlock->borderAndPaddingLogicalLeft() + lo
gicalWidthValue; |
| 3462 } else { |
| 3463 logicalLeftPos += containerBlock->borderLeft(); |
| 3464 } |
| 3465 } else { |
| 3466 logicalLeftPos += containerBlock->borderTop(); |
| 3467 } |
3455 } | 3468 } |
3456 | 3469 |
3457 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn
it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV
alues& computedValues) const | 3470 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn
it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV
alues& computedValues) const |
3458 { | 3471 { |
3459 // FIXME: would it be better to have shrink-to-fit in one step? | 3472 // FIXME: would it be better to have shrink-to-fit in one step? |
3460 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; | 3473 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; |
3461 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPaddi
ng; | 3474 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPaddi
ng; |
3462 LayoutUnit availableWidth = availableSpace - logicalLeftValue; | 3475 LayoutUnit availableWidth = availableSpace - logicalLeftValue; |
3463 computedValues.m_extent = min(max(preferredMinWidth, availableWidth), prefer
redWidth); | 3476 computedValues.m_extent = min(max(preferredMinWidth, availableWidth), prefer
redWidth); |
3464 } | 3477 } |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4913 return 0; | 4926 return 0; |
4914 | 4927 |
4915 if (!layoutState && !flowThreadContainingBlock()) | 4928 if (!layoutState && !flowThreadContainingBlock()) |
4916 return 0; | 4929 return 0; |
4917 | 4930 |
4918 RenderBlock* containerBlock = containingBlock(); | 4931 RenderBlock* containerBlock = containingBlock(); |
4919 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4932 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4920 } | 4933 } |
4921 | 4934 |
4922 } // namespace WebCore | 4935 } // namespace WebCore |
OLD | NEW |