| 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 4321 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 (!UNLIKELY(document().hasVerticalWritingMode())) |
| 4343 return point; |
| 4342 if (!style()->isFlippedBlocksWritingMode()) | 4344 if (!style()->isFlippedBlocksWritingMode()) |
| 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 { |
| 4356 if (!UNLIKELY(document().hasVerticalWritingMode())) |
| 4357 return point; |
| 4379 if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) | 4358 if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) |
| 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 |