Changeset 128786 in webkit
- Timestamp:
- Sep 17, 2012 11:44:51 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r128783 r128786 1 2012-09-17 Bear Travis <betravis@adobe.com> 2 3 [CSS Exclusions] Enable shape-inside for percentage lengths based on logical height 4 https://bugs.webkit.org/show_bug.cgi?id=93547 5 6 Reviewed by Levi Weintraub. 7 8 Test that shape percentage-based measurements resolve correctly. Some testing is 9 already covered by shape-inside-percentage-auto.html. 10 11 * fast/exclusions/shape-inside/shape-inside-percentage-expected.html: Added. 12 * fast/exclusions/shape-inside/shape-inside-percentage.html: Added. 13 1 14 2012-09-17 Ojan Vafai <ojan@chromium.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r128785 r128786 1 2012-09-17 Bear Travis <betravis@adobe.com> 2 3 [CSS Exclusions] Enable shape-inside for percentage lengths based on logical height 4 https://bugs.webkit.org/show_bug.cgi?id=93547 5 6 Reviewed by Levi Weintraub. 7 8 Shape-inside needs to be passed the logical size to use when computing percentage 9 based coordinates. The CSS Regions-specific method computeInitialRegionRangeForBlock 10 has been generalized to updateRegionsAndExclusionsLogicalSize. This method takes 11 the pre-child-layout logical width and height, and uses them to compute the logical 12 width and height that regions and exclusions should use for layout. Regions use a 13 block's maximum possible logical height to compute a region's maximum extent. 14 Exclusions use a block's fixed logical width and height, or 0 if one does not exist, 15 to resolve percentage-based shape lengths. The default logical size used for resolving 16 percentage based coordinates is tested in shape-inside-percentage-auto.html. 17 18 Test: fast/exclusions/shape-inside/shape-inside-percentage.html 19 20 * rendering/RenderBlock.cpp: 21 (WebCore::RenderBlock::updateRegionsAndExclusionsLogicalSize): Calculates the logical 22 height regions and exclusions should use, and updates their layout sizes through 23 computeExclusionShapeSize and computeRegionRangeForBlock. 24 (WebCore): 25 (WebCore::RenderBlock::computeExclusionShapeSize): Pass the appropriate logical size 26 to exclusion shapes so they can resolve percentage based coordinates. 27 (WebCore::RenderBlock::layoutBlock): Call the new updateRegionsAndExclusionsLogicalSize 28 method. 29 * rendering/RenderBlock.h: 30 (RenderBlock): 31 * rendering/RenderBox.cpp: 32 (WebCore::percentageLogicalHeightIsResolvable): Determine if percentage lengths 33 based on logical height can be resolved. 34 (WebCore): 35 (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Added declaration. 36 * rendering/RenderBox.h: 37 (RenderBox): 38 * rendering/RenderDeprecatedFlexibleBox.cpp: 39 (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): Calling 40 updateRegionsAndExclusionsLogicalSize rather than computeInitialRegionRangeForBlock. 41 * rendering/RenderFlexibleBox.cpp: 42 (WebCore::RenderFlexibleBox::layoutBlock): Ditto. 43 * rendering/RenderGrid.cpp: 44 (WebCore::RenderGrid::layoutBlock): Ditto. 45 1 46 2012-09-17 Vangelis Kokkevis <vangelis@chromium.org> 2 47 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r128416 r128786 1395 1395 #endif 1396 1396 1397 void RenderBlock::computeInitialRegionRangeForBlock() 1398 { 1399 if (inRenderFlowThread()) { 1400 // Set our start and end regions. No regions above or below us will be considered by our children. They are 1401 // effectively clamped to our region range. 1402 LayoutUnit oldHeight = logicalHeight(); 1403 LayoutUnit oldLogicalTop = logicalTop(); 1404 setLogicalHeight(MAX_LAYOUT_UNIT / 2); 1405 updateLogicalHeight(); 1406 enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); 1407 setLogicalHeight(oldHeight); 1408 setLogicalTop(oldLogicalTop); 1409 } 1410 } 1397 void RenderBlock::updateRegionsAndExclusionsLogicalSize() 1398 { 1399 #if ENABLE(CSS_EXCLUSIONS) 1400 if (!inRenderFlowThread() && !wrapShapeInfo()) 1401 #else 1402 if (!inRenderFlowThread()) 1403 #endif 1404 return; 1405 1406 LayoutUnit oldHeight = logicalHeight(); 1407 LayoutUnit oldTop = logicalTop(); 1408 1409 // Compute the maximum logical height content may cause this block to expand to 1410 // FIXME: These should eventually use the const computeLogicalHeight rather than updateLogicalHeight 1411 setLogicalHeight(MAX_LAYOUT_UNIT / 2); 1412 updateLogicalHeight(); 1413 1414 #if ENABLE(CSS_EXCLUSIONS) 1415 computeExclusionShapeSize(); 1416 #endif 1417 1418 // Set our start and end regions. No regions above or below us will be considered by our children. They are 1419 // effectively clamped to our region range. 1420 computeRegionRangeForBlock(); 1421 1422 setLogicalHeight(oldHeight); 1423 setLogicalTop(oldTop); 1424 } 1425 1426 #if ENABLE(CSS_EXCLUSIONS) 1427 void RenderBlock::computeExclusionShapeSize() 1428 { 1429 WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo(); 1430 if (wrapShapeInfo) { 1431 bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvableFromBlock(this, false); 1432 wrapShapeInfo->computeShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : ZERO_LAYOUT_UNIT); 1433 } 1434 } 1435 #endif 1411 1436 1412 1437 void RenderBlock::computeRegionRangeForBlock() … … 1492 1517 relayoutChildren = true; 1493 1518 } 1494 computeInitialRegionRangeForBlock(); 1495 #if ENABLE(CSS_EXCLUSIONS) 1496 // FIXME: Bug 93547: Resolve logical height for percentage based vertical lengths 1497 if (WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo()) 1498 wrapShapeInfo->computeShapeSize(logicalWidth(), 0); 1499 #endif 1519 updateRegionsAndExclusionsLogicalSize(); 1500 1520 1501 1521 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track -
trunk/Source/WebCore/rendering/RenderBlock.h
r128713 r128786 492 492 #endif 493 493 494 void computeInitialRegionRangeForBlock();494 void updateRegionsAndExclusionsLogicalSize(); 495 495 void computeRegionRangeForBlock(); 496 496 … … 499 499 private: 500 500 #if ENABLE(CSS_EXCLUSIONS) 501 void computeExclusionShapeSize(); 501 502 void updateWrapShapeInfoAfterStyleChange(const BasicShape*, const BasicShape* oldWrapShape); 502 503 #endif -
trunk/Source/WebCore/rendering/RenderBox.cpp
r128633 r128786 3727 3727 } 3728 3728 3729 static bool percentageLogicalHeightIsResolvable(const RenderBox* box) 3729 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) 3730 { 3731 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containingBlock(), box->isOutOfFlowPositioned()); 3732 } 3733 3734 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) 3730 3735 { 3731 3736 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing … … 3734 3739 // block has an auto height. We still skip anonymous containing blocks in both modes, though, and look 3735 3740 // only at explicit containers. 3736 const RenderBlock* cb = box->containingBlock(); 3741 const RenderBlock* cb = containingBlock; 3742 bool inQuirksMode = cb->document()->inQuirksMode(); 3737 3743 while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) { 3738 if (! box->document()->inQuirksMode()&& !cb->isAnonymousBlock())3744 if (!inQuirksMode && !cb->isAnonymousBlock()) 3739 3745 break; 3740 3746 cb = cb->containingBlock(); … … 3758 3764 return true; 3759 3765 if (cb->style()->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) 3760 return percentageLogicalHeightIsResolvable (cb);3761 if (cb->isRenderView() || (cb->isBody() && box->document()->inQuirksMode())|| isOutOfFlowPositionedWithSpecifiedHeight)3766 return percentageLogicalHeightIsResolvableFromBlock(cb->containingBlock(), cb->isOutOfFlowPositioned()); 3767 if (cb->isRenderView() || inQuirksMode || isOutOfFlowPositionedWithSpecifiedHeight) 3762 3768 return true; 3763 if (cb->isRoot() && box->isOutOfFlowPositioned()) {3769 if (cb->isRoot() && isOutOfFlowPositioned) { 3764 3770 // Match the positioned objects behavior, which is that positioned objects will fill their viewport 3765 3771 // always. Note we could only hit this case by recurring into computePercentageLogicalHeight on a positioned containing block. -
trunk/Source/WebCore/rendering/RenderBox.h
r128633 r128786 400 400 virtual LayoutUnit computeReplacedLogicalHeight() const; 401 401 402 static bool percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool outOfFlowPositioned); 402 403 LayoutUnit computePercentageLogicalHeight(const Length& height) const; 403 404 -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r128201 r128786 244 244 relayoutChildren = true; 245 245 } 246 computeInitialRegionRangeForBlock();246 updateRegionsAndExclusionsLogicalSize(); 247 247 248 248 LayoutSize previousSize = size(); -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r128494 r128786 250 250 relayoutChildren = true; 251 251 } 252 computeInitialRegionRangeForBlock();252 updateRegionsAndExclusionsLogicalSize(); 253 253 254 254 LayoutSize previousSize = size(); -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r128201 r128786 72 72 relayoutChildren = true; 73 73 } 74 computeInitialRegionRangeForBlock();74 updateRegionsAndExclusionsLogicalSize(); 75 75 76 76 LayoutSize previousSize = size();
Note: See TracChangeset
for help on using the changeset viewer.