| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 ASSERT(hasOverflowClip()); | 652 ASSERT(hasOverflowClip()); |
| 653 ASSERT(hasLayer()); | 653 ASSERT(hasLayer()); |
| 654 return layer()->scrollableArea()->scrollOffset(); | 654 return layer()->scrollableArea()->scrollOffset(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void RenderBox::applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& p
aintRect) const | 657 void RenderBox::applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& p
aintRect) const |
| 658 { | 658 { |
| 659 ASSERT(hasLayer()); | 659 ASSERT(hasLayer()); |
| 660 ASSERT(hasOverflowClip()); | 660 ASSERT(hasOverflowClip()); |
| 661 | 661 |
| 662 flipForWritingMode(paintRect); | |
| 663 paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden
. | 662 paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden
. |
| 664 | 663 |
| 665 // Do not clip scroll layer contents to reduce the number of paint invalidat
ions while scrolling. | 664 // Do not clip scroll layer contents to reduce the number of paint invalidat
ions while scrolling. |
| 666 if (usesCompositedScrolling()) { | 665 if (usesCompositedScrolling()) |
| 667 flipForWritingMode(paintRect); | |
| 668 return; | 666 return; |
| 669 } | |
| 670 | 667 |
| 671 // height() is inaccurate if we're in the middle of a layout of this RenderB
ox, so use the | 668 // height() is inaccurate if we're in the middle of a layout of this RenderB
ox, so use the |
| 672 // layer's size instead. Even if the layer's size is wrong, the layer itself
will issue paint invalidations | 669 // layer's size instead. Even if the layer's size is wrong, the layer itself
will issue paint invalidations |
| 673 // anyway if its size does change. | 670 // anyway if its size does change. |
| 674 LayoutRect clipRect(LayoutPoint(), layer()->size()); | 671 LayoutRect clipRect(LayoutPoint(), layer()->size()); |
| 675 paintRect = intersection(paintRect, clipRect); | 672 paintRect = intersection(paintRect, clipRect); |
| 676 flipForWritingMode(paintRect); | |
| 677 } | 673 } |
| 678 | 674 |
| 679 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const | 675 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const |
| 680 { | 676 { |
| 681 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 677 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
| 682 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 678 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
| 683 } | 679 } |
| 684 | 680 |
| 685 LayoutUnit RenderBox::minPreferredLogicalWidth() const | 681 LayoutUnit RenderBox::minPreferredLogicalWidth() const |
| 686 { | 682 { |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM
odelObject* paintInvalidationContainer, const PaintInvalidationState* paintInval
idationState) const | 1649 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM
odelObject* paintInvalidationContainer, const PaintInvalidationState* paintInval
idationState) const |
| 1654 { | 1650 { |
| 1655 LayoutRect r = visualOverflowRect(); | 1651 LayoutRect r = visualOverflowRect(); |
| 1656 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 1652 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
| 1657 return r; | 1653 return r; |
| 1658 } | 1654 } |
| 1659 | 1655 |
| 1660 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pain
tInvalidationState) const | 1656 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pain
tInvalidationState) const |
| 1661 { | 1657 { |
| 1662 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1658 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
| 1663 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | |
| 1664 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations | |
| 1665 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | |
| 1666 // | 1659 // |
| 1667 // RenderView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to | 1660 // RenderView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to |
| 1668 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1661 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the |
| 1669 // physical coordinate space of the paintInvalidationContainer. | 1662 // physical coordinate space of the paintInvalidationContainer. |
| 1670 RenderStyle* styleToUse = style(); | 1663 RenderStyle* styleToUse = style(); |
| 1671 | 1664 |
| 1672 EPosition position = styleToUse->position(); | 1665 EPosition position = styleToUse->position(); |
| 1673 | 1666 |
| 1674 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, | 1667 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, |
| 1675 // else we would forget to inflate it for the current renderer. FIXME: If th
ese were | 1668 // else we would forget to inflate it for the current renderer. FIXME: If th
ese were |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1693 | 1686 |
| 1694 if (paintInvalidationContainer == this) { | 1687 if (paintInvalidationContainer == this) { |
| 1695 return; | 1688 return; |
| 1696 } | 1689 } |
| 1697 | 1690 |
| 1698 bool containerSkipped; | 1691 bool containerSkipped; |
| 1699 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1692 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); |
| 1700 if (!o) | 1693 if (!o) |
| 1701 return; | 1694 return; |
| 1702 | 1695 |
| 1703 if (isWritingModeRoot()) | |
| 1704 flipForWritingMode(rect); | |
| 1705 | |
| 1706 LayoutPoint topLeft = rect.location(); | 1696 LayoutPoint topLeft = rect.location(); |
| 1707 topLeft.move(locationOffset()); | 1697 topLeft.move(locationOffset()); |
| 1708 | 1698 |
| 1709 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box | 1699 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box |
| 1710 // in the parent's coordinate space that encloses us. | 1700 // in the parent's coordinate space that encloses us. |
| 1711 if (hasLayer() && layer()->transform()) { | 1701 if (hasLayer() && layer()->transform()) { |
| 1712 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); | 1702 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); |
| 1713 topLeft = rect.location(); | 1703 topLeft = rect.location(); |
| 1714 topLeft.move(locationOffset()); | 1704 topLeft.move(locationOffset()); |
| 1715 } | 1705 } |
| (...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3819 // We want to include the margin, but only when it adds height. Quirky margi
ns don't contribute height | 3809 // We want to include the margin, but only when it adds height. Quirky margi
ns don't contribute height |
| 3820 // nor do the margins of self-collapsing blocks. | 3810 // nor do the margins of self-collapsing blocks. |
| 3821 if (!style()->hasMarginAfterQuirk() && !isSelfCollapsingBlock()) | 3811 if (!style()->hasMarginAfterQuirk() && !isSelfCollapsingBlock()) |
| 3822 rect.expand(LayoutSize(LayoutUnit(), marginAfter())); | 3812 rect.expand(LayoutSize(LayoutUnit(), marginAfter())); |
| 3823 | 3813 |
| 3824 if (!hasOverflowClip()) | 3814 if (!hasOverflowClip()) |
| 3825 rect.unite(layoutOverflowRect()); | 3815 rect.unite(layoutOverflowRect()); |
| 3826 | 3816 |
| 3827 bool hasTransform = hasLayer() && layer()->transform(); | 3817 bool hasTransform = hasLayer() && layer()->transform(); |
| 3828 if (isRelPositioned() || hasTransform) { | 3818 if (isRelPositioned() || hasTransform) { |
| 3829 // If we are relatively positioned or if we have a transform, then we ha
ve to convert | |
| 3830 // this rectangle into physical coordinates, apply relative positioning
and transforms | |
| 3831 // to it, and then convert it back. | |
| 3832 flipForWritingMode(rect); | |
| 3833 | |
| 3834 if (hasTransform) | 3819 if (hasTransform) |
| 3835 rect = layer()->currentTransform().mapRect(rect); | 3820 rect = layer()->currentTransform().mapRect(rect); |
| 3836 | 3821 |
| 3837 if (isRelPositioned()) | 3822 if (isRelPositioned()) |
| 3838 rect.move(offsetForInFlowPosition()); | 3823 rect.move(offsetForInFlowPosition()); |
| 3839 | |
| 3840 // Now we need to flip back. | |
| 3841 flipForWritingMode(rect); | |
| 3842 } | 3824 } |
| 3843 | 3825 |
| 3844 return rect; | 3826 return rect; |
| 3845 } | 3827 } |
| 3846 | 3828 |
| 3847 LayoutRect RenderBox::noOverflowRect() const | 3829 LayoutRect RenderBox::noOverflowRect() const |
| 3848 { | 3830 { |
| 3849 // Because of the special coordinate system used for overflow rectangles and
many other | 3831 // Because of the special coordinate system used for overflow rectangles and
many other |
| 3850 // rectangles (not quite logical, not quite physical), we need to flip the b
lock progression | 3832 // rectangles (not quite logical, not quite physical), we need to flip the b
lock progression |
| 3851 // coordinate in vertical-rl and horizontal-bt writing modes. In other words
, the rectangle | 3833 // coordinate in vertical-rl and horizontal-bt writing modes. In other words
, the rectangle |
| 3852 // returned is physical, except for the block direction progression coordina
te (y in horizontal | 3834 // returned is physical, except for the block direction progression coordina
te (y in horizontal |
| 3853 // writing modes, x in vertical writing modes), which is always "logical top
". Apart from the | 3835 // writing modes, x in vertical writing modes), which is always "logical top
". Apart from the |
| 3854 // flipping, this method does the same as clientBoxRect(). | 3836 // flipping, this method does the same as clientBoxRect(). |
| 3855 | 3837 |
| 3856 const int scrollBarWidth = verticalScrollbarWidth(); | 3838 const int scrollBarWidth = verticalScrollbarWidth(); |
| 3857 const int scrollBarHeight = horizontalScrollbarHeight(); | 3839 const int scrollBarHeight = horizontalScrollbarHeight(); |
| 3858 LayoutUnit left = borderLeft() + (style()->shouldPlaceBlockDirectionScrollba
rOnLogicalLeft() ? scrollBarWidth : 0); | 3840 LayoutUnit left = borderLeft() + (style()->shouldPlaceBlockDirectionScrollba
rOnLogicalLeft() ? scrollBarWidth : 0); |
| 3859 LayoutUnit top = borderTop(); | 3841 LayoutUnit top = borderTop(); |
| 3860 LayoutUnit right = borderRight(); | 3842 LayoutUnit right = borderRight(); |
| 3861 LayoutUnit bottom = borderBottom(); | 3843 LayoutUnit bottom = borderBottom(); |
| 3862 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); | 3844 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); |
| 3863 flipForWritingMode(rect); | |
| 3864 // Subtract space occupied by scrollbars. Order is important here: first fli
p, then subtract | 3845 // Subtract space occupied by scrollbars. Order is important here: first fli
p, then subtract |
| 3865 // scrollbars. This may seem backwards and weird, since one would think that
a horizontal | 3846 // scrollbars. This may seem backwards and weird, since one would think that
a horizontal |
| 3866 // scrollbar at the physical bottom in horizontal-bt ought to be at the logi
cal top (physical | 3847 // scrollbar at the physical bottom in horizontal-bt ought to be at the logi
cal top (physical |
| 3867 // bottom), between the logical top (physical bottom) border and the logical
top (physical | 3848 // bottom), between the logical top (physical bottom) border and the logical
top (physical |
| 3868 // bottom) padding. But this is how the rest of the code expects us to behav
e. This is highly | 3849 // bottom) padding. But this is how the rest of the code expects us to behav
e. This is highly |
| 3869 // related to https://bugs.webkit.org/show_bug.cgi?id=76129 | 3850 // related to https://bugs.webkit.org/show_bug.cgi?id=76129 |
| 3870 // FIXME: when the above mentioned bug is fixed, it should hopefully be poss
ible to call | 3851 // FIXME: when the above mentioned bug is fixed, it should hopefully be poss
ible to call |
| 3871 // clientBoxRect() or paddingBoxRect() in this method, rather than fiddling
with the edges on | 3852 // clientBoxRect() or paddingBoxRect() in this method, rather than fiddling
with the edges on |
| 3872 // our own. | 3853 // our own. |
| 3873 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 3854 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3891 LayoutUnit RenderBox::offsetLeft() const | 3872 LayoutUnit RenderBox::offsetLeft() const |
| 3892 { | 3873 { |
| 3893 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); | 3874 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); |
| 3894 } | 3875 } |
| 3895 | 3876 |
| 3896 LayoutUnit RenderBox::offsetTop() const | 3877 LayoutUnit RenderBox::offsetTop() const |
| 3897 { | 3878 { |
| 3898 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y(); | 3879 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y(); |
| 3899 } | 3880 } |
| 3900 | 3881 |
| 3901 LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const
LayoutPoint& point) const | |
| 3902 { | |
| 3903 // FIXME(sky): Remove | |
| 3904 return point; | |
| 3905 } | |
| 3906 | |
| 3907 void RenderBox::flipForWritingMode(LayoutRect& rect) const | |
| 3908 { | |
| 3909 // FIXME(sky): Remove | |
| 3910 } | |
| 3911 | |
| 3912 LayoutUnit RenderBox::flipForWritingMode(LayoutUnit position) const | |
| 3913 { | |
| 3914 // FIXME(sky): Remove | |
| 3915 return position; | |
| 3916 } | |
| 3917 | |
| 3918 LayoutPoint RenderBox::flipForWritingMode(const LayoutPoint& position) const | |
| 3919 { | |
| 3920 // FIXME(sky): Remove | |
| 3921 return position; | |
| 3922 } | |
| 3923 | |
| 3924 LayoutPoint RenderBox::flipForWritingModeIncludingColumns(const LayoutPoint& poi
nt) const | |
| 3925 { | |
| 3926 // FIXME(sky): Remove | |
| 3927 return point; | |
| 3928 } | |
| 3929 | |
| 3930 LayoutSize RenderBox::flipForWritingMode(const LayoutSize& offset) const | |
| 3931 { | |
| 3932 // FIXME(sky): Remove | |
| 3933 return offset; | |
| 3934 } | |
| 3935 | |
| 3936 FloatPoint RenderBox::flipForWritingMode(const FloatPoint& position) const | |
| 3937 { | |
| 3938 // FIXME(sky): Remove | |
| 3939 return position; | |
| 3940 } | |
| 3941 | |
| 3942 void RenderBox::flipForWritingMode(FloatRect& rect) const | |
| 3943 { | |
| 3944 // FIXME(sky): Remove | |
| 3945 } | |
| 3946 | |
| 3947 LayoutPoint RenderBox::topLeftLocation() const | 3882 LayoutPoint RenderBox::topLeftLocation() const |
| 3948 { | 3883 { |
| 3949 RenderBlock* containerBlock = containingBlock(); | 3884 // FIXME(sky): Remove this. |
| 3950 if (!containerBlock || containerBlock == this) | 3885 return location(); |
| 3951 return location(); | |
| 3952 return containerBlock->flipForWritingModeForChild(this, location()); | |
| 3953 } | 3886 } |
| 3954 | 3887 |
| 3955 LayoutSize RenderBox::topLeftLocationOffset() const | 3888 LayoutSize RenderBox::topLeftLocationOffset() const |
| 3956 { | 3889 { |
| 3957 RenderBlock* containerBlock = containingBlock(); | 3890 // FIXME(sky): Remove this. |
| 3958 if (!containerBlock || containerBlock == this) | 3891 return locationOffset(); |
| 3959 return locationOffset(); | |
| 3960 | |
| 3961 LayoutRect rect(frameRect()); | |
| 3962 containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are
an absolutely positioned object enclosed by a relative-positioned inline. | |
| 3963 return LayoutSize(rect.x(), rect.y()); | |
| 3964 } | 3892 } |
| 3965 | 3893 |
| 3966 bool RenderBox::hasRelativeLogicalHeight() const | 3894 bool RenderBox::hasRelativeLogicalHeight() const |
| 3967 { | 3895 { |
| 3968 return style()->logicalHeight().isPercent() | 3896 return style()->logicalHeight().isPercent() |
| 3969 || style()->logicalMinHeight().isPercent() | 3897 || style()->logicalMinHeight().isPercent() |
| 3970 || style()->logicalMaxHeight().isPercent(); | 3898 || style()->logicalMaxHeight().isPercent(); |
| 3971 } | 3899 } |
| 3972 | 3900 |
| 3973 static void markBoxForRelayoutAfterSplit(RenderBox* box) | 3901 static void markBoxForRelayoutAfterSplit(RenderBox* box) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4049 | 3977 |
| 4050 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3978 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 4051 { | 3979 { |
| 4052 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3980 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 4053 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3981 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 4054 ASSERT(hasBackground == style.hasBackground()); | 3982 ASSERT(hasBackground == style.hasBackground()); |
| 4055 hasBorder = style.hasBorder(); | 3983 hasBorder = style.hasBorder(); |
| 4056 } | 3984 } |
| 4057 | 3985 |
| 4058 } // namespace blink | 3986 } // namespace blink |
| OLD | NEW |