| 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 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 rect.move(layer()->offsetForInFlowPosition()); | 1756 rect.move(layer()->offsetForInFlowPosition()); |
| 1757 | 1757 |
| 1758 rect.moveBy(location()); | 1758 rect.moveBy(location()); |
| 1759 rect.move(paintInvalidationState->paintOffset()); | 1759 rect.move(paintInvalidationState->paintOffset()); |
| 1760 if (paintInvalidationState->isClipped()) | 1760 if (paintInvalidationState->isClipped()) |
| 1761 rect.intersect(paintInvalidationState->clipRect()); | 1761 rect.intersect(paintInvalidationState->clipRect()); |
| 1762 return; | 1762 return; |
| 1763 } | 1763 } |
| 1764 | 1764 |
| 1765 if (paintInvalidationContainer == this) { | 1765 if (paintInvalidationContainer == this) { |
| 1766 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode()) | 1766 if (paintInvalidationContainer->style()->slowIsFlippedBlocksWritingMode(
)) |
| 1767 flipForWritingMode(rect); | 1767 flipForWritingMode(rect); |
| 1768 return; | 1768 return; |
| 1769 } | 1769 } |
| 1770 | 1770 |
| 1771 bool containerSkipped; | 1771 bool containerSkipped; |
| 1772 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1772 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); |
| 1773 if (!o) | 1773 if (!o) |
| 1774 return; | 1774 return; |
| 1775 | 1775 |
| 1776 if (isWritingModeRoot()) | 1776 if (isWritingModeRoot()) |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 } | 2911 } |
| 2912 } | 2912 } |
| 2913 | 2913 |
| 2914 computedValues.m_extent += bordersPlusPadding; | 2914 computedValues.m_extent += bordersPlusPadding; |
| 2915 } | 2915 } |
| 2916 | 2916 |
| 2917 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const
RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con
tainerBlock, LayoutUnit containerLogicalWidth) | 2917 static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const
RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* con
tainerBlock, LayoutUnit containerLogicalWidth) |
| 2918 { | 2918 { |
| 2919 // 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 | 2919 // 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 |
| 2920 // 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. | 2920 // 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. |
| 2921 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM
ode() && containerBlock->style()->isFlippedBlocksWritingMode()) { | 2921 if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingM
ode() && containerBlock->style()->slowIsFlippedBlocksWritingMode()) { |
| 2922 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft
Pos; | 2922 logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeft
Pos; |
| 2923 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderRight() : containerBlock->borderBottom()); | 2923 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderRight() : containerBlock->borderBottom()); |
| 2924 } else { | 2924 } else { |
| 2925 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderLeft() : containerBlock->borderTop()); | 2925 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderLeft() : containerBlock->borderTop()); |
| 2926 } | 2926 } |
| 2927 } | 2927 } |
| 2928 | 2928 |
| 2929 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn
it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV
alues& computedValues) const | 2929 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn
it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV
alues& computedValues) const |
| 2930 { | 2930 { |
| 2931 // FIXME: would it be better to have shrink-to-fit in one step? | 2931 // FIXME: would it be better to have shrink-to-fit in one step? |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3222 } | 3222 } |
| 3223 | 3223 |
| 3224 // Set final height value. | 3224 // Set final height value. |
| 3225 computedValues.m_extent += bordersPlusPadding; | 3225 computedValues.m_extent += bordersPlusPadding; |
| 3226 } | 3226 } |
| 3227 | 3227 |
| 3228 static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const R
enderBox* child, LayoutUnit logicalHeightValue, const RenderBoxModelObject* cont
ainerBlock, LayoutUnit containerLogicalHeight) | 3228 static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const R
enderBox* child, LayoutUnit logicalHeightValue, const RenderBoxModelObject* cont
ainerBlock, LayoutUnit containerLogicalHeight) |
| 3229 { | 3229 { |
| 3230 // 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 | 3230 // 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 |
| 3231 // 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. | 3231 // 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. |
| 3232 if ((child->style()->isFlippedBlocksWritingMode() && child->isHorizontalWrit
ingMode() != containerBlock->isHorizontalWritingMode()) | 3232 if ((child->style()->slowIsFlippedBlocksWritingMode() && child->isHorizontal
WritingMode() != containerBlock->isHorizontalWritingMode()) |
| 3233 || (child->style()->isFlippedBlocksWritingMode() != containerBlock->styl
e()->isFlippedBlocksWritingMode() && child->isHorizontalWritingMode() == contain
erBlock->isHorizontalWritingMode())) | 3233 || (child->style()->slowIsFlippedBlocksWritingMode() != containerBlock->
style()->slowIsFlippedBlocksWritingMode() && child->isHorizontalWritingMode() ==
containerBlock->isHorizontalWritingMode())) |
| 3234 logicalTopPos = containerLogicalHeight - logicalHeightValue - logicalTop
Pos; | 3234 logicalTopPos = containerLogicalHeight - logicalHeightValue - logicalTop
Pos; |
| 3235 | 3235 |
| 3236 // Our offset is from the logical bottom edge in a flipped environment, e.g.
, right for vertical-rl and bottom for horizontal-bt. | 3236 // Our offset is from the logical bottom edge in a flipped environment, e.g.
, right for vertical-rl and bottom for horizontal-bt. |
| 3237 if (containerBlock->style()->isFlippedBlocksWritingMode() && child->isHorizo
ntalWritingMode() == containerBlock->isHorizontalWritingMode()) { | 3237 if (containerBlock->style()->slowIsFlippedBlocksWritingMode() && child->isHo
rizontalWritingMode() == containerBlock->isHorizontalWritingMode()) { |
| 3238 if (child->isHorizontalWritingMode()) | 3238 if (child->isHorizontalWritingMode()) |
| 3239 logicalTopPos += containerBlock->borderBottom(); | 3239 logicalTopPos += containerBlock->borderBottom(); |
| 3240 else | 3240 else |
| 3241 logicalTopPos += containerBlock->borderRight(); | 3241 logicalTopPos += containerBlock->borderRight(); |
| 3242 } else { | 3242 } else { |
| 3243 if (child->isHorizontalWritingMode()) | 3243 if (child->isHorizontalWritingMode()) |
| 3244 logicalTopPos += containerBlock->borderTop(); | 3244 logicalTopPos += containerBlock->borderTop(); |
| 3245 else | 3245 else |
| 3246 logicalTopPos += containerBlock->borderLeft(); | 3246 logicalTopPos += containerBlock->borderLeft(); |
| 3247 } | 3247 } |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4332 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); | 4332 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); |
| 4333 } | 4333 } |
| 4334 | 4334 |
| 4335 LayoutUnit RenderBox::offsetTop() const | 4335 LayoutUnit RenderBox::offsetTop() const |
| 4336 { | 4336 { |
| 4337 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y(); | 4337 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y(); |
| 4338 } | 4338 } |
| 4339 | 4339 |
| 4340 LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const
LayoutPoint& point) const | 4340 LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const
LayoutPoint& point) const |
| 4341 { | 4341 { |
| 4342 if (!style()->isFlippedBlocksWritingMode()) | 4342 if (!UNLIKELY(document().containsAnyVerticalWritingModes())) |
| 4343 return point; |
| 4344 if (!style()->slowIsFlippedBlocksWritingMode()) |
| 4343 return point; | 4345 return point; |
| 4344 | 4346 |
| 4345 // The child is going to add in its x() and y(), so we have to make sure it
ends up in | 4347 // The child is going to add in its x() and y(), so we have to make sure it
ends up in |
| 4346 // the right place. | 4348 // the right place. |
| 4347 if (isHorizontalWritingMode()) | 4349 if (isHorizontalWritingMode()) |
| 4348 return LayoutPoint(point.x(), point.y() + height() - child->height() - (
2 * child->y())); | 4350 return LayoutPoint(point.x(), point.y() + height() - child->height() - (
2 * child->y())); |
| 4349 return LayoutPoint(point.x() + width() - child->width() - (2 * child->x()),
point.y()); | 4351 return LayoutPoint(point.x() + width() - child->width() - (2 * child->x()),
point.y()); |
| 4350 } | 4352 } |
| 4351 | 4353 |
| 4352 void RenderBox::flipForWritingMode(LayoutRect& rect) const | |
| 4353 { | |
| 4354 if (!style()->isFlippedBlocksWritingMode()) | |
| 4355 return; | |
| 4356 | |
| 4357 if (isHorizontalWritingMode()) | |
| 4358 rect.setY(height() - rect.maxY()); | |
| 4359 else | |
| 4360 rect.setX(width() - rect.maxX()); | |
| 4361 } | |
| 4362 | |
| 4363 LayoutUnit RenderBox::flipForWritingMode(LayoutUnit position) const | |
| 4364 { | |
| 4365 if (!style()->isFlippedBlocksWritingMode()) | |
| 4366 return position; | |
| 4367 return logicalHeight() - position; | |
| 4368 } | |
| 4369 | |
| 4370 LayoutPoint RenderBox::flipForWritingMode(const LayoutPoint& position) const | |
| 4371 { | |
| 4372 if (!style()->isFlippedBlocksWritingMode()) | |
| 4373 return position; | |
| 4374 return isHorizontalWritingMode() ? LayoutPoint(position.x(), height() - posi
tion.y()) : LayoutPoint(width() - position.x(), position.y()); | |
| 4375 } | |
| 4376 | |
| 4377 LayoutPoint RenderBox::flipForWritingModeIncludingColumns(const LayoutPoint& poi
nt) const | 4354 LayoutPoint RenderBox::flipForWritingModeIncludingColumns(const LayoutPoint& poi
nt) const |
| 4378 { | 4355 { |
| 4379 if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) | 4356 if (!UNLIKELY(document().containsAnyVerticalWritingModes())) |
| 4357 return point; |
| 4358 if (!hasColumns() || !style()->slowIsFlippedBlocksWritingMode()) |
| 4380 return flipForWritingMode(point); | 4359 return flipForWritingMode(point); |
| 4381 return toRenderBlock(this)->flipForWritingModeIncludingColumns(point); | 4360 return toRenderBlock(this)->flipForWritingModeIncludingColumns(point); |
| 4382 } | 4361 } |
| 4383 | 4362 |
| 4384 LayoutSize RenderBox::flipForWritingMode(const LayoutSize& offset) const | |
| 4385 { | |
| 4386 if (!style()->isFlippedBlocksWritingMode()) | |
| 4387 return offset; | |
| 4388 return isHorizontalWritingMode() ? LayoutSize(offset.width(), height() - off
set.height()) : LayoutSize(width() - offset.width(), offset.height()); | |
| 4389 } | |
| 4390 | |
| 4391 FloatPoint RenderBox::flipForWritingMode(const FloatPoint& position) const | |
| 4392 { | |
| 4393 if (!style()->isFlippedBlocksWritingMode()) | |
| 4394 return position; | |
| 4395 return isHorizontalWritingMode() ? FloatPoint(position.x(), height() - posit
ion.y()) : FloatPoint(width() - position.x(), position.y()); | |
| 4396 } | |
| 4397 | |
| 4398 void RenderBox::flipForWritingMode(FloatRect& rect) const | |
| 4399 { | |
| 4400 if (!style()->isFlippedBlocksWritingMode()) | |
| 4401 return; | |
| 4402 | |
| 4403 if (isHorizontalWritingMode()) | |
| 4404 rect.setY(height() - rect.maxY()); | |
| 4405 else | |
| 4406 rect.setX(width() - rect.maxX()); | |
| 4407 } | |
| 4408 | |
| 4409 LayoutPoint RenderBox::topLeftLocation() const | 4363 LayoutPoint RenderBox::topLeftLocation() const |
| 4410 { | 4364 { |
| 4411 RenderBlock* containerBlock = containingBlock(); | 4365 RenderBlock* containerBlock = containingBlock(); |
| 4412 if (!containerBlock || containerBlock == this) | 4366 if (!containerBlock || containerBlock == this) |
| 4413 return location(); | 4367 return location(); |
| 4414 return containerBlock->flipForWritingModeForChild(this, location()); | 4368 return containerBlock->flipForWritingModeForChild(this, location()); |
| 4415 } | 4369 } |
| 4416 | 4370 |
| 4417 LayoutSize RenderBox::topLeftLocationOffset() const | 4371 LayoutSize RenderBox::topLeftLocationOffset() const |
| 4418 { | 4372 { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4525 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); | 4479 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); |
| 4526 | 4480 |
| 4527 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) | 4481 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) |
| 4528 return m_rareData->m_previousBorderBoxSize; | 4482 return m_rareData->m_previousBorderBoxSize; |
| 4529 | 4483 |
| 4530 // We didn't save the old border box size because it was the same as the siz
e of oldBounds. | 4484 // We didn't save the old border box size because it was the same as the siz
e of oldBounds. |
| 4531 return previousBoundsSize; | 4485 return previousBoundsSize; |
| 4532 } | 4486 } |
| 4533 | 4487 |
| 4534 } // namespace blink | 4488 } // namespace blink |
| OLD | NEW |