Changeset 96423 in webkit
- Timestamp:
- Sep 30, 2011 2:04:45 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 15 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96420 r96423 1 2011-09-30 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=69167 4 5 [CSS3 Regions] Fix some bugs in the computation of the logical left and width offsets 6 for blocks in variable width regions. Specifically, this patch addresses a minor bug 7 with overflow:hidden/scroll/auto block placement and with RTL directionality. 8 9 Reviewed by Sam Weinig. 10 11 * fast/regions/overflow-in-variable-width-regions.html: Added. 12 * fast/regions/overflow-rtl-in-variable-width-regions.html: Added. 13 * fast/regions/percentage-margins-mixed-ltr-dominant-regions.html: Added. 14 * fast/regions/percentage-margins-mixed-rtl-dominant-regions.html: Added. 15 * fast/regions/percentage-margins-rtl-variable-width-regions.html: Added. 16 * platform/mac/fast/regions/overflow-in-variable-width-regions-expected.png: Added. 17 * platform/mac/fast/regions/overflow-in-variable-width-regions-expected.txt: Added. 18 * platform/mac/fast/regions/overflow-rtl-in-variable-width-regions-expected.png: Added. 19 * platform/mac/fast/regions/overflow-rtl-in-variable-width-regions-expected.txt: Added. 20 * platform/mac/fast/regions/percentage-margins-mixed-ltr-dominant-regions-expected.png: Added. 21 * platform/mac/fast/regions/percentage-margins-mixed-ltr-dominant-regions-expected.txt: Added. 22 * platform/mac/fast/regions/percentage-margins-mixed-rtl-dominant-regions-expected.png: Added. 23 * platform/mac/fast/regions/percentage-margins-mixed-rtl-dominant-regions-expected.txt: Added. 24 * platform/mac/fast/regions/percentage-margins-rtl-variable-width-regions-expected.png: Added. 25 * platform/mac/fast/regions/percentage-margins-rtl-variable-width-regions-expected.txt: Added. 26 1 27 2011-09-30 Adam Barth <abarth@webkit.org> 2 28 -
trunk/Source/WebCore/ChangeLog
r96422 r96423 1 2011-09-30 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=69167 4 5 [CSS3 Regions] Fix some bugs in the computation of the logical left and width offsets 6 for blocks in variable width regions. Specifically, this patch addresses a minor bug 7 with overflow:hidden/scroll/auto block placement and with RTL directionality. 8 9 Reviewed by Sam Weinig. 10 11 Added five new tests in fast/regions. 12 13 * rendering/RenderBlock.cpp: 14 (WebCore::RenderBlock::logicalRightOffsetForContent): 15 Avoid a double fetch of the border box in a given region by not calling 16 logicalLeftOffsetForContent. No correctness change here. It's just cleaner. 17 18 * rendering/RenderBox.cpp: 19 (WebCore::RenderBox::borderBoxRectInRegion): 20 Change the shifted optimization to be cached for "self" rather than for "containing block". 21 Rework the adjustment loop to handle changes in directionality and to fix correctness 22 issues with RTL. 23 24 (WebCore::RenderBox::containingBlockLogicalWidthForContentInRegion): 25 Don't double adjust if an object uses line width as the containing block width. In that 26 case we already computed the line width in the region, so we don't need to apply any 27 additional fixup. 28 29 (WebCore::RenderBox::renderBoxRegionInfo): 30 * rendering/RenderBoxRegionInfo.h: 31 (WebCore::RenderBoxRegionInfo::RenderBoxRegionInfo): 32 (WebCore::RenderBoxRegionInfo::isShifted): 33 Changed the shifted code to be on self rather than on containing block. 34 35 * rendering/RenderFlowThread.cpp: 36 (WebCore::RenderFlowThread::layout): 37 Refactor the layout code for RenderFlowThread to properly set up region rects assuming 38 right alignment in RTL code. This change forces us to compute our maximum logical width 39 first before looping through the regions again to set their content rects. 40 1 41 2011-09-30 Andreas Kling <kling@webkit.org> 2 42 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r96408 r96423 3575 3575 return logicalRightOffset; 3576 3576 LayoutRect boxRect = borderBoxRectInRegionAtPosition(position); 3577 return logical LeftOffsetForContent(position) + availableLogicalWidth() - (logicalWidth() - (isHorizontalWritingMode() ? boxRect.width() : boxRect.height()));3577 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? boxRect.maxX() : boxRect.maxY())); 3578 3578 } 3579 3579 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r96408 r96423 212 212 LayoutUnit logicalLeft = boxInfo->logicalLeft(); 213 213 214 // Now apply the parent left inset since it is cumulative whenever anything in the containing block chain shifts. 215 const RenderBox* currentBox = this; 216 while (boxInfo->containingBlockChainIsShifted()) { 217 currentBox = currentBox->containingBlock(); 214 // Now apply the parent inset since it is cumulative whenever anything in the containing block chain shifts. 215 const RenderBox* currentBox = containingBlock(); 216 boxInfo = currentBox->renderBoxRegionInfo(region); 217 while (boxInfo && boxInfo->isShifted()) { 218 RenderBox* containerBox = currentBox->containingBlock(); 219 LayoutUnit widthDelta = currentBox->logicalWidth() - boxInfo->logicalWidth(); 220 if (containerBox->style()->direction() == LTR) { 221 if (currentBox->style()->direction() == RTL) 222 logicalLeft -= widthDelta; 223 else 224 logicalLeft += boxInfo->logicalLeft(); 225 226 } else { 227 if (currentBox->style()->direction() == LTR) 228 logicalLeft += widthDelta; 229 else 230 logicalLeft -= widthDelta - boxInfo->logicalLeft(); 231 } 232 currentBox = containerBox; 218 233 boxInfo = currentBox->renderBoxRegionInfo(region); 219 if (!boxInfo)220 break;221 logicalLeft += boxInfo->logicalLeft();222 234 } 223 235 … … 1261 1273 { 1262 1274 LayoutUnit result = containingBlockLogicalWidthForContent(); 1275 if (shrinkToAvoidFloats()) // We already sized to the available line width, so no need to adjust. 1276 return result; 1263 1277 RenderBlock* cb = containingBlock(); 1264 1278 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region); … … 1872 1886 logicalLeftOffset += startMarginDelta; 1873 1887 else 1874 logicalLeftOffset += widthDelta - startMarginDelta;1888 logicalLeftOffset -= (widthDelta + startMarginDelta); 1875 1889 1876 1890 // Set our values back. … … 1880 1894 1881 1895 RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(region); 1882 bool containingBlockChainIsShifted = containingBlockInfo && (containingBlockInfo->containingBlockChainIsShifted() 1883 || containingBlockInfo->logicalLeft()); 1884 1896 bool isShifted = containingBlockInfo && (containingBlockInfo->isShifted() 1897 || (style()->direction() == LTR && logicalLeftOffset) 1898 || (style()->direction() == RTL && (logicalWidth() - (logicalLeftOffset + logicalWidthInRegion)))); 1899 1885 1900 // FIXME: Although it's unlikely, these boxes can go outside our bounds, and so we will need to incorporate them into overflow. 1886 return region->setRenderBoxRegionInfo(this, logicalLeftOffset, logicalWidthInRegion, containingBlockChainIsShifted);1901 return region->setRenderBoxRegionInfo(this, logicalLeftOffset, logicalWidthInRegion, isShifted); 1887 1902 } 1888 1903 -
trunk/Source/WebCore/rendering/RenderBoxRegionInfo.h
r96408 r96423 32 32 class RenderBoxRegionInfo { 33 33 public: 34 RenderBoxRegionInfo(LayoutUnit logicalLeft, LayoutUnit logicalWidth, bool containingBlockChainIsShifted)34 RenderBoxRegionInfo(LayoutUnit logicalLeft, LayoutUnit logicalWidth, bool isShifted) 35 35 : m_logicalLeft(logicalLeft) 36 36 , m_logicalWidth(logicalWidth) 37 , m_ containingBlockChainIsShifted(containingBlockChainIsShifted)37 , m_isShifted(isShifted) 38 38 { } 39 39 … … 41 41 LayoutUnit logicalWidth() const { return m_logicalWidth; } 42 42 43 bool containingBlockChainIsShifted() const { return m_containingBlockChainIsShifted; }43 bool isShifted() const { return m_isShifted; } 44 44 45 45 private: 46 46 LayoutUnit m_logicalLeft; 47 47 LayoutUnit m_logicalWidth; 48 bool m_ containingBlockChainIsShifted;48 bool m_isShifted; 49 49 }; 50 50 -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r96408 r96423 312 312 LayoutUnit previousRegionLogicalHeight = 0; 313 313 if (hasRegions()) { 314 int logicalHeight = 0;315 314 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { 316 315 RenderRegion* region = *iter; 317 318 316 if (!region->isValid()) 319 317 continue; 320 321 318 ASSERT(!region->needsLayout()); 322 319 … … 326 323 LayoutUnit regionLogicalHeight; 327 324 328 IntRect regionRect;329 325 if (isHorizontalWritingMode()) { 330 regionRect = IntRect(0, logicalHeight, region->contentWidth(), region->contentHeight());331 logicalHeight += regionRect.height();332 326 regionLogicalWidth = region->contentWidth(); 333 327 regionLogicalHeight = region->contentHeight(); 334 328 } else { 335 regionRect = IntRect(logicalHeight, 0, region->contentWidth(), region->contentHeight());336 logicalHeight += regionRect.width();337 329 regionLogicalWidth = region->contentHeight(); 338 330 regionLogicalHeight = region->contentWidth(); … … 349 341 350 342 previousRegionLogicalWidth = regionLogicalWidth; 351 343 } 344 345 computeLogicalWidth(); // Called to get the maximum logical width for the region. 346 347 LayoutUnit logicalHeight = 0; 348 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { 349 RenderRegion* region = *iter; 350 if (!region->isValid()) 351 continue; 352 LayoutRect regionRect; 353 if (isHorizontalWritingMode()) { 354 regionRect = IntRect(style()->direction() == LTR ? 0 : logicalWidth() - region->contentWidth(), logicalHeight, region->contentWidth(), region->contentHeight()); 355 logicalHeight += regionRect.height(); 356 } else { 357 regionRect = IntRect(logicalHeight, style()->direction() == LTR ? 0 : logicalWidth() - region->contentHeight(), region->contentWidth(), region->contentHeight()); 358 logicalHeight += regionRect.width(); 359 } 352 360 region->setRegionRect(regionRect); 353 361 }
Note: See TracChangeset
for help on using the changeset viewer.