Changeset 164837 in webkit
- Timestamp:
- Feb 27, 2014 3:52:23 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r164834 r164837 1 2014-02-27 Radu Stavila <stavila@adobe.com> 2 3 [CSS Regions] Move named-flow specific method decorationsClipRectForBoxInRegion to RenderNamedFlowThread 4 https://bugs.webkit.org/show_bug.cgi?id=129428 5 6 Reviewed by Andreas Kling. 7 8 Since the decorationsClipRectForBoxInRegion method is a named flow specific method, it makes 9 sense to be in the named flow specific class, RenderNamedFlowThread, instead of the more 10 generic RenderFlowThread. 11 12 No new tests required. No new functionality. 13 14 * rendering/RenderBlock.cpp: 15 (WebCore::RenderBlock::paintObject): 16 * rendering/RenderFlowThread.cpp: 17 * rendering/RenderFlowThread.h: 18 * rendering/RenderNamedFlowThread.cpp: 19 (WebCore::RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment): 20 * rendering/RenderNamedFlowThread.h: 21 1 22 2014-02-27 Zoltan Horvath <zoltan@webkit.org> 2 23 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r164805 r164837 2302 2302 bool didClipToRegion = false; 2303 2303 2304 if (paintInfo.paintContainer && paintInfo.renderNamedFlowFragment && paintInfo.paintContainer->isRender FlowThread()) {2304 if (paintInfo.paintContainer && paintInfo.renderNamedFlowFragment && paintInfo.paintContainer->isRenderNamedFlowThread()) { 2305 2305 // If this box goes beyond the current region, then make sure not to overflow the region. 2306 2306 // This (overflowing region X altough also fragmented to region X+1) could happen when one of this box's children … … 2311 2311 didClipToRegion = true; 2312 2312 2313 paintInfo.context->clip(toRender FlowThread(paintInfo.paintContainer)->decorationsClipRectForBoxInRegion(*this, *paintInfo.renderNamedFlowFragment));2313 paintInfo.context->clip(toRenderNamedFlowThread(paintInfo.paintContainer)->decorationsClipRectForBoxInNamedFlowFragment(*this, *paintInfo.renderNamedFlowFragment)); 2314 2314 } 2315 2315 -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r164594 r164837 1263 1263 } 1264 1264 1265 LayoutRect RenderFlowThread::decorationsClipRectForBoxInRegion(const RenderBox& box, RenderRegion& region) const1266 {1267 LayoutRect visualOverflowRect = region.visualOverflowRectForBox(&box);1268 LayoutUnit initialLogicalX = style().isHorizontalWritingMode() ? visualOverflowRect.x() : visualOverflowRect.y();1269 1270 // The visual overflow rect returned by visualOverflowRectForBox is already flipped but the1271 // RenderRegion::rectFlowPortionForBox method expects it unflipped.1272 flipForWritingModeLocalCoordinates(visualOverflowRect);1273 visualOverflowRect = region.rectFlowPortionForBox(&box, visualOverflowRect);1274 1275 // Now flip it again.1276 flipForWritingModeLocalCoordinates(visualOverflowRect);1277 1278 // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread.1279 if (style().isFlippedBlocksWritingMode()) {1280 if (style().isHorizontalWritingMode())1281 visualOverflowRect.moveBy(LayoutPoint(0, height()));1282 else1283 visualOverflowRect.moveBy(LayoutPoint(width(), 0));1284 }1285 1286 const RenderBox* iterBox = &box;1287 while (iterBox && iterBox != this) {1288 RenderBlock* containerBlock = iterBox->containingBlock();1289 1290 // FIXME: This doesn't work properly with flipped writing modes.1291 // https://bugs.webkit.org/show_bug.cgi?id=1251491292 if (iterBox->isPositioned()) {1293 // For positioned elements, just use the layer's absolute bounding box.1294 visualOverflowRect.moveBy(iterBox->layer()->absoluteBoundingBox().location());1295 break;1296 }1297 1298 LayoutRect currentBoxRect = iterBox->frameRect();1299 if (iterBox->style().isFlippedBlocksWritingMode()) {1300 if (iterBox->style().isHorizontalWritingMode())1301 currentBoxRect.setY(currentBoxRect.height() - currentBoxRect.maxY());1302 else1303 currentBoxRect.setX(currentBoxRect.width() - currentBoxRect.maxX());1304 }1305 1306 if (containerBlock->style().writingMode() != iterBox->style().writingMode())1307 iterBox->flipForWritingMode(currentBoxRect);1308 1309 visualOverflowRect.moveBy(currentBoxRect.location());1310 iterBox = containerBlock;1311 }1312 1313 // Since the purpose of this method is to make sure the borders of a fragmented1314 // element don't overflow the region in the fragmentation direction, there's no1315 // point in restricting the clipping rect on the logical X axis.1316 // This also saves us the trouble of handling percent-based widths and margins1317 // since the absolute bounding box of a positioned element would not contain1318 // the correct coordinates relative to the region we're interested in, but rather1319 // relative to the actual flow thread.1320 if (style().isHorizontalWritingMode()) {1321 if (initialLogicalX < visualOverflowRect.x())1322 visualOverflowRect.shiftXEdgeTo(initialLogicalX);1323 if (visualOverflowRect.width() < frameRect().width())1324 visualOverflowRect.setWidth(frameRect().width());1325 } else {1326 if (initialLogicalX < visualOverflowRect.y())1327 visualOverflowRect.shiftYEdgeTo(initialLogicalX);1328 if (visualOverflowRect.height() < frameRect().height())1329 visualOverflowRect.setHeight(frameRect().height());1330 }1331 1332 return visualOverflowRect;1333 }1334 1335 1265 void RenderFlowThread::flipForWritingModeLocalCoordinates(LayoutRect& rect) const 1336 1266 { -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r164716 r164837 200 200 LayoutRect mapFromFlowThreadToLocal(const RenderBox*, const LayoutRect&) const; 201 201 LayoutRect mapFromLocalToFlowThread(const RenderBox*, const LayoutRect&) const; 202 203 LayoutRect decorationsClipRectForBoxInRegion(const RenderBox&, RenderRegion&) const; 204 202 205 203 void flipForWritingModeLocalCoordinates(LayoutRect&) const; 206 204 -
trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp
r164482 r164837 36 36 #include "Range.h" 37 37 #include "RenderInline.h" 38 #include "RenderLayer.h" 38 39 #include "RenderNamedFlowFragment.h" 39 40 #include "RenderText.h" … … 282 283 if (m_regionList.first() == region) 283 284 updateWritingMode(); 285 } 286 287 LayoutRect RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment(const RenderBox& box, RenderNamedFlowFragment& fragment) const 288 { 289 LayoutRect visualOverflowRect = fragment.visualOverflowRectForBox(&box); 290 LayoutUnit initialLogicalX = style().isHorizontalWritingMode() ? visualOverflowRect.x() : visualOverflowRect.y(); 291 292 // The visual overflow rect returned by visualOverflowRectForBox is already flipped but the 293 // RenderRegion::rectFlowPortionForBox method expects it unflipped. 294 flipForWritingModeLocalCoordinates(visualOverflowRect); 295 visualOverflowRect = fragment.rectFlowPortionForBox(&box, visualOverflowRect); 296 297 // Now flip it again. 298 flipForWritingModeLocalCoordinates(visualOverflowRect); 299 300 // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread. 301 if (style().isFlippedBlocksWritingMode()) { 302 if (style().isHorizontalWritingMode()) 303 visualOverflowRect.moveBy(LayoutPoint(0, height())); 304 else 305 visualOverflowRect.moveBy(LayoutPoint(width(), 0)); 306 } 307 308 const RenderBox* iterBox = &box; 309 while (iterBox && iterBox != this) { 310 RenderBlock* containerBlock = iterBox->containingBlock(); 311 312 // FIXME: This doesn't work properly with flipped writing modes. 313 // https://bugs.webkit.org/show_bug.cgi?id=125149 314 if (iterBox->isPositioned()) { 315 // For positioned elements, just use the layer's absolute bounding box. 316 visualOverflowRect.moveBy(iterBox->layer()->absoluteBoundingBox().location()); 317 break; 318 } 319 320 LayoutRect currentBoxRect = iterBox->frameRect(); 321 if (iterBox->style().isFlippedBlocksWritingMode()) { 322 if (iterBox->style().isHorizontalWritingMode()) 323 currentBoxRect.setY(currentBoxRect.height() - currentBoxRect.maxY()); 324 else 325 currentBoxRect.setX(currentBoxRect.width() - currentBoxRect.maxX()); 326 } 327 328 if (containerBlock->style().writingMode() != iterBox->style().writingMode()) 329 iterBox->flipForWritingMode(currentBoxRect); 330 331 visualOverflowRect.moveBy(currentBoxRect.location()); 332 iterBox = containerBlock; 333 } 334 335 // Since the purpose of this method is to make sure the borders of a fragmented 336 // element don't overflow the region in the fragmentation direction, there's no 337 // point in restricting the clipping rect on the logical X axis. 338 // This also saves us the trouble of handling percent-based widths and margins 339 // since the absolute bounding box of a positioned element would not contain 340 // the correct coordinates relative to the region we're interested in, but rather 341 // relative to the actual flow thread. 342 if (style().isHorizontalWritingMode()) { 343 if (initialLogicalX < visualOverflowRect.x()) 344 visualOverflowRect.shiftXEdgeTo(initialLogicalX); 345 if (visualOverflowRect.width() < frameRect().width()) 346 visualOverflowRect.setWidth(frameRect().width()); 347 } else { 348 if (initialLogicalX < visualOverflowRect.y()) 349 visualOverflowRect.shiftYEdgeTo(initialLogicalX); 350 if (visualOverflowRect.height() < frameRect().height()) 351 visualOverflowRect.setHeight(frameRect().height()); 352 } 353 354 return visualOverflowRect; 284 355 } 285 356 -
trunk/Source/WebCore/rendering/RenderNamedFlowThread.h
r164482 r164837 68 68 69 69 virtual void regionChangedWritingMode(RenderRegion*) override; 70 71 LayoutRect decorationsClipRectForBoxInNamedFlowFragment(const RenderBox&, RenderNamedFlowFragment&) const; 70 72 71 73 bool overset() const { return m_overset; }
Note: See TracChangeset
for help on using the changeset viewer.