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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? | 943 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? |
944 // https://bugs.webkit.org/show_bug.cgi?id=28237 | 944 // https://bugs.webkit.org/show_bug.cgi?id=28237 |
945 } | 945 } |
946 } | 946 } |
947 | 947 |
948 bool LayoutBox::needsPreferredWidthsRecalculation() const | 948 bool LayoutBox::needsPreferredWidthsRecalculation() const |
949 { | 949 { |
950 return style()->paddingStart().hasPercent() || style()->paddingEnd().hasPerc
ent(); | 950 return style()->paddingStart().hasPercent() || style()->paddingEnd().hasPerc
ent(); |
951 } | 951 } |
952 | 952 |
| 953 IntSize LayoutBox::originAdjustmentForScrollbars() const |
| 954 { |
| 955 IntSize size; |
| 956 int adjustmentWidth = verticalScrollbarWidth(); |
| 957 if (hasFlippedBlocksWritingMode() |
| 958 || (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLog
icalLeft())) { |
| 959 size.expand(adjustmentWidth, 0); |
| 960 } |
| 961 return size; |
| 962 } |
| 963 |
953 IntSize LayoutBox::scrolledContentOffset() const | 964 IntSize LayoutBox::scrolledContentOffset() const |
954 { | 965 { |
955 ASSERT(hasOverflowClip()); | 966 ASSERT(hasOverflowClip()); |
956 ASSERT(hasLayer()); | 967 ASSERT(hasLayer()); |
957 // FIXME: Return DoubleSize here. crbug.com/414283. | 968 // FIXME: Return DoubleSize here. crbug.com/414283. |
958 return flooredIntSize(getScrollableArea()->scrollOffset()); | 969 PaintLayerScrollableArea* scrollableArea = getScrollableArea(); |
| 970 IntSize result = flooredIntSize(scrollableArea->scrollOffset()) + originAdju
stmentForScrollbars(); |
| 971 if (isHorizontalWritingMode() && shouldPlaceBlockDirectionScrollbarOnLogical
Left()) |
| 972 result.expand(-verticalScrollbarWidth(), 0); |
| 973 return result; |
959 } | 974 } |
960 | 975 |
961 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl
owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const | 976 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl
owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const |
962 { | 977 { |
963 if (!hasOverflowClip()) | 978 if (!hasOverflowClip()) |
964 return true; | 979 return true; |
965 | 980 |
966 LayoutSize offset = LayoutSize(-scrolledContentOffset()); | 981 LayoutSize offset = LayoutSize(-scrolledContentOffset()); |
967 if (UNLIKELY(hasFlippedBlocksWritingMode())) | 982 if (UNLIKELY(hasFlippedBlocksWritingMode())) |
968 offset.setWidth(-offset.width()); | 983 offset.setWidth(-offset.width()); |
(...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4120 // Add in visual overflow from the child. Even if the child clips its overf
low, it may still | 4135 // Add in visual overflow from the child. Even if the child clips its overf
low, it may still |
4121 // have visual overflow of its own set from box shadows or reflections. It
is unnecessary to propagate this | 4136 // have visual overflow of its own set from box shadows or reflections. It
is unnecessary to propagate this |
4122 // overflow if we are clipping our own overflow. | 4137 // overflow if we are clipping our own overflow. |
4123 if (child->hasSelfPaintingLayer()) | 4138 if (child->hasSelfPaintingLayer()) |
4124 return; | 4139 return; |
4125 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation
(styleRef()); | 4140 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation
(styleRef()); |
4126 childVisualOverflowRect.move(delta); | 4141 childVisualOverflowRect.move(delta); |
4127 addContentsVisualOverflow(childVisualOverflowRect); | 4142 addContentsVisualOverflow(childVisualOverflowRect); |
4128 } | 4143 } |
4129 | 4144 |
| 4145 bool LayoutBox::hasTopOverflow() const |
| 4146 { |
| 4147 return !style()->isLeftToRightDirection() && !isHorizontalWritingMode(); |
| 4148 } |
| 4149 |
| 4150 bool LayoutBox::hasLeftOverflow() const |
| 4151 { |
| 4152 return !style()->isLeftToRightDirection() && isHorizontalWritingMode(); |
| 4153 } |
| 4154 |
4130 void LayoutBox::addLayoutOverflow(const LayoutRect& rect) | 4155 void LayoutBox::addLayoutOverflow(const LayoutRect& rect) |
4131 { | 4156 { |
4132 if (rect.isEmpty()) | 4157 if (rect.isEmpty()) |
4133 return; | 4158 return; |
4134 | 4159 |
4135 LayoutRect clientBox = noOverflowRect(); | 4160 LayoutRect clientBox = noOverflowRect(); |
4136 if (clientBox.contains(rect)) | 4161 if (clientBox.contains(rect)) |
4137 return; | 4162 return; |
4138 | 4163 |
4139 // For overflow clip objects, we don't want to propagate overflow into unrea
chable areas. | 4164 // For overflow clip objects, we don't want to propagate overflow into unrea
chable areas. |
4140 LayoutRect overflowRect(rect); | 4165 LayoutRect overflowRect(rect); |
4141 if (hasOverflowClip() || isLayoutView()) { | 4166 if (hasOverflowClip() || isLayoutView()) { |
4142 // Overflow is in the block's coordinate space and thus is flipped for v
ertical-rl writing | 4167 // Overflow is in the block's coordinate space and thus is flipped for v
ertical-rl writing |
4143 // mode. At this stage that is actually a simplification, since we can
treat vertical-lr/rl | 4168 // mode. At this stage that is actually a simplification, since we can
treat vertical-lr/rl |
4144 // as the same. | 4169 // as the same. |
4145 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta
lWritingMode(); | 4170 if (hasTopOverflow()) |
4146 bool hasLeftOverflow = !style()->isLeftToRightDirection() && isHorizonta
lWritingMode(); | 4171 overflowRect.shiftMaxYEdgeTo(std::min(overflowRect.maxY(), clientBox
.maxY())); |
4147 if (isFlexibleBox() && style()->isReverseFlexDirection()) { | 4172 else |
4148 LayoutFlexibleBox* flexibleBox = toLayoutFlexibleBox(this); | |
4149 if (flexibleBox->isHorizontalFlow()) | |
4150 hasLeftOverflow = true; | |
4151 else | |
4152 hasTopOverflow = true; | |
4153 } | |
4154 | |
4155 if (!hasTopOverflow) | |
4156 overflowRect.shiftYEdgeTo(std::max(overflowRect.y(), clientBox.y()))
; | 4173 overflowRect.shiftYEdgeTo(std::max(overflowRect.y(), clientBox.y()))
; |
| 4174 if (hasLeftOverflow()) |
| 4175 overflowRect.shiftMaxXEdgeTo(std::min(overflowRect.maxX(), clientBox
.maxX())); |
4157 else | 4176 else |
4158 overflowRect.shiftMaxYEdgeTo(std::min(overflowRect.maxY(), clientBox
.maxY())); | |
4159 if (!hasLeftOverflow) | |
4160 overflowRect.shiftXEdgeTo(std::max(overflowRect.x(), clientBox.x()))
; | 4177 overflowRect.shiftXEdgeTo(std::max(overflowRect.x(), clientBox.x()))
; |
4161 else | |
4162 overflowRect.shiftMaxXEdgeTo(std::min(overflowRect.maxX(), clientBox
.maxX())); | |
4163 | 4178 |
4164 // Now re-test with the adjusted rectangle and see if it has become unre
achable or fully | 4179 // Now re-test with the adjusted rectangle and see if it has become unre
achable or fully |
4165 // contained. | 4180 // contained. |
4166 if (clientBox.contains(overflowRect) || overflowRect.isEmpty()) | 4181 if (clientBox.contains(overflowRect) || overflowRect.isEmpty()) |
4167 return; | 4182 return; |
4168 } | 4183 } |
4169 | 4184 |
4170 if (!m_overflow) | 4185 if (!m_overflow) |
4171 m_overflow = adoptPtr(new BoxOverflowModel(clientBox, borderBoxRect())); | 4186 m_overflow = adoptPtr(new BoxOverflowModel(clientBox, borderBoxRect())); |
4172 | 4187 |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4849 if (!flowThread) { | 4864 if (!flowThread) { |
4850 // If there's no flow thread, we're not nested. All pages have the same
height. Give up. | 4865 // If there's no flow thread, we're not nested. All pages have the same
height. Give up. |
4851 return strutToNextPage; | 4866 return strutToNextPage; |
4852 } | 4867 } |
4853 // Start searching for a suitable offset at the top of the next page or colu
mn. | 4868 // Start searching for a suitable offset at the top of the next page or colu
mn. |
4854 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo
gicalTop; | 4869 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo
gicalTop; |
4855 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo
wThreadOffset, contentLogicalHeight) - flowThreadOffset; | 4870 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo
wThreadOffset, contentLogicalHeight) - flowThreadOffset; |
4856 } | 4871 } |
4857 | 4872 |
4858 } // namespace blink | 4873 } // namespace blink |
OLD | NEW |