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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef RenderBox_h | 23 #ifndef LayoutBox_h |
24 #define RenderBox_h | 24 #define LayoutBox_h |
25 | 25 |
26 #include "core/layout/LayoutBoxModelObject.h" | 26 #include "core/layout/LayoutBoxModelObject.h" |
27 #include "core/layout/shapes/ShapeOutsideInfo.h" | 27 #include "core/layout/shapes/ShapeOutsideInfo.h" |
28 #include "core/rendering/RenderOverflow.h" | 28 #include "core/rendering/RenderOverflow.h" |
29 #include "platform/scroll/ScrollTypes.h" | 29 #include "platform/scroll/ScrollTypes.h" |
30 #include "platform/scroll/ScrollableArea.h" | 30 #include "platform/scroll/ScrollableArea.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class LayoutMultiColumnSpannerPlaceholder; | 34 class LayoutMultiColumnSpannerPlaceholder; |
35 | 35 |
36 struct PaintInfo; | 36 struct PaintInfo; |
37 | 37 |
38 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; | 38 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; |
39 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde
rPadding }; | 39 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde
rPadding }; |
40 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS
crollbarSize }; | 40 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayS
crollbarSize }; |
41 enum MarginDirection { BlockDirection, InlineDirection }; | 41 enum MarginDirection { BlockDirection, InlineDirection }; |
42 | 42 |
43 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; | 43 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; |
44 | 44 |
45 enum ScrollOffsetClamping { | 45 enum ScrollOffsetClamping { |
46 ScrollOffsetUnclamped, | 46 ScrollOffsetUnclamped, |
47 ScrollOffsetClamped | 47 ScrollOffsetClamped |
48 }; | 48 }; |
49 | 49 |
50 struct RenderBoxRareData { | 50 struct LayoutBoxRareData { |
51 WTF_MAKE_NONCOPYABLE(RenderBoxRareData); WTF_MAKE_FAST_ALLOCATED; | 51 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); WTF_MAKE_FAST_ALLOCATED; |
52 public: | 52 public: |
53 RenderBoxRareData() | 53 LayoutBoxRareData() |
54 : m_inlineBoxWrapper(0) | 54 : m_inlineBoxWrapper(0) |
55 , m_spannerPlaceholder(0) | 55 , m_spannerPlaceholder(0) |
56 , m_overrideLogicalContentHeight(-1) | 56 , m_overrideLogicalContentHeight(-1) |
57 , m_overrideLogicalContentWidth(-1) | 57 , m_overrideLogicalContentWidth(-1) |
58 , m_previousBorderBoxSize(-1, -1) | 58 , m_previousBorderBoxSize(-1, -1) |
59 { | 59 { |
60 } | 60 } |
61 | 61 |
62 // For inline replaced elements, the inline box that owns us. | 62 // For inline replaced elements, the inline box that owns us. |
63 InlineBox* m_inlineBoxWrapper; | 63 InlineBox* m_inlineBoxWrapper; |
64 | 64 |
65 // For spanners, the spanner placeholder that lays us out within the multico
l container. | 65 // For spanners, the spanner placeholder that lays us out within the multico
l container. |
66 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; | 66 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; |
67 | 67 |
68 LayoutUnit m_overrideLogicalContentHeight; | 68 LayoutUnit m_overrideLogicalContentHeight; |
69 LayoutUnit m_overrideLogicalContentWidth; | 69 LayoutUnit m_overrideLogicalContentWidth; |
70 | 70 |
71 // Set by RenderBox::updatePreviousBorderBoxSizeIfNeeded(). | 71 // Set by LayoutBox::updatePreviousBorderBoxSizeIfNeeded(). |
72 LayoutSize m_previousBorderBoxSize; | 72 LayoutSize m_previousBorderBoxSize; |
73 }; | 73 }; |
74 | 74 |
75 class RenderBox : public LayoutBoxModelObject { | 75 class LayoutBox : public LayoutBoxModelObject { |
76 public: | 76 public: |
77 explicit RenderBox(ContainerNode*); | 77 explicit LayoutBox(ContainerNode*); |
78 | 78 |
79 virtual LayerType layerTypeRequired() const override; | 79 virtual LayerType layerTypeRequired() const override; |
80 | 80 |
81 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const override; | 81 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const override; |
82 | 82 |
83 virtual bool backgroundShouldAlwaysBeClipped() const { return false; } | 83 virtual bool backgroundShouldAlwaysBeClipped() const { return false; } |
84 | 84 |
85 // Use this with caution! No type checking is done! | 85 // Use this with caution! No type checking is done! |
86 RenderBox* firstChildBox() const; | 86 LayoutBox* firstChildBox() const; |
87 RenderBox* lastChildBox() const; | 87 LayoutBox* lastChildBox() const; |
88 | 88 |
89 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); } | 89 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); } |
90 int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); } | 90 int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); } |
91 | 91 |
92 void setX(LayoutUnit x) { m_frameRect.setX(x); } | 92 void setX(LayoutUnit x) { m_frameRect.setX(x); } |
93 void setY(LayoutUnit y) { m_frameRect.setY(y); } | 93 void setY(LayoutUnit y) { m_frameRect.setY(y); } |
94 void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); } | 94 void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); } |
95 void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); } | 95 void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); } |
96 | 96 |
97 LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ?
m_frameRect.x() : m_frameRect.y(); } | 97 LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ?
m_frameRect.x() : m_frameRect.y(); } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // The content box converted to absolute coords (taking transforms into acco
unt). | 172 // The content box converted to absolute coords (taking transforms into acco
unt). |
173 FloatQuad absoluteContentQuad() const; | 173 FloatQuad absoluteContentQuad() const; |
174 | 174 |
175 // This returns the content area of the box (excluding padding and border).
The only difference with contentBoxRect is that computedCSSContentBoxRect | 175 // This returns the content area of the box (excluding padding and border).
The only difference with contentBoxRect is that computedCSSContentBoxRect |
176 // does include the intrinsic padding in the content box as this is what som
e callers expect (like getComputedStyle). | 176 // does include the intrinsic padding in the content box as this is what som
e callers expect (like getComputedStyle). |
177 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft(
) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth
() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp
utedCSSPaddingTop() - computedCSSPaddingBottom()); } | 177 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft(
) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth
() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp
utedCSSPaddingTop() - computedCSSPaddingBottom()); } |
178 | 178 |
179 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override; | 179 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override; |
180 | 180 |
181 // Use this with caution! No type checking is done! | 181 // Use this with caution! No type checking is done! |
182 RenderBox* previousSiblingBox() const; | 182 LayoutBox* previousSiblingBox() const; |
183 RenderBox* previousInFlowSiblingBox() const; | 183 LayoutBox* previousInFlowSiblingBox() const; |
184 RenderBox* nextSiblingBox() const; | 184 LayoutBox* nextSiblingBox() const; |
185 RenderBox* nextInFlowSiblingBox() const; | 185 LayoutBox* nextInFlowSiblingBox() const; |
186 RenderBox* parentBox() const; | 186 LayoutBox* parentBox() const; |
187 | 187 |
188 // Return the previous sibling column set or spanner placeholder. Only to be
used on multicol container children. | 188 // Return the previous sibling column set or spanner placeholder. Only to be
used on multicol container children. |
189 RenderBox* previousSiblingMultiColumnBox() const; | 189 LayoutBox* previousSiblingMultiColumnBox() const; |
190 // Return the next sibling column set or spanner placeholder. Only to be use
d on multicol container children. | 190 // Return the next sibling column set or spanner placeholder. Only to be use
d on multicol container children. |
191 RenderBox* nextSiblingMultiColumnBox() const; | 191 LayoutBox* nextSiblingMultiColumnBox() const; |
192 | 192 |
193 bool canResize() const; | 193 bool canResize() const; |
194 | 194 |
195 // Visual and layout overflow are in the coordinate space of the box. This
means that they aren't purely physical directions. | 195 // Visual and layout overflow are in the coordinate space of the box. This
means that they aren't purely physical directions. |
196 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right | 196 // For horizontal-tb and vertical-lr they will match physical directions, bu
t for horizontal-bt and vertical-rl, the top/bottom and left/right |
197 // respectively are flipped when compared to their physical counterparts. F
or example minX is on the left in vertical-lr, | 197 // respectively are flipped when compared to their physical counterparts. F
or example minX is on the left in vertical-lr, |
198 // but it is on the right in vertical-rl. | 198 // but it is on the right in vertical-rl. |
199 LayoutRect noOverflowRect() const; | 199 LayoutRect noOverflowRect() const; |
200 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layo
utOverflowRect() : noOverflowRect(); } | 200 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layo
utOverflowRect() : noOverflowRect(); } |
201 IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(
layoutOverflowRect()); } | 201 IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(
layoutOverflowRect()); } |
202 LayoutSize maxLayoutOverflow() const { return LayoutSize(layoutOverflowRect(
).maxX(), layoutOverflowRect().maxY()); } | 202 LayoutSize maxLayoutOverflow() const { return LayoutSize(layoutOverflowRect(
).maxX(), layoutOverflowRect().maxY()); } |
203 LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalW
ritingMode() ? layoutOverflowRect().x() : layoutOverflowRect().y(); } | 203 LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalW
ritingMode() ? layoutOverflowRect().x() : layoutOverflowRect().y(); } |
204 LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontal
WritingMode() ? layoutOverflowRect().maxX() : layoutOverflowRect().maxY(); } | 204 LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontal
WritingMode() ? layoutOverflowRect().maxX() : layoutOverflowRect().maxY(); } |
205 | 205 |
206 virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overfl
ow->visualOverflowRect() : borderBoxRect(); } | 206 virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overfl
ow->visualOverflowRect() : borderBoxRect(); } |
207 LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalW
ritingMode() ? visualOverflowRect().x() : visualOverflowRect().y(); } | 207 LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalW
ritingMode() ? visualOverflowRect().x() : visualOverflowRect().y(); } |
208 LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontal
WritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); } | 208 LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontal
WritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); } |
209 | 209 |
210 LayoutRect contentsVisualOverflowRect() const { return m_overflow ? m_overfl
ow->contentsVisualOverflowRect() : LayoutRect(); } | 210 LayoutRect contentsVisualOverflowRect() const { return m_overflow ? m_overfl
ow->contentsVisualOverflowRect() : LayoutRect(); } |
211 | 211 |
212 void addLayoutOverflow(const LayoutRect&); | 212 void addLayoutOverflow(const LayoutRect&); |
213 void addVisualOverflow(const LayoutRect&); | 213 void addVisualOverflow(const LayoutRect&); |
214 | 214 |
215 // Clipped by the contents clip, if one exists. | 215 // Clipped by the contents clip, if one exists. |
216 void addContentsVisualOverflow(const LayoutRect&); | 216 void addContentsVisualOverflow(const LayoutRect&); |
217 | 217 |
218 void addVisualEffectOverflow(); | 218 void addVisualEffectOverflow(); |
219 LayoutRectOutsets computeVisualEffectOverflowOutsets() const; | 219 LayoutRectOutsets computeVisualEffectOverflowOutsets() const; |
220 void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, ch
ild->locationOffset()); } | 220 void addOverflowFromChild(LayoutBox* child) { addOverflowFromChild(child, ch
ild->locationOffset()); } |
221 void addOverflowFromChild(RenderBox* child, const LayoutSize& delta); | 221 void addOverflowFromChild(LayoutBox* child, const LayoutSize& delta); |
222 void clearLayoutOverflow(); | 222 void clearLayoutOverflow(); |
223 void clearAllOverflows() { m_overflow.clear(); } | 223 void clearAllOverflows() { m_overflow.clear(); } |
224 | 224 |
225 void updateLayerTransformAfterLayout(); | 225 void updateLayerTransformAfterLayout(); |
226 | 226 |
227 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - pad
dingRight(); } | 227 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - pad
dingRight(); } |
228 LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - pa
ddingBottom(); } | 228 LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - pa
ddingBottom(); } |
229 LayoutSize contentSize() const { return LayoutSize(contentWidth(), contentHe
ight()); } | 229 LayoutSize contentSize() const { return LayoutSize(contentWidth(), contentHe
ight()); } |
230 LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWriting
Mode() ? contentWidth() : contentHeight(); } | 230 LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWriting
Mode() ? contentWidth() : contentHeight(); } |
231 LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritin
gMode() ? contentHeight() : contentWidth(); } | 231 LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritin
gMode() ? contentHeight() : contentWidth(); } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 LayoutRect reflectedRect(const LayoutRect&) const; | 327 LayoutRect reflectedRect(const LayoutRect&) const; |
328 | 328 |
329 virtual void layout() override; | 329 virtual void layout() override; |
330 virtual void paint(const PaintInfo&, const LayoutPoint&) override; | 330 virtual void paint(const PaintInfo&, const LayoutPoint&) override; |
331 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override; | 331 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override; |
332 | 332 |
333 virtual LayoutUnit minPreferredLogicalWidth() const override; | 333 virtual LayoutUnit minPreferredLogicalWidth() const override; |
334 virtual LayoutUnit maxPreferredLogicalWidth() const override; | 334 virtual LayoutUnit maxPreferredLogicalWidth() const override; |
335 | 335 |
336 // FIXME: We should rename these back to overrideLogicalHeight/Width and hav
e them store | 336 // FIXME: We should rename these back to overrideLogicalHeight/Width and hav
e them store |
337 // the border-box height/width like the regular height/width accessors on Re
nderBox. | 337 // the border-box height/width like the regular height/width accessors on La
youtBox. |
338 // Right now, these are different than contentHeight/contentWidth because th
ey still | 338 // Right now, these are different than contentHeight/contentWidth because th
ey still |
339 // include the scrollbar height/width. | 339 // include the scrollbar height/width. |
340 LayoutUnit overrideLogicalContentWidth() const; | 340 LayoutUnit overrideLogicalContentWidth() const; |
341 LayoutUnit overrideLogicalContentHeight() const; | 341 LayoutUnit overrideLogicalContentHeight() const; |
342 bool hasOverrideHeight() const; | 342 bool hasOverrideHeight() const; |
343 bool hasOverrideWidth() const; | 343 bool hasOverrideWidth() const; |
344 void setOverrideLogicalContentHeight(LayoutUnit); | 344 void setOverrideLogicalContentHeight(LayoutUnit); |
345 void setOverrideLogicalContentWidth(LayoutUnit); | 345 void setOverrideLogicalContentWidth(LayoutUnit); |
346 void clearOverrideSize(); | 346 void clearOverrideSize(); |
347 void clearOverrideLogicalContentHeight(); | 347 void clearOverrideLogicalContentHeight(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 int horizontalScrollbarHeight() const; | 475 int horizontalScrollbarHeight() const; |
476 int intrinsicScrollbarLogicalWidth() const; | 476 int intrinsicScrollbarLogicalWidth() const; |
477 int scrollbarLogicalWidth() const { return style()->isHorizontalWritingMode(
) ? verticalScrollbarWidth() : horizontalScrollbarHeight(); } | 477 int scrollbarLogicalWidth() const { return style()->isHorizontalWritingMode(
) ? verticalScrollbarWidth() : horizontalScrollbarHeight(); } |
478 int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode
() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); } | 478 int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode
() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); } |
479 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1); | 479 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1); |
480 bool canBeScrolledAndHasScrollableArea() const; | 480 bool canBeScrolledAndHasScrollableArea() const; |
481 virtual bool canBeProgramaticallyScrolled() const; | 481 virtual bool canBeProgramaticallyScrolled() const; |
482 virtual void autoscroll(const IntPoint&); | 482 virtual void autoscroll(const IntPoint&); |
483 bool canAutoscroll() const; | 483 bool canAutoscroll() const; |
484 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const; | 484 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const; |
485 static RenderBox* findAutoscrollable(LayoutObject*); | 485 static LayoutBox* findAutoscrollable(LayoutObject*); |
486 virtual void stopAutoscroll() { } | 486 virtual void stopAutoscroll() { } |
487 virtual void panScroll(const IntPoint&); | 487 virtual void panScroll(const IntPoint&); |
488 | 488 |
489 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()
->overflowY() == OAUTO || style()->overflowY() == OPAGEDY || style()->overflowY(
) == OOVERLAY); } | 489 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()
->overflowY() == OAUTO || style()->overflowY() == OPAGEDY || style()->overflowY(
) == OOVERLAY); } |
490 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style
()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } | 490 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style
()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } |
491 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY
(); } | 491 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY
(); } |
492 | 492 |
493 bool hasScrollableOverflowX() const { return scrollsOverflowX() && pixelSnap
pedScrollWidth() != pixelSnappedClientWidth(); } | 493 bool hasScrollableOverflowX() const { return scrollsOverflowX() && pixelSnap
pedScrollWidth() != pixelSnappedClientWidth(); } |
494 bool hasScrollableOverflowY() const { return scrollsOverflowY() && pixelSnap
pedScrollHeight() != pixelSnappedClientHeight(); } | 494 bool hasScrollableOverflowY() const { return scrollsOverflowY() && pixelSnap
pedScrollHeight() != pixelSnappedClientHeight(); } |
495 virtual bool scrollsOverflowX() const { return hasOverflowClip() && (style()
->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); } | 495 virtual bool scrollsOverflowX() const { return hasOverflowClip() && (style()
->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloati
ngOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDepreca
ted(); } | 538 bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloati
ngOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDepreca
ted(); } |
539 | 539 |
540 bool isGridItem() const { return parent() && parent()->isRenderGrid(); } | 540 bool isGridItem() const { return parent() && parent()->isRenderGrid(); } |
541 | 541 |
542 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const override; | 542 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const override; |
543 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const override; | 543 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const override; |
544 | 544 |
545 virtual LayoutUnit offsetLeft() const override; | 545 virtual LayoutUnit offsetLeft() const override; |
546 virtual LayoutUnit offsetTop() const override; | 546 virtual LayoutUnit offsetTop() const override; |
547 | 547 |
548 LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutP
oint&) const; | 548 LayoutPoint flipForWritingModeForChild(const LayoutBox* child, const LayoutP
oint&) const; |
549 LayoutUnit flipForWritingMode(LayoutUnit position) const WARN_UNUSED_RETURN | 549 LayoutUnit flipForWritingMode(LayoutUnit position) const WARN_UNUSED_RETURN |
550 { | 550 { |
551 // The offset is in the block direction (y for horizontal writing modes,
x for vertical writing modes). | 551 // The offset is in the block direction (y for horizontal writing modes,
x for vertical writing modes). |
552 if (!UNLIKELY(hasFlippedBlocksWritingMode())) | 552 if (!UNLIKELY(hasFlippedBlocksWritingMode())) |
553 return position; | 553 return position; |
554 return logicalHeight() - position; | 554 return logicalHeight() - position; |
555 } | 555 } |
556 LayoutPoint flipForWritingMode(const LayoutPoint& position) const WARN_UNUSE
D_RETURN | 556 LayoutPoint flipForWritingMode(const LayoutPoint& position) const WARN_UNUSE
D_RETURN |
557 { | 557 { |
558 if (!UNLIKELY(hasFlippedBlocksWritingMode())) | 558 if (!UNLIKELY(hasFlippedBlocksWritingMode())) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 bool hasVerticalLayoutOverflow() const | 624 bool hasVerticalLayoutOverflow() const |
625 { | 625 { |
626 if (!m_overflow) | 626 if (!m_overflow) |
627 return false; | 627 return false; |
628 | 628 |
629 LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect(); | 629 LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect(); |
630 LayoutRect noOverflowRect = this->noOverflowRect(); | 630 LayoutRect noOverflowRect = this->noOverflowRect(); |
631 return layoutOverflowRect.y() < noOverflowRect.y() || layoutOverflowRect
.maxY() > noOverflowRect.maxY(); | 631 return layoutOverflowRect.y() < noOverflowRect.y() || layoutOverflowRect
.maxY() > noOverflowRect.maxY(); |
632 } | 632 } |
633 | 633 |
634 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const LayoutObject*) con
st | 634 virtual LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject*) con
st |
635 { | 635 { |
636 ASSERT_NOT_REACHED(); | 636 ASSERT_NOT_REACHED(); |
637 return 0; | 637 return 0; |
638 } | 638 } |
639 | 639 |
640 bool hasSameDirectionAs(const RenderBox* object) const { return style()->dir
ection() == object->style()->direction(); } | 640 bool hasSameDirectionAs(const LayoutBox* object) const { return style()->dir
ection() == object->style()->direction(); } |
641 | 641 |
642 ShapeOutsideInfo* shapeOutsideInfo() const | 642 ShapeOutsideInfo* shapeOutsideInfo() const |
643 { | 643 { |
644 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*t
his) : 0; | 644 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*t
his) : 0; |
645 } | 645 } |
646 | 646 |
647 void markShapeOutsideDependentsForLayout() | 647 void markShapeOutsideDependentsForLayout() |
648 { | 648 { |
649 if (isFloating()) | 649 if (isFloating()) |
650 removeFloatingOrPositionedChildFromBlockLists(); | 650 removeFloatingOrPositionedChildFromBlockLists(); |
651 } | 651 } |
652 | 652 |
653 bool backgroundHasOpaqueTopLayer() const; | 653 bool backgroundHasOpaqueTopLayer() const; |
654 | 654 |
655 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } | 655 void setIntrinsicContentLogicalHeight(LayoutUnit intrinsicContentLogicalHeig
ht) const { m_intrinsicContentLogicalHeight = intrinsicContentLogicalHeight; } |
656 protected: | 656 protected: |
657 virtual void willBeDestroyed() override; | 657 virtual void willBeDestroyed() override; |
658 | 658 |
659 virtual void styleWillChange(StyleDifference, const LayoutStyle& newStyle) o
verride; | 659 virtual void styleWillChange(StyleDifference, const LayoutStyle& newStyle) o
verride; |
660 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; | 660 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; |
661 virtual void updateFromStyle() override; | 661 virtual void updateFromStyle() override; |
662 | 662 |
663 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. | 663 // Returns false if it could not cheaply compute the extent (e.g. fixed back
ground), in which case the returned rect may be incorrect. |
664 // FIXME: make this a const method once the RenderBox reference in BoxPainte
r is const. | 664 // FIXME: make this a const method once the LayoutBox reference in BoxPainte
r is const. |
665 bool getBackgroundPaintedExtent(LayoutRect&); | 665 bool getBackgroundPaintedExtent(LayoutRect&); |
666 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; | 666 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const; |
667 virtual bool computeBackgroundIsKnownToBeObscured() override; | 667 virtual bool computeBackgroundIsKnownToBeObscured() override; |
668 | 668 |
669 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; | 669 void computePositionedLogicalWidth(LogicalExtentComputedValues&) const; |
670 | 670 |
671 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt
h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; | 671 LayoutUnit computeIntrinsicLogicalWidthUsing(const Length& logicalWidthLengt
h, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; |
672 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe
ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons
t; | 672 LayoutUnit computeIntrinsicLogicalContentHeightUsing(const Length& logicalHe
ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons
t; |
673 | 673 |
674 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i
sInlineBlockOrInlineTable(); } | 674 virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !i
sInlineBlockOrInlineTable(); } |
(...skipping 26 matching lines...) Expand all Loading... |
701 | 701 |
702 void updateShapeOutsideInfoAfterStyleChange(const LayoutStyle&, const Layout
Style* oldStyle); | 702 void updateShapeOutsideInfoAfterStyleChange(const LayoutStyle&, const Layout
Style* oldStyle); |
703 void updateGridPositionAfterStyleChange(const LayoutStyle*); | 703 void updateGridPositionAfterStyleChange(const LayoutStyle*); |
704 | 704 |
705 bool autoWidthShouldFitContent() const; | 705 bool autoWidthShouldFitContent() const; |
706 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; | 706 LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutU
nit bordersPlusPadding) const; |
707 | 707 |
708 // Returns true if we queued up a paint invalidation. | 708 // Returns true if we queued up a paint invalidation. |
709 bool paintInvalidationLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); | 709 bool paintInvalidationLayerRectsForImage(WrappedImagePtr, const FillLayer&,
bool drawingBackground); |
710 | 710 |
711 bool skipContainingBlockForPercentHeightCalculation(const RenderBox* contain
ingBlock) const; | 711 bool skipContainingBlockForPercentHeightCalculation(const LayoutBox* contain
ingBlock) const; |
712 | 712 |
713 LayoutUnit containingBlockLogicalWidthForPositioned(const LayoutBoxModelObje
ct* containingBlock, bool checkForPerpendicularWritingMode = true) const; | 713 LayoutUnit containingBlockLogicalWidthForPositioned(const LayoutBoxModelObje
ct* containingBlock, bool checkForPerpendicularWritingMode = true) const; |
714 LayoutUnit containingBlockLogicalHeightForPositioned(const LayoutBoxModelObj
ect* containingBlock, bool checkForPerpendicularWritingMode = true) const; | 714 LayoutUnit containingBlockLogicalHeightForPositioned(const LayoutBoxModelObj
ect* containingBlock, bool checkForPerpendicularWritingMode = true) const; |
715 | 715 |
716 void computePositionedLogicalHeight(LogicalExtentComputedValues&) const; | 716 void computePositionedLogicalHeight(LogicalExtentComputedValues&) const; |
717 void computePositionedLogicalWidthUsing(Length logicalWidth, const LayoutBox
ModelObject* containerBlock, TextDirection containerDirection, | 717 void computePositionedLogicalWidthUsing(Length logicalWidth, const LayoutBox
ModelObject* containerBlock, TextDirection containerDirection, |
718 LayoutUnit containerLogicalWidth, La
youtUnit bordersPlusPadding, | 718 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, |
719 const Length& logicalLeft, const Len
gth& logicalRight, const Length& marginLogicalLeft, | 719 const Length& logicalLeft, const Length& logicalRight, const Length& mar
ginLogicalLeft, |
720 const Length& marginLogicalRight, Lo
gicalExtentComputedValues&) const; | 720 const Length& marginLogicalRight, LogicalExtentComputedValues&) const; |
721 void computePositionedLogicalHeightUsing(Length logicalHeightLength, const L
ayoutBoxModelObject* containerBlock, | 721 void computePositionedLogicalHeightUsing(Length logicalHeightLength, const L
ayoutBoxModelObject* containerBlock, |
722 LayoutUnit containerLogicalHeight,
LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, | 722 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, Layout
Unit logicalHeight, |
723 const Length& logicalTop, const Len
gth& logicalBottom, const Length& marginLogicalTop, | 723 const Length& logicalTop, const Length& logicalBottom, const Length& mar
ginLogicalTop, |
724 const Length& marginLogicalBottom,
LogicalExtentComputedValues&) const; | 724 const Length& marginLogicalBottom, LogicalExtentComputedValues&) const; |
725 | 725 |
726 void computePositionedLogicalHeightReplaced(LogicalExtentComputedValues&) co
nst; | 726 void computePositionedLogicalHeightReplaced(LogicalExtentComputedValues&) co
nst; |
727 void computePositionedLogicalWidthReplaced(LogicalExtentComputedValues&) con
st; | 727 void computePositionedLogicalWidthReplaced(LogicalExtentComputedValues&) con
st; |
728 | 728 |
729 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const; | 729 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const; |
730 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit
& marginStart, LayoutUnit& marginEnd) const; | 730 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit
& marginStart, LayoutUnit& marginEnd) const; |
731 | 731 |
732 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const; | 732 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const; |
733 | 733 |
734 // This function calculates the minimum and maximum preferred widths for an
object. | 734 // This function calculates the minimum and maximum preferred widths for an
object. |
735 // These values are used in shrink-to-fit layout systems. | 735 // These values are used in shrink-to-fit layout systems. |
736 // These include tables, positioned objects, floats and flexible boxes. | 736 // These include tables, positioned objects, floats and flexible boxes. |
737 virtual void computePreferredLogicalWidths() { clearPreferredLogicalWidthsDi
rty(); } | 737 virtual void computePreferredLogicalWidths() { clearPreferredLogicalWidthsDi
rty(); } |
738 | 738 |
739 RenderBoxRareData& ensureRareData() | 739 LayoutBoxRareData& ensureRareData() |
740 { | 740 { |
741 if (!m_rareData) | 741 if (!m_rareData) |
742 m_rareData = adoptPtr(new RenderBoxRareData()); | 742 m_rareData = adoptPtr(new LayoutBoxRareData()); |
743 return *m_rareData.get(); | 743 return *m_rareData.get(); |
744 } | 744 } |
745 | 745 |
746 void savePreviousBorderBoxSizeIfNeeded(); | 746 void savePreviousBorderBoxSizeIfNeeded(); |
747 LayoutSize computePreviousBorderBoxSize(const LayoutSize& previousBoundsSize
) const; | 747 LayoutSize computePreviousBorderBoxSize(const LayoutSize& previousBoundsSize
) const; |
748 | 748 |
749 bool logicalHeightComputesAsNone(SizeType) const; | 749 bool logicalHeightComputesAsNone(SizeType) const; |
750 | 750 |
751 bool isBox() const = delete; // This will catch anyone doing an unnecessary
check. | 751 bool isBox() const = delete; // This will catch anyone doing an unnecessary
check. |
752 | 752 |
(...skipping 13 matching lines...) Expand all Loading... |
766 // The preferred logical width of the element if it were to break its lines
at every possible opportunity. | 766 // The preferred logical width of the element if it were to break its lines
at every possible opportunity. |
767 LayoutUnit m_minPreferredLogicalWidth; | 767 LayoutUnit m_minPreferredLogicalWidth; |
768 | 768 |
769 // The preferred logical width of the element if it never breaks any lines a
t all. | 769 // The preferred logical width of the element if it never breaks any lines a
t all. |
770 LayoutUnit m_maxPreferredLogicalWidth; | 770 LayoutUnit m_maxPreferredLogicalWidth; |
771 | 771 |
772 // Our overflow information. | 772 // Our overflow information. |
773 OwnPtr<RenderOverflow> m_overflow; | 773 OwnPtr<RenderOverflow> m_overflow; |
774 | 774 |
775 private: | 775 private: |
776 OwnPtr<RenderBoxRareData> m_rareData; | 776 OwnPtr<LayoutBoxRareData> m_rareData; |
777 }; | 777 }; |
778 | 778 |
779 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderBox, isBox()); | 779 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBox, isBox()); |
780 | 780 |
781 inline RenderBox* RenderBox::previousSiblingBox() const | 781 inline LayoutBox* LayoutBox::previousSiblingBox() const |
782 { | 782 { |
783 return toRenderBox(previousSibling()); | 783 return toLayoutBox(previousSibling()); |
784 } | 784 } |
785 | 785 |
786 inline RenderBox* RenderBox::previousInFlowSiblingBox() const | 786 inline LayoutBox* LayoutBox::previousInFlowSiblingBox() const |
787 { | 787 { |
788 RenderBox* previous = previousSiblingBox(); | 788 LayoutBox* previous = previousSiblingBox(); |
789 while (previous && previous->isOutOfFlowPositioned()) | 789 while (previous && previous->isOutOfFlowPositioned()) |
790 previous = previous->previousSiblingBox(); | 790 previous = previous->previousSiblingBox(); |
791 return previous; | 791 return previous; |
792 } | 792 } |
793 | 793 |
794 inline RenderBox* RenderBox::nextSiblingBox() const | 794 inline LayoutBox* LayoutBox::nextSiblingBox() const |
795 { | 795 { |
796 return toRenderBox(nextSibling()); | 796 return toLayoutBox(nextSibling()); |
797 } | 797 } |
798 | 798 |
799 inline RenderBox* RenderBox::nextInFlowSiblingBox() const | 799 inline LayoutBox* LayoutBox::nextInFlowSiblingBox() const |
800 { | 800 { |
801 RenderBox* next = nextSiblingBox(); | 801 LayoutBox* next = nextSiblingBox(); |
802 while (next && next->isOutOfFlowPositioned()) | 802 while (next && next->isOutOfFlowPositioned()) |
803 next = next->nextSiblingBox(); | 803 next = next->nextSiblingBox(); |
804 return next; | 804 return next; |
805 } | 805 } |
806 | 806 |
807 inline RenderBox* RenderBox::parentBox() const | 807 inline LayoutBox* LayoutBox::parentBox() const |
808 { | 808 { |
809 return toRenderBox(parent()); | 809 return toLayoutBox(parent()); |
810 } | 810 } |
811 | 811 |
812 inline RenderBox* RenderBox::firstChildBox() const | 812 inline LayoutBox* LayoutBox::firstChildBox() const |
813 { | 813 { |
814 return toRenderBox(slowFirstChild()); | 814 return toLayoutBox(slowFirstChild()); |
815 } | 815 } |
816 | 816 |
817 inline RenderBox* RenderBox::lastChildBox() const | 817 inline LayoutBox* LayoutBox::lastChildBox() const |
818 { | 818 { |
819 return toRenderBox(slowLastChild()); | 819 return toLayoutBox(slowLastChild()); |
820 } | 820 } |
821 | 821 |
822 inline RenderBox* RenderBox::previousSiblingMultiColumnBox() const | 822 inline LayoutBox* LayoutBox::previousSiblingMultiColumnBox() const |
823 { | 823 { |
824 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); | 824 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); |
825 RenderBox* previousBox = previousSiblingBox(); | 825 LayoutBox* previousBox = previousSiblingBox(); |
826 if (previousBox->isLayoutFlowThread()) | 826 if (previousBox->isLayoutFlowThread()) |
827 return 0; | 827 return 0; |
828 return previousBox; | 828 return previousBox; |
829 } | 829 } |
830 | 830 |
831 inline RenderBox* RenderBox::nextSiblingMultiColumnBox() const | 831 inline LayoutBox* LayoutBox::nextSiblingMultiColumnBox() const |
832 { | 832 { |
833 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); | 833 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); |
834 return nextSiblingBox(); | 834 return nextSiblingBox(); |
835 } | 835 } |
836 | 836 |
837 inline void RenderBox::setInlineBoxWrapper(InlineBox* boxWrapper) | 837 inline void LayoutBox::setInlineBoxWrapper(InlineBox* boxWrapper) |
838 { | 838 { |
839 if (boxWrapper) { | 839 if (boxWrapper) { |
840 ASSERT(!inlineBoxWrapper()); | 840 ASSERT(!inlineBoxWrapper()); |
841 // m_inlineBoxWrapper should already be 0. Deleting it is a safeguard ag
ainst security issues. | 841 // m_inlineBoxWrapper should already be 0. Deleting it is a safeguard ag
ainst security issues. |
842 // Otherwise, there will two line box wrappers keeping the reference to
this renderer, and | 842 // Otherwise, there will two line box wrappers keeping the reference to
this renderer, and |
843 // only one will be notified when the renderer is getting destroyed. The
second line box wrapper | 843 // only one will be notified when the renderer is getting destroyed. The
second line box wrapper |
844 // will keep a stale reference. | 844 // will keep a stale reference. |
845 if (UNLIKELY(inlineBoxWrapper() != 0)) | 845 if (UNLIKELY(inlineBoxWrapper() != 0)) |
846 deleteLineBoxWrapper(); | 846 deleteLineBoxWrapper(); |
847 } | 847 } |
848 | 848 |
849 ensureRareData().m_inlineBoxWrapper = boxWrapper; | 849 ensureRareData().m_inlineBoxWrapper = boxWrapper; |
850 } | 850 } |
851 | 851 |
852 } // namespace blink | 852 } // namespace blink |
853 | 853 |
854 #endif // RenderBox_h | 854 #endif // LayoutBox_h |
OLD | NEW |