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 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 | 1658 |
1659 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o, const LayoutPoi
nt& point, bool* offsetDependsOnPoint) const | 1659 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o, const LayoutPoi
nt& point, bool* offsetDependsOnPoint) const |
1660 { | 1660 { |
1661 ASSERT(o == container()); | 1661 ASSERT(o == container()); |
1662 | 1662 |
1663 LayoutSize offset; | 1663 LayoutSize offset; |
1664 if (isRelPositioned()) | 1664 if (isRelPositioned()) |
1665 offset += offsetForInFlowPosition(); | 1665 offset += offsetForInFlowPosition(); |
1666 | 1666 |
1667 if (!isInline() || isReplaced()) { | 1667 if (!isInline() || isReplaced()) { |
1668 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { | 1668 offset += topLeftLocationOffset(); |
1669 const LayoutBlock* block = toLayoutBlock(o); | 1669 if (o->isLayoutFlowThread()) { |
1670 LayoutRect columnRect(frameRect()); | 1670 // So far the point has been in flow thread coordinates (i.e. as if
everything in |
1671 block->adjustStartEdgeForWritingModeIncludingColumns(columnRect); | 1671 // the fragmentation context lived in one tall single column). Conve
rt it to a |
1672 offset += toSize(columnRect.location()); | 1672 // visual point now. |
1673 LayoutPoint columnPoint = block->flipForWritingModeIncludingColumns(
point + offset); | 1673 LayoutPoint pointInContainer = point + offset; |
1674 offset = toLayoutSize(block->flipForWritingModeIncludingColumns(toLa
youtPoint(offset))); | 1674 offset += o->columnOffset(pointInContainer); |
1675 offset += o->columnOffset(columnPoint); | |
1676 offset = block->flipForWritingMode(offset); | |
1677 | |
1678 if (offsetDependsOnPoint) | 1675 if (offsetDependsOnPoint) |
1679 *offsetDependsOnPoint = true; | 1676 *offsetDependsOnPoint = true; |
1680 } else { | |
1681 offset += topLeftLocationOffset(); | |
1682 if (o->isLayoutFlowThread()) { | |
1683 // So far the point has been in flow thread coordinates (i.e. as
if everything in | |
1684 // the fragmentation context lived in one tall single column). C
onvert it to a | |
1685 // visual point now. | |
1686 LayoutPoint pointInContainer = point + offset; | |
1687 offset += o->columnOffset(pointInContainer); | |
1688 if (offsetDependsOnPoint) | |
1689 *offsetDependsOnPoint = true; | |
1690 } | |
1691 } | 1677 } |
1692 } | 1678 } |
1693 | 1679 |
1694 if (o->hasOverflowClip()) | 1680 if (o->hasOverflowClip()) |
1695 offset -= toLayoutBox(o)->scrolledContentOffset(); | 1681 offset -= toLayoutBox(o)->scrolledContentOffset(); |
1696 | 1682 |
1697 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is
LayoutInline()) | 1683 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is
LayoutInline()) |
1698 offset += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); | 1684 offset += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); |
1699 | 1685 |
1700 return offset; | 1686 return offset; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 if (position == AbsolutePosition && o->isRelPositioned() && o->isLayoutInlin
e()) { | 1848 if (position == AbsolutePosition && o->isRelPositioned() && o->isLayoutInlin
e()) { |
1863 topLeft += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); | 1849 topLeft += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); |
1864 } else if (styleToUse.hasInFlowPosition() && layer()) { | 1850 } else if (styleToUse.hasInFlowPosition() && layer()) { |
1865 // Apply the relative position offset when invalidating a rectangle. Th
e layer | 1851 // Apply the relative position offset when invalidating a rectangle. Th
e layer |
1866 // is translated, but the layout box isn't, so we need to do this to get
the | 1852 // is translated, but the layout box isn't, so we need to do this to get
the |
1867 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position | 1853 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position |
1868 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). | 1854 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). |
1869 topLeft += layer()->offsetForInFlowPosition(); | 1855 topLeft += layer()->offsetForInFlowPosition(); |
1870 } | 1856 } |
1871 | 1857 |
1872 if (position != AbsolutePosition && position != FixedPosition && o->hasColum
ns() && o->isLayoutBlockFlow()) { | |
1873 LayoutRect paintInvalidationRect(topLeft, rect.size()); | |
1874 toLayoutBlock(o)->adjustRectForColumns(paintInvalidationRect); | |
1875 topLeft = paintInvalidationRect.location(); | |
1876 rect = paintInvalidationRect; | |
1877 } | |
1878 | |
1879 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 1858 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
1880 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 1859 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
1881 rect.setLocation(topLeft); | 1860 rect.setLocation(topLeft); |
1882 if (o->hasOverflowClip()) { | 1861 if (o->hasOverflowClip()) { |
1883 LayoutBox* containerBox = toLayoutBox(o); | 1862 LayoutBox* containerBox = toLayoutBox(o); |
1884 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rect); | 1863 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rect); |
1885 if (rect.isEmpty()) | 1864 if (rect.isEmpty()) |
1886 return; | 1865 return; |
1887 } | 1866 } |
1888 | 1867 |
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4549 if (!style()->isFlippedBlocksWritingMode()) | 4528 if (!style()->isFlippedBlocksWritingMode()) |
4550 return point; | 4529 return point; |
4551 | 4530 |
4552 // The child is going to add in its x() and y(), so we have to make sure it
ends up in | 4531 // The child is going to add in its x() and y(), so we have to make sure it
ends up in |
4553 // the right place. | 4532 // the right place. |
4554 if (isHorizontalWritingMode()) | 4533 if (isHorizontalWritingMode()) |
4555 return LayoutPoint(point.x(), point.y() + size().height() - child->size(
).height() - (2 * child->location().y())); | 4534 return LayoutPoint(point.x(), point.y() + size().height() - child->size(
).height() - (2 * child->location().y())); |
4556 return LayoutPoint(point.x() + size().width() - child->size().width() - (2 *
child->location().x()), point.y()); | 4535 return LayoutPoint(point.x() + size().width() - child->size().width() - (2 *
child->location().x()), point.y()); |
4557 } | 4536 } |
4558 | 4537 |
4559 LayoutPoint LayoutBox::flipForWritingModeIncludingColumns(const LayoutPoint& poi
nt) const | |
4560 { | |
4561 if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) | |
4562 return flipForWritingMode(point); | |
4563 return toLayoutBlock(this)->flipForWritingModeIncludingColumns(point); | |
4564 } | |
4565 | |
4566 LayoutPoint LayoutBox::topLeftLocation() const | 4538 LayoutPoint LayoutBox::topLeftLocation() const |
4567 { | 4539 { |
4568 LayoutBlock* containerBlock = containingBlock(); | 4540 LayoutBlock* containerBlock = containingBlock(); |
4569 if (!containerBlock || containerBlock == this) | 4541 if (!containerBlock || containerBlock == this) |
4570 return location(); | 4542 return location(); |
4571 return containerBlock->flipForWritingModeForChild(this, location()); | 4543 return containerBlock->flipForWritingModeForChild(this, location()); |
4572 } | 4544 } |
4573 | 4545 |
4574 bool LayoutBox::hasRelativeLogicalWidth() const | 4546 bool LayoutBox::hasRelativeLogicalWidth() const |
4575 { | 4547 { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4821 bool LayoutBox::canRenderBorderImage() const | 4793 bool LayoutBox::canRenderBorderImage() const |
4822 { | 4794 { |
4823 if (!style()->hasBorder()) | 4795 if (!style()->hasBorder()) |
4824 return false; | 4796 return false; |
4825 | 4797 |
4826 StyleImage* borderImage = style()->borderImage().image(); | 4798 StyleImage* borderImage = style()->borderImage().image(); |
4827 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4799 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
4828 } | 4800 } |
4829 | 4801 |
4830 } // namespace blink | 4802 } // namespace blink |
OLD | NEW |