Changeset 127596 in webkit
- Timestamp:
- Sep 5, 2012 8:56:48 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 22 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127595 r127596 1 2012-09-05 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 14 Besides adding new tests, i have modified existing tests that were having regions with width:auto as they were failing after this patch. 15 16 * fast/regions/autowidth-abspos-expected.html: Added. 17 * fast/regions/autowidth-abspos-regionchain-expected.html: Added. 18 * fast/regions/autowidth-abspos-regionchain.html: Added. 19 * fast/regions/autowidth-abspos.html: Added. 20 * fast/regions/autowidth-float-expected.html: Added. 21 * fast/regions/autowidth-float.html: Added. 22 * fast/regions/autowidth-inlineblock-expected.html: Added. 23 * fast/regions/autowidth-inlineblock.html: Added. 24 * fast/regions/autowidth-nonreplaced-abspos-expected.html: Added. 25 * fast/regions/autowidth-nonreplaced-abspos.html: Added. 26 * fast/regions/autowidth-nonreplacedblock-normalflow-expected.html: Added. 27 * fast/regions/autowidth-nonreplacedblock-normalflow.html: Added. 28 * fast/regions/autowidth-normalflow-expected.html: Added. 29 * fast/regions/autowidth-normalflow-maxwidth-expected.html: Added. 30 * fast/regions/autowidth-normalflow-maxwidth.html: Added. 31 * fast/regions/autowidth-normalflow-minmaxwidth-expected.html: Added. 32 * fast/regions/autowidth-normalflow-minmaxwidth.html: Added. 33 * fast/regions/autowidth-normalflow-minwidth-expected.html: Added. 34 * fast/regions/autowidth-normalflow-minwidth.html: Added. 35 * fast/regions/autowidth-normalflow-vertrl-expected.html: Added. 36 * fast/regions/autowidth-normalflow-vertrl.html: Added. 37 * fast/regions/autowidth-normalflow.html: Added. 38 * fast/regions/bottom-overflow-out-of-first-region.html: 39 * fast/regions/flows-dependency-dynamic-remove.html: 40 * fast/regions/flows-dependency-same-flow.html: 41 * fast/regions/render-region-renderer-expected.html: 42 * fast/regions/top-overflow-out-of-second-region.html: 43 1 44 2012-09-05 Brady Eidson <beidson@apple.com> 2 45 -
trunk/LayoutTests/fast/regions/bottom-overflow-out-of-first-region.html
r97701 r127596 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
r97701 r127596 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
r97701 r127596 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
r102997 r127596 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
r97701 r127596 34 34 } 35 35 36 #region3 { 37 width: 0px; 38 height: 0px; 39 } 36 40 </style> 37 41 -
trunk/Source/WebCore/ChangeLog
r127593 r127596 1 2012-09-05 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-float.html 19 fast/regions/autowidth-inlineblock.html 20 fast/regions/autowidth-nonreplaced-abspos.html 21 fast/regions/autowidth-nonreplacedblock-normalflow.html 22 fast/regions/autowidth-normalflow-maxwidth.html 23 fast/regions/autowidth-normalflow-minmaxwidth.html 24 fast/regions/autowidth-normalflow-minwidth.html 25 fast/regions/autowidth-normalflow-vertrl.html 26 fast/regions/autowidth-normalflow.html 27 28 * rendering/RenderBox.cpp: 29 (WebCore::RenderBox::computePositionedLogicalWidth): For positioned auto-width regions, skip the code path for replaced elements. 30 * rendering/RenderRegion.cpp: 31 (WebCore): Override min/maxPreferredLogicalWidth as they are used in the process of computing width for regions with auto width. 32 As this moment, a region is still a RenderReplaced element, so this code needs to be revisited when the region will become a RenderBlock. 33 Also, for min/max-width, we support only <length> values. We will extend support for other values in a following patch. 34 (WebCore::RenderRegion::minPreferredLogicalWidth): 35 (WebCore::RenderRegion::maxPreferredLogicalWidth): 36 * rendering/RenderRegion.h: 37 (RenderRegion): 38 Override isInlineBlockOrInlineTable() and shouldComputeSizeAsReplaced() to ensure that computation for width auto follows the normal 39 block/box sizing code. 40 1 41 2012-09-05 Ilya Tikhonovsky <loislo@chromium.org> 2 42 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r127549 r127596 2547 2547 { 2548 2548 if (isReplaced()) { 2549 computePositionedLogicalWidthReplaced(); // FIXME: Patch for regions when we add replaced element support. 2550 return; 2549 // FIXME: For regions with width auto, we want to compute width using the normal block sizing code. 2550 // For now, regions are replaced elements and this code can be removed once the RenderRegion 2551 // will inherit from RenderBlock instead of RenderReplaced. 2552 // (see https://bugs.webkit.org/show_bug.cgi?id=74132 ) 2553 if (!isRenderRegion() || (isRenderRegion() && shouldComputeSizeAsReplaced())) { 2554 computePositionedLogicalWidthReplaced(); // FIXME: Patch for regions when we add replaced element support. 2555 return; 2556 } 2551 2557 } 2552 2558 -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r127421 r127596 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) 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, computeContentBoxLogicalWidth(styleToUse->logicalMinWidth().value())); 513 514 if (styleToUse->logicalMaxWidth().isFixed()) 515 minPreferredLogicalWidth = std::min(minPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMaxWidth().value())); 516 517 return minPreferredLogicalWidth + borderAndPaddingLogicalWidth(); 518 } 519 520 LayoutUnit RenderRegion::maxPreferredLogicalWidth() const 521 { 522 if (!m_flowThread) 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, computeContentBoxLogicalWidth(styleToUse->logicalMinWidth().value())); 532 533 if (styleToUse->logicalMaxWidth().isFixed()) 534 maxPreferredLogicalWidth = std::min(maxPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMaxWidth().value())); 535 536 return maxPreferredLogicalWidth + borderAndPaddingLogicalWidth(); 537 } 538 499 539 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderRegion.h
r127280 r127596 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. … … 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.