Changeset 136465 in webkit
- Timestamp:
- Dec 3, 2012 6:24:23 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r136463 r136465 1 2012-12-03 Julien Chaffraix <jchaffraix@webkit.org> 2 3 [CSS Grid Layout] Support percentage paddings and margins on grid items 4 https://bugs.webkit.org/show_bug.cgi?id=103677 5 6 Reviewed by Tony Chang. 7 8 * resources/check-layout.js: 9 Extended check-layout to be able to query paddings and margins. Note that in order to compare, 10 the attribute with the returned value from getComputedStyle, we need to trim the unit ("px") 11 from the actual values. This trick also works in FireFox and Opera. 12 13 * fast/css-grid-layout/percent-padding-margin-resolution-grid-item-expected.txt: Added. 14 * fast/css-grid-layout/percent-padding-margin-resolution-grid-item.html: Added. 15 1 16 2012-12-03 Roger Fong <roger_fong@apple.com> 2 17 -
trunk/LayoutTests/resources/check-layout.js
r130979 r136465 78 78 failures.push("Expected " + expectedDisplay + " for display, but got " + actualDisplay + ". "); 79 79 } 80 81 var expectedPaddingTop = node.getAttribute && node.getAttribute("data-expected-padding-top"); 82 if (expectedPaddingTop) { 83 var actualPaddingTop = getComputedStyle(node).paddingTop; 84 // Trim the unit "px" from the output. 85 actualPaddingTop = actualPaddingTop.substring(0, actualPaddingTop.length - 2); 86 if (actualPaddingTop != expectedPaddingTop) 87 failures.push("Expected " + expectedPaddingTop + " for padding-top, but got " + actualPaddingTop + ". "); 88 } 89 90 var expectedPaddingBottom = node.getAttribute && node.getAttribute("data-expected-padding-bottom"); 91 if (expectedPaddingBottom) { 92 var actualPaddingBottom = getComputedStyle(node).paddingBottom; 93 // Trim the unit "px" from the output. 94 actualPaddingBottom = actualPaddingBottom.substring(0, actualPaddingBottom.length - 2); 95 if (actualPaddingBottom != expectedPaddingBottom) 96 failures.push("Expected " + expectedPaddingBottom + " for padding-bottom, but got " + actualPaddingBottom + ". "); 97 } 98 99 var expectedPaddingLeft = node.getAttribute && node.getAttribute("data-expected-padding-left"); 100 if (expectedPaddingLeft) { 101 var actualPaddingLeft = getComputedStyle(node).paddingLeft; 102 // Trim the unit "px" from the output. 103 actualPaddingLeft = actualPaddingLeft.substring(0, actualPaddingLeft.length - 2); 104 if (actualPaddingLeft != expectedPaddingLeft) 105 failures.push("Expected " + expectedPaddingLeft + " for padding-left, but got " + actualPaddingLeft + ". "); 106 } 107 108 var expectedPaddingRight = node.getAttribute && node.getAttribute("data-expected-padding-right"); 109 if (expectedPaddingRight) { 110 var actualPaddingRight = getComputedStyle(node).paddingRight; 111 // Trim the unit "px" from the output. 112 actualPaddingRight = actualPaddingRight.substring(0, actualPaddingRight.length - 2); 113 if (actualPaddingRight != expectedPaddingRight) 114 failures.push("Expected " + expectedPaddingRight + " for padding-right, but got " + actualPaddingRight + ". "); 115 } 116 117 var expectedMarginTop = node.getAttribute && node.getAttribute("data-expected-margin-top"); 118 if (expectedMarginTop) { 119 var actualMarginTop = getComputedStyle(node).marginTop; 120 // Trim the unit "px" from the output. 121 actualMarginTop = actualMarginTop.substring(0, actualMarginTop.length - 2); 122 if (actualMarginTop != expectedMarginTop) 123 failures.push("Expected " + expectedMarginTop + " for margin-top, but got " + actualMarginTop + ". "); 124 } 125 126 var expectedMarginBottom = node.getAttribute && node.getAttribute("data-expected-margin-bottom"); 127 if (expectedMarginBottom) { 128 var actualMarginBottom = getComputedStyle(node).marginBottom; 129 // Trim the unit "px" from the output. 130 actualMarginBottom = actualMarginBottom.substring(0, actualMarginBottom.length - 2); 131 if (actualMarginBottom != expectedMarginBottom) 132 failures.push("Expected " + expectedMarginBottom + " for margin-bottom, but got " + actualMarginBottom + ". "); 133 } 134 135 var expectedMarginLeft = node.getAttribute && node.getAttribute("data-expected-margin-left"); 136 if (expectedMarginLeft) { 137 var actualMarginLeft = getComputedStyle(node).marginLeft; 138 // Trim the unit "px" from the output. 139 actualMarginLeft = actualMarginLeft.substring(0, actualMarginLeft.length - 2); 140 if (actualMarginLeft != expectedMarginLeft) 141 failures.push("Expected " + expectedMarginLeft + " for margin-left, but got " + actualMarginLeft + ". "); 142 } 143 144 var expectedMarginRight = node.getAttribute && node.getAttribute("data-expected-margin-right"); 145 if (expectedMarginRight) { 146 var actualMarginRight = getComputedStyle(node).marginRight; 147 // Trim the unit "px" from the output. 148 actualMarginRight = actualMarginRight.substring(0, actualMarginRight.length - 2); 149 if (actualMarginRight != expectedMarginRight) 150 failures.push("Expected " + expectedMarginRight + " for margin-right, but got " + actualMarginRight + ". "); 151 } 80 152 } 81 153 -
trunk/Source/WebCore/ChangeLog
r136460 r136465 1 2012-12-03 Julien Chaffraix <jchaffraix@webkit.org> 2 3 [CSS Grid Layout] Support paddings and margins on grid items 4 https://bugs.webkit.org/show_bug.cgi?id=103677 5 6 Reviewed by Tony Chang. 7 8 After bug 102968, we properly resolve grid items' width and height against the 9 grid areas' sizes. However we didn't check for paddings and margins, which is 10 what this change fixes.. 11 12 Test: fast/css-grid-layout/percent-padding-margin-resolution-grid-item.html 13 14 * rendering/RenderBox.cpp: 15 (WebCore::RenderBox::computeLogicalWidthInRegion): 16 Don't stretch the end margin to match the containing block's extent. 17 The fix is similar to what was done for flex-box in bug 65887. 18 19 * rendering/RenderBoxModelObject.cpp: 20 (WebCore::RenderBoxModelObject::computeStickyPositionConstraints): 21 Added a comment about not using containingBlockLogicalWidthForContent. 22 23 (WebCore::RenderBoxModelObject::computedCSSPaddingTop): 24 (WebCore::RenderBoxModelObject::computedCSSPaddingBottom): 25 (WebCore::RenderBoxModelObject::computedCSSPaddingLeft): 26 (WebCore::RenderBoxModelObject::computedCSSPaddingRight): 27 (WebCore::RenderBoxModelObject::computedCSSPaddingBefore): 28 (WebCore::RenderBoxModelObject::computedCSSPaddingAfter): 29 (WebCore::RenderBoxModelObject::computedCSSPaddingStart): 30 (WebCore::RenderBoxModelObject::computedCSSPaddingEnd): 31 Updated these functions to use containingBlockLogicalWidthForContent. 32 33 * rendering/RenderGrid.h: 34 * rendering/RenderObject.h: 35 (WebCore::RenderObject::isRenderGrid): 36 Added isRenderGrid. 37 1 38 2012-12-03 Scott Violet <sky@chromium.org> 2 39 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r136326 r136465 1830 1830 1831 1831 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + computedValues.m_margins.m_end) 1832 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated()) {1832 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated() && !cb->isRenderGrid()) { 1833 1833 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb->marginStartForChild(this); 1834 1834 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection(); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r136378 r136465 462 462 LayoutRect containerContentRect = containingBlock->contentBoxRect(); 463 463 464 // Sticky positioned element ignore any override logical width on the containing block (as they don't call 465 // containingBlockLogicalWidthForContent). It's unclear whether this is totally fine. 464 466 LayoutUnit minLeftMargin = minimumValueForLength(style()->marginLeft(), containingBlock->availableLogicalWidth(), view()); 465 467 LayoutUnit minTopMargin = minimumValueForLength(style()->marginTop(), containingBlock->availableLogicalWidth(), view()); … … 556 558 Length padding = style()->paddingTop(); 557 559 if (padding.isPercent()) 558 w = containingBlock ()->availableLogicalWidth();560 w = containingBlockLogicalWidthForContent(); 559 561 else if (padding.isViewportPercentage()) 560 562 renderView = view(); … … 568 570 Length padding = style()->paddingBottom(); 569 571 if (padding.isPercent()) 570 w = containingBlock ()->availableLogicalWidth();572 w = containingBlockLogicalWidthForContent(); 571 573 else if (padding.isViewportPercentage()) 572 574 renderView = view(); … … 580 582 Length padding = style()->paddingLeft(); 581 583 if (padding.isPercent()) 582 w = containingBlock ()->availableLogicalWidth();584 w = containingBlockLogicalWidthForContent(); 583 585 else if (padding.isViewportPercentage()) 584 586 renderView = view(); … … 592 594 Length padding = style()->paddingRight(); 593 595 if (padding.isPercent()) 594 w = containingBlock ()->availableLogicalWidth();596 w = containingBlockLogicalWidthForContent(); 595 597 else if (padding.isViewportPercentage()) 596 598 renderView = view(); … … 604 606 Length padding = style()->paddingBefore(); 605 607 if (padding.isPercent()) 606 w = containingBlock ()->availableLogicalWidth();608 w = containingBlockLogicalWidthForContent(); 607 609 else if (padding.isViewportPercentage()) 608 610 renderView = view(); … … 616 618 Length padding = style()->paddingAfter(); 617 619 if (padding.isPercent()) 618 w = containingBlock ()->availableLogicalWidth();620 w = containingBlockLogicalWidthForContent(); 619 621 else if (padding.isViewportPercentage()) 620 622 renderView = view(); … … 628 630 Length padding = style()->paddingStart(); 629 631 if (padding.isPercent()) 630 w = containingBlock ()->availableLogicalWidth();632 w = containingBlockLogicalWidthForContent(); 631 633 else if (padding.isViewportPercentage()) 632 634 renderView = view(); … … 640 642 Length padding = style()->paddingEnd(); 641 643 if (padding.isPercent()) 642 w = containingBlock ()->availableLogicalWidth();644 w = containingBlockLogicalWidthForContent(); 643 645 else if (padding.isViewportPercentage()) 644 646 renderView = view(); -
trunk/Source/WebCore/rendering/RenderGrid.h
r135164 r136465 45 45 46 46 private: 47 virtual bool isRenderGrid() const OVERRIDE { return true; } 48 47 49 class GridTrack; 48 50 enum TrackSizingDirection { ForColumns, ForRows }; -
trunk/Source/WebCore/rendering/RenderObject.h
r136107 r136465 396 396 virtual bool isRenderFullScreenPlaceholder() const { return false; } 397 397 #endif 398 399 virtual bool isRenderGrid() const { return false; } 398 400 399 401 virtual bool isRenderFlowThread() const { return false; }
Note: See TracChangeset
for help on using the changeset viewer.