Changeset 128155 in webkit
- Timestamp:
- Sep 11, 2012 1:07:36 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 24 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r128152 r128155 1 2012-09-11 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSS Regions] Auto width is not working for Regions 4 https://bugs.webkit.org/show_bug.cgi?id=74135 5 6 Reviewed by Julien Chaffraix. 7 8 Add tests for width: auto and modify the existing region tests that were having width: auto so that they do not fail after the changes. 9 10 * fast/regions/autowidth-abspos-expected.html: Added. 11 * fast/regions/autowidth-abspos-regionchain-expected.html: Added. 12 * fast/regions/autowidth-abspos-regionchain.html: Added. 13 * fast/regions/autowidth-abspos.html: Added. 14 * fast/regions/autowidth-attachedinvalidregion-expected.txt: Added. 15 * fast/regions/autowidth-attachedinvalidregion.html: Added. 16 * fast/regions/autowidth-float-expected.html: Added. 17 * fast/regions/autowidth-float.html: Added. 18 * fast/regions/autowidth-inlineblock-expected.html: Added. 19 * fast/regions/autowidth-inlineblock.html: Added. 20 * fast/regions/autowidth-nonreplaced-abspos-expected.html: Added. 21 * fast/regions/autowidth-nonreplaced-abspos.html: Added. 22 * fast/regions/autowidth-nonreplacedblock-normalflow-expected.html: Added. 23 * fast/regions/autowidth-nonreplacedblock-normalflow.html: Added. 24 * fast/regions/autowidth-normalflow-expected.html: Added. 25 * fast/regions/autowidth-normalflow-maxwidth-expected.html: Added. 26 * fast/regions/autowidth-normalflow-maxwidth.html: Added. 27 * fast/regions/autowidth-normalflow-minmaxwidth-expected.html: Added. 28 * fast/regions/autowidth-normalflow-minmaxwidth.html: Added. 29 * fast/regions/autowidth-normalflow-minwidth-expected.html: Added. 30 * fast/regions/autowidth-normalflow-minwidth.html: Added. 31 * fast/regions/autowidth-normalflow-vertrl-expected.html: Added. 32 * fast/regions/autowidth-normalflow-vertrl.html: Added. 33 * fast/regions/autowidth-normalflow.html: Added. 34 * fast/regions/bottom-overflow-out-of-first-region.html: 35 * fast/regions/flows-dependency-dynamic-remove.html: 36 * fast/regions/flows-dependency-same-flow.html: 37 * fast/regions/render-region-renderer-expected.html: 38 * fast/regions/top-overflow-out-of-second-region.html: 39 1 40 2012-09-11 Zan Dobersek <zandobersek@gmail.com> 2 41 -
trunk/LayoutTests/fast/regions/bottom-overflow-out-of-first-region.html
r127684 r128155 34 34 } 35 35 36 #region3 { 37 width: 0px; 38 height: 0px; 39 } 36 40 </style> 37 41 -
trunk/LayoutTests/fast/regions/flows-dependency-dynamic-remove.html
r127684 r128155 9 9 .regionFlowB { -webkit-flow-from: flowB; } 10 10 .regionFlowC { -webkit-flow-from: flowC; } 11 12 .regionFlowA, .regionFlowB, .regionFlowC { width: 0px; height: 0px; } 11 13 </style> 12 14 -
trunk/LayoutTests/fast/regions/flows-dependency-same-flow.html
r127684 r128155 9 9 .regionFlowB { -webkit-flow-from: flowB; } 10 10 .regionFlowC { -webkit-flow-from: flowC; } 11 12 .regionFlowA, .regionFlowB, .regionFlowC { width: 0px; height: 0px; } 11 13 </style> 12 14 -
trunk/LayoutTests/fast/regions/render-region-renderer-expected.html
r127684 r128155 15 15 .size1 16 16 { 17 width:0.5px;18 17 height:0.5px; 19 18 } -
trunk/LayoutTests/fast/regions/top-overflow-out-of-second-region.html
r127684 r128155 34 34 } 35 35 36 #region3 { 37 width: 0px; 38 height: 0px; 39 } 36 40 </style> 37 41 -
trunk/Source/WebCore/ChangeLog
r128153 r128155 1 2012-09-11 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSS Regions] Auto width is not working for Regions 4 https://bugs.webkit.org/show_bug.cgi?id=74135 5 6 Reviewed by Julien Chaffraix. 7 8 It was not possible to flow content into a region having { width: auto; } since in such case, the region width was computed to 0. 9 Now, a region having auto width, will have its width computed following the rules for calculation of widths and margins 10 (http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins). 11 For those cases in which resolving the width requires measuring of content's min/max-content values, we use the associated named flow min/max-content 12 values (the same for all regions with width auto in a region chain). 13 When a region has width:auto, the computation of width should be done using normal block/box sizing code, instead of replaced element code. 14 Contains code contributed by Alexandru Chiculita(achicu@adobe.com). 15 16 Tests: fast/regions/autowidth-abspos-regionchain.html 17 fast/regions/autowidth-abspos.html 18 fast/regions/autowidth-attachedinvalidregion.html 19 fast/regions/autowidth-float.html 20 fast/regions/autowidth-inlineblock.html 21 fast/regions/autowidth-nonreplaced-abspos.html 22 fast/regions/autowidth-nonreplacedblock-normalflow.html 23 fast/regions/autowidth-normalflow-maxwidth.html 24 fast/regions/autowidth-normalflow-minmaxwidth.html 25 fast/regions/autowidth-normalflow-minwidth.html 26 fast/regions/autowidth-normalflow-vertrl.html 27 fast/regions/autowidth-normalflow.html 28 29 * rendering/RenderBox.cpp: 30 (WebCore::RenderBox::computePositionedLogicalWidth): For positioned auto-width regions, skip the code path for replaced elements. 31 * rendering/RenderRegion.cpp: 32 (WebCore): Override min/maxPreferredLogicalWidth as they are used in the process of computing width for regions with auto width. 33 As this moment, a region is still a RenderReplaced element, so this code needs to be revisited when the region will become a RenderBlock. 34 Also, for min/max-width, we support only <length> values. We will extend support for other values in a following patch. 35 We only attempt to use the flowThread min/maxPreferredLogicalWidth if the region is valid (there are no circular dependencies). 36 (WebCore::RenderRegion::minPreferredLogicalWidth): 37 (WebCore::RenderRegion::maxPreferredLogicalWidth): 38 * rendering/RenderRegion.h: 39 (RenderRegion): Override isInlineBlockOrInlineTable() and shouldComputeSizeAsReplaced() to ensure that computation for width auto follows the normal 40 block/box sizing code. 41 (WebCore::RenderRegion::expandToEncompassFlowThreadContentsIfNeeded): 42 1 43 2012-09-10 Ilya Tikhonovsky <loislo@chromium.org> 2 44 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r128130 r128155 2536 2536 { 2537 2537 if (isReplaced()) { 2538 computePositionedLogicalWidthReplaced(computedValues); // FIXME: Patch for regions when we add replaced element support. 2539 return; 2538 // FIXME: For regions with width auto, we want to compute width using the normal block sizing code. 2539 // For now, regions are replaced elements and this code can be removed once the RenderRegion 2540 // will inherit from RenderBlock instead of RenderReplaced. 2541 // (see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 2542 if (!isRenderRegion() || (isRenderRegion() && shouldComputeSizeAsReplaced())) { 2543 computePositionedLogicalWidthReplaced(computedValues); // FIXME: Patch for regions when we add replaced element support. 2544 return; 2545 } 2540 2546 } 2541 2547 -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r127684 r128155 497 497 } 498 498 499 // FIXME: when RenderRegion will inherit from RenderBlock instead of RenderReplaced, 500 // we should overwrite computePreferredLogicalWidths ( see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 501 LayoutUnit RenderRegion::minPreferredLogicalWidth() const 502 { 503 if (!m_flowThread || !m_isValid) 504 return RenderReplaced::minPreferredLogicalWidth(); 505 506 // FIXME: Currently, the code handles only the <length> case for min-width. It should also support other values, like percentage, calc 507 // or viewport relative. 508 RenderStyle* styleToUse = style(); 509 LayoutUnit minPreferredLogicalWidth = m_flowThread->minPreferredLogicalWidth(); 510 511 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) 512 minPreferredLogicalWidth = std::max(minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); 513 514 if (styleToUse->logicalMaxWidth().isFixed()) 515 minPreferredLogicalWidth = std::min(minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); 516 517 return minPreferredLogicalWidth + borderAndPaddingLogicalWidth(); 518 } 519 520 LayoutUnit RenderRegion::maxPreferredLogicalWidth() const 521 { 522 if (!m_flowThread || !m_isValid) 523 return RenderReplaced::maxPreferredLogicalWidth(); 524 525 // FIXME: Currently, the code handles only the <length> case for max-width. It should also support other values, like percentage, calc 526 // or viewport relative. 527 RenderStyle* styleToUse = style(); 528 LayoutUnit maxPreferredLogicalWidth = m_flowThread->maxPreferredLogicalWidth(); 529 530 if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) 531 maxPreferredLogicalWidth = std::max(maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value())); 532 533 if (styleToUse->logicalMaxWidth().isFixed()) 534 maxPreferredLogicalWidth = std::min(maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value())); 535 536 return maxPreferredLogicalWidth + borderAndPaddingLogicalWidth(); 537 } 538 499 539 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderRegion.h
r127684 r128155 101 101 virtual LayoutUnit pageLogicalWidth() const; 102 102 virtual LayoutUnit pageLogicalHeight() const; 103 104 virtual LayoutUnit minPreferredLogicalWidth() const OVERRIDE; 105 virtual LayoutUnit maxPreferredLogicalWidth() const OVERRIDE; 103 106 104 107 // This method represents the logical height of the entire flow thread portion used by the region or set. … … 112 115 virtual LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; 113 116 114 virtual void expandToEncompassFlowThreadContentsIfNeeded() { };117 virtual void expandToEncompassFlowThreadContentsIfNeeded() { }; 115 118 116 119 // Whether or not this region is a set. … … 129 132 private: 130 133 virtual const char* renderName() const { return "RenderRegion"; } 134 135 // FIXME: these functions should be revisited once RenderRegion inherits from RenderBlock 136 // instead of RenderReplaced (see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 137 // When width is auto, use normal block/box sizing code except when inline. 138 virtual bool isInlineBlockOrInlineTable() const OVERRIDE { return isInline() && style()->logicalWidth().isAuto(); } 139 virtual bool shouldComputeSizeAsReplaced() const OVERRIDE { return !style()->logicalWidth().isAuto(); } 131 140 132 141 virtual void insertedIntoTree() OVERRIDE;
Note: See TracChangeset
for help on using the changeset viewer.