Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: Source/core/rendering/RenderBox.h

Issue 637033003: [CSS Grid Layout] Fix positioned grid children position and size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 *
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 FloatQuad absoluteContentQuad() const; 179 FloatQuad absoluteContentQuad() const;
180 180
181 // This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect 181 // This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect
182 // does include the intrinsic padding in the content box as this is what som e callers expect (like getComputedStyle). 182 // does include the intrinsic padding in the content box as this is what som e callers expect (like getComputedStyle).
183 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft( ) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth () - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp utedCSSPaddingTop() - computedCSSPaddingBottom()); } 183 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft( ) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth () - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp utedCSSPaddingTop() - computedCSSPaddingBottom()); }
184 184
185 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit ionalOffset) const override; 185 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit ionalOffset) const override;
186 186
187 // Use this with caution! No type checking is done! 187 // Use this with caution! No type checking is done!
188 RenderBox* previousSiblingBox() const; 188 RenderBox* previousSiblingBox() const;
189 RenderBox* previousInFlowSiblingBox() const;
189 RenderBox* nextSiblingBox() const; 190 RenderBox* nextSiblingBox() const;
191 RenderBox* nextInFlowSiblingBox() const;
190 RenderBox* parentBox() const; 192 RenderBox* parentBox() const;
191 193
192 bool canResize() const; 194 bool canResize() const;
193 195
194 // Visual and layout overflow are in the coordinate space of the box. This means that they aren't purely physical directions. 196 // Visual and layout overflow are in the coordinate space of the box. This means that they aren't purely physical directions.
195 // 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 // 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 // respectively are flipped when compared to their physical counterparts. F or example minX is on the left in vertical-lr, 198 // respectively are flipped when compared to their physical counterparts. F or example minX is on the left in vertical-lr,
197 // but it is on the right in vertical-rl. 199 // but it is on the right in vertical-rl.
198 LayoutRect noOverflowRect() const; 200 LayoutRect noOverflowRect() const;
199 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layo utOverflowRect() : noOverflowRect(); } 201 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layo utOverflowRect() : noOverflowRect(); }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 349
348 LayoutUnit overrideContainingBlockContentLogicalWidth() const; 350 LayoutUnit overrideContainingBlockContentLogicalWidth() const;
349 LayoutUnit overrideContainingBlockContentLogicalHeight() const; 351 LayoutUnit overrideContainingBlockContentLogicalHeight() const;
350 bool hasOverrideContainingBlockLogicalWidth() const; 352 bool hasOverrideContainingBlockLogicalWidth() const;
351 bool hasOverrideContainingBlockLogicalHeight() const; 353 bool hasOverrideContainingBlockLogicalHeight() const;
352 void setOverrideContainingBlockContentLogicalWidth(LayoutUnit); 354 void setOverrideContainingBlockContentLogicalWidth(LayoutUnit);
353 void setOverrideContainingBlockContentLogicalHeight(LayoutUnit); 355 void setOverrideContainingBlockContentLogicalHeight(LayoutUnit);
354 void clearContainingBlockOverrideSize(); 356 void clearContainingBlockOverrideSize();
355 void clearOverrideContainingBlockContentLogicalHeight(); 357 void clearOverrideContainingBlockContentLogicalHeight();
356 358
359 LayoutUnit extraInlineOffset() const;
360 LayoutUnit extraBlockOffset() const;
361 void setExtraInlineOffset(LayoutUnit inlineOffest);
362 void setExtraBlockOffset(LayoutUnit blockOffest);
363 void clearExtraInlineAndBlockOffests();
364
357 virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoin t&, bool* offsetDependsOnPoint = 0) const override; 365 virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoin t&, bool* offsetDependsOnPoint = 0) const override;
358 366
359 LayoutUnit adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const; 367 LayoutUnit adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
360 LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const ; 368 LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const ;
361 LayoutUnit adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) const; 369 LayoutUnit adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
362 LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) cons t; 370 LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) cons t;
363 371
364 struct ComputedMarginValues { 372 struct ComputedMarginValues {
365 ComputedMarginValues() { } 373 ComputedMarginValues() { }
366 374
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 LayoutUnit availableLogicalHeightUsing(const Length&, AvailableLogicalHeight Type) const; 459 LayoutUnit availableLogicalHeightUsing(const Length&, AvailableLogicalHeight Type) const;
452 460
453 // There are a few cases where we need to refer specifically to the availabl e physical width and available physical height. 461 // There are a few cases where we need to refer specifically to the availabl e physical width and available physical height.
454 // Relative positioning is one of those cases, since left/top offsets are ph ysical. 462 // Relative positioning is one of those cases, since left/top offsets are ph ysical.
455 LayoutUnit availableWidth() const { return style()->isHorizontalWritingMode( ) ? availableLogicalWidth() : availableLogicalHeight(IncludeMarginBorderPadding) ; } 463 LayoutUnit availableWidth() const { return style()->isHorizontalWritingMode( ) ? availableLogicalWidth() : availableLogicalHeight(IncludeMarginBorderPadding) ; }
456 LayoutUnit availableHeight() const { return style()->isHorizontalWritingMode () ? availableLogicalHeight(IncludeMarginBorderPadding) : availableLogicalWidth( ); } 464 LayoutUnit availableHeight() const { return style()->isHorizontalWritingMode () ? availableLogicalHeight(IncludeMarginBorderPadding) : availableLogicalWidth( ); }
457 465
458 virtual int verticalScrollbarWidth() const; 466 virtual int verticalScrollbarWidth() const;
459 int horizontalScrollbarHeight() const; 467 int horizontalScrollbarHeight() const;
460 int intrinsicScrollbarLogicalWidth() const; 468 int intrinsicScrollbarLogicalWidth() const;
469 int scrollbarLogicalWidth() const { return style()->isHorizontalWritingMode( ) ? verticalScrollbarWidth() : horizontalScrollbarHeight(); }
461 int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode () ? horizontalScrollbarHeight() : verticalScrollbarWidth(); } 470 int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode () ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
462 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1); 471 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1);
463 bool canBeScrolledAndHasScrollableArea() const; 472 bool canBeScrolledAndHasScrollableArea() const;
464 virtual bool canBeProgramaticallyScrolled() const; 473 virtual bool canBeProgramaticallyScrolled() const;
465 virtual void autoscroll(const IntPoint&); 474 virtual void autoscroll(const IntPoint&);
466 bool canAutoscroll() const; 475 bool canAutoscroll() const;
467 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const; 476 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const;
468 static RenderBox* findAutoscrollable(RenderObject*); 477 static RenderBox* findAutoscrollable(RenderObject*);
469 virtual void stopAutoscroll() { } 478 virtual void stopAutoscroll() { }
470 virtual void panScroll(const IntPoint&); 479 virtual void panScroll(const IntPoint&);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 OwnPtr<RenderBoxRareData> m_rareData; 786 OwnPtr<RenderBoxRareData> m_rareData;
778 }; 787 };
779 788
780 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox()); 789 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBox, isBox());
781 790
782 inline RenderBox* RenderBox::previousSiblingBox() const 791 inline RenderBox* RenderBox::previousSiblingBox() const
783 { 792 {
784 return toRenderBox(previousSibling()); 793 return toRenderBox(previousSibling());
785 } 794 }
786 795
796 inline RenderBox* RenderBox::previousInFlowSiblingBox() const
797 {
798 RenderBox* previous = previousSiblingBox();
799 while (previous && previous->isOutOfFlowPositioned())
800 previous = previous->previousSiblingBox();
801 return previous;
802 }
803
787 inline RenderBox* RenderBox::nextSiblingBox() const 804 inline RenderBox* RenderBox::nextSiblingBox() const
788 { 805 {
789 return toRenderBox(nextSibling()); 806 return toRenderBox(nextSibling());
790 } 807 }
791 808
809 inline RenderBox* RenderBox::nextInFlowSiblingBox() const
810 {
811 RenderBox* next = nextSiblingBox();
812 while (next && next->isOutOfFlowPositioned())
813 next = next->nextSiblingBox();
814 return next;
815 }
816
792 inline RenderBox* RenderBox::parentBox() const 817 inline RenderBox* RenderBox::parentBox() const
793 { 818 {
794 return toRenderBox(parent()); 819 return toRenderBox(parent());
795 } 820 }
796 821
797 inline RenderBox* RenderBox::firstChildBox() const 822 inline RenderBox* RenderBox::firstChildBox() const
798 { 823 {
799 return toRenderBox(slowFirstChild()); 824 return toRenderBox(slowFirstChild());
800 } 825 }
801 826
(...skipping 13 matching lines...) Expand all
815 if (UNLIKELY(inlineBoxWrapper() != 0)) 840 if (UNLIKELY(inlineBoxWrapper() != 0))
816 deleteLineBoxWrapper(); 841 deleteLineBoxWrapper();
817 } 842 }
818 843
819 ensureRareData().m_inlineBoxWrapper = boxWrapper; 844 ensureRareData().m_inlineBoxWrapper = boxWrapper;
820 } 845 }
821 846
822 } // namespace blink 847 } // namespace blink
823 848
824 #endif // RenderBox_h 849 #endif // RenderBox_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/css-grid-layout/resources/grid.css ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698