Changeset 126895 in webkit
- Timestamp:
- Aug 28, 2012, 10:59:13 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
rendering/RenderFlowThread.cpp (modified) (15 diffs)
-
rendering/RenderFlowThread.h (modified) (1 diff)
-
rendering/RenderMultiColumnSet.cpp (modified) (2 diffs)
-
rendering/RenderRegion.cpp (modified) (7 diffs)
-
rendering/RenderRegion.h (modified) (2 diffs)
-
rendering/RenderRegionSet.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126892 r126895 1 2012-08-28 David Hyatt <hyatt@apple.com> 2 3 [New Multicolumn] Rename some flow thread methods and region methods/members to make them 4 more accurate and also change some function signatures so they can be used by RenderMultiColumnSet. 5 https://bugs.webkit.org/show_bug.cgi?id=95213 6 7 Reviewed by Simon Fraser. 8 9 Rename regionRect()/setRegionRect()/m_regionRect on RenderRegion to be flowThreadPortionRect instead. 10 The term regionRect() makes it sound like you're painting a rect in the region's coordinate space, 11 but regionRect() actually represents the portion of the flow thread in the flow thread's coordinate space 12 that this region "owns." 13 14 Also fix paintIntoRegion and hitTestRegion to take specific flow thread portion rects to paint. This 15 allows a region set to paint a portion of a portion, i.e., if a multicolumn set owns part of the flow thread 16 it has to be able to further break up that part into individual columns and issue multiple paint calls, one 17 for each column. 18 19 * rendering/RenderFlowThread.cpp: 20 (WebCore::RenderFlowThread::layout): 21 (WebCore::RenderFlowThread::paintFlowThreadPortionInRegion): 22 (WebCore::RenderFlowThread::hitTestFlowThreadPortionInRegion): 23 (WebCore::RenderFlowThread::repaintRectangleInRegions): 24 (WebCore::RenderFlowThread::renderRegionForLine): 25 (WebCore::RenderFlowThread::regionLogicalTopForLine): 26 (WebCore::RenderFlowThread::regionLogicalWidthForLine): 27 (WebCore::RenderFlowThread::regionLogicalHeightForLine): 28 (WebCore::RenderFlowThread::regionRemainingLogicalHeightForLine): 29 (WebCore::RenderFlowThread::mapFromFlowToRegion): 30 (WebCore::RenderFlowThread::contentLogicalLeftOfFirstRegion): 31 (WebCore::RenderFlowThread::computeOverflowStateForRegions): 32 * rendering/RenderFlowThread.h: 33 * rendering/RenderMultiColumnSet.cpp: 34 (WebCore::RenderMultiColumnSet::columnCount): 35 (WebCore::RenderMultiColumnSet::paintColumnContents): 36 * rendering/RenderRegion.cpp: 37 (WebCore::RenderRegion::flowThreadPortionOverflowRect): 38 (WebCore::RenderRegion::paintReplaced): 39 (WebCore::RenderRegion::nodeAtPoint): 40 (WebCore::RenderRegion::layout): 41 (WebCore::RenderRegion::offsetFromLogicalTopOfFirstPage): 42 * rendering/RenderRegion.h: 43 (WebCore::RenderRegion::setFlowThreadPortionRect): 44 (WebCore::RenderRegion::flowThreadPortionRect): 45 (RenderRegion): 46 * rendering/RenderRegionSet.cpp: 47 (WebCore::RenderRegionSet::expandToEncompassFlowThreadContentsIfNeeded): 48 1 49 2012-08-28 Alpha Lam <hclam@chromium.org> 2 50 -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r126859 r126895 178 178 179 179 LayoutRect regionRect(style()->direction() == LTR ? ZERO_LAYOUT_UNIT : logicalWidth() - regionLogicalWidth, logicalHeight, regionLogicalWidth, regionLogicalHeight); 180 region->set RegionRect(isHorizontalWritingMode() ? regionRect : regionRect.transposedRect());180 region->setFlowThreadPortionRect(isHorizontalWritingMode() ? regionRect : regionRect.transposedRect()); 181 181 logicalHeight += regionLogicalHeight; 182 182 } … … 237 237 } 238 238 239 void RenderFlowThread::paint IntoRegion(PaintInfo& paintInfo, RenderRegion* region, const LayoutPoint& paintOffset)239 void RenderFlowThread::paintFlowThreadPortionInRegion(PaintInfo& paintInfo, RenderRegion* region, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const LayoutPoint& paintOffset) const 240 240 { 241 241 GraphicsContext* context = paintInfo.context; … … 246 246 // paintOffset contains the offset where the painting should occur 247 247 // adjusted with the region padding and border. 248 LayoutRect regionRect(region->regionRect()); 249 LayoutRect regionOversetRect(region->regionOversetRect()); 250 LayoutRect regionClippingRect(paintOffset + (regionOversetRect.location() - regionRect.location()), regionOversetRect.size()); 248 LayoutRect regionClippingRect(paintOffset + (flowThreadPortionOverflowRect.location() - flowThreadPortionRect.location()), flowThreadPortionOverflowRect.size()); 251 249 252 250 PaintInfo info(paintInfo); … … 260 258 // RenderFlowThread should start painting its content in a position that is offset 261 259 // from the region rect's current position. The amount of offset is equal to the location of 262 // region in flowcoordinates.260 // the flow thread portion in the flow thread's local coordinates. 263 261 IntPoint renderFlowThreadOffset; 264 262 if (style()->isFlippedBlocksWritingMode()) { 265 LayoutRect flipped RegionRect(regionRect);266 flipForWritingMode(flipped RegionRect);267 renderFlowThreadOffset = roundedIntPoint(paintOffset - flipped RegionRect.location());263 LayoutRect flippedFlowThreadPortionRect(flowThreadPortionRect); 264 flipForWritingMode(flippedFlowThreadPortionRect); 265 renderFlowThreadOffset = roundedIntPoint(paintOffset - flippedFlowThreadPortionRect.location()); 268 266 } else 269 renderFlowThreadOffset = roundedIntPoint(paintOffset - regionRect.location());267 renderFlowThreadOffset = roundedIntPoint(paintOffset - flowThreadPortionRect.location()); 270 268 271 269 context->translate(renderFlowThreadOffset.x(), renderFlowThreadOffset.y()); … … 278 276 } 279 277 280 bool RenderFlowThread::hitTestRegion(RenderRegion* region, const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) 281 { 282 LayoutRect regionRect(region->regionRect()); 283 LayoutRect regionOversetRect = region->regionOversetRect(); 284 LayoutRect regionClippingRect(accumulatedOffset + (regionOversetRect.location() - regionRect.location()), regionOversetRect.size()); 278 bool RenderFlowThread::hitTestFlowThreadPortionInRegion(RenderRegion* region, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) const 279 { 280 LayoutRect regionClippingRect(accumulatedOffset + (flowThreadPortionOverflowRect.location() - flowThreadPortionRect.location()), flowThreadPortionOverflowRect.size()); 285 281 if (!regionClippingRect.contains(locationInContainer.point())) 286 282 return false; … … 288 284 LayoutSize renderFlowThreadOffset; 289 285 if (style()->isFlippedBlocksWritingMode()) { 290 LayoutRect flipped RegionRect(regionRect);291 flipForWritingMode(flipped RegionRect);292 renderFlowThreadOffset = accumulatedOffset - flipped RegionRect.location();286 LayoutRect flippedFlowThreadPortionRect(flowThreadPortionRect); 287 flipForWritingMode(flippedFlowThreadPortionRect); 288 renderFlowThreadOffset = accumulatedOffset - flippedFlowThreadPortionRect.location(); 293 289 } else 294 renderFlowThreadOffset = accumulatedOffset - regionRect.location();290 renderFlowThreadOffset = accumulatedOffset - flowThreadPortionRect.location(); 295 291 296 292 // Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView. … … 327 323 328 324 // We only have to issue a repaint in this region if the region rect intersects the repaint rect. 329 LayoutRect flipped RegionRect(region->regionRect());330 LayoutRect flipped RegionOversetRect(region->regionOversetRect());331 flipForWritingMode(flipped RegionRect); // Put the region rects into physical coordinates.332 flipForWritingMode(flipped RegionOversetRect);325 LayoutRect flippedFlowThreadPortionRect(region->flowThreadPortionRect()); 326 LayoutRect flippedFlowThreadPortionOverflowRect(region->flowThreadPortionOverflowRect()); 327 flipForWritingMode(flippedFlowThreadPortionRect); // Put the region rects into physical coordinates. 328 flipForWritingMode(flippedFlowThreadPortionOverflowRect); 333 329 334 330 LayoutRect clippedRect(repaintRect); 335 clippedRect.intersect(flipped RegionOversetRect);331 clippedRect.intersect(flippedFlowThreadPortionOverflowRect); 336 332 if (clippedRect.isEmpty()) 337 333 continue; 338 334 339 335 // Put the region rect into the region's physical coordinate space. 340 clippedRect.setLocation(region->contentBoxRect().location() + (clippedRect.location() - flipped RegionRect.location()));336 clippedRect.setLocation(region->contentBoxRect().location() + (clippedRect.location() - flippedFlowThreadPortionRect.location())); 341 337 342 338 // Now switch to the region's writing mode coordinate space and let it repaint itself. … … 369 365 return region; 370 366 371 LayoutRect regionRect = region-> regionRect();367 LayoutRect regionRect = region->flowThreadPortionRect(); 372 368 373 369 if ((useHorizontalWritingMode && position < regionRect.maxY()) || (!useHorizontalWritingMode && position < regionRect.maxX())) … … 386 382 if (!region) 387 383 return 0; 388 return isHorizontalWritingMode() ? region-> regionRect().y() : region->regionRect().x();384 return isHorizontalWritingMode() ? region->flowThreadPortionRect().y() : region->flowThreadPortionRect().x(); 389 385 } 390 386 … … 394 390 if (!region) 395 391 return contentLogicalWidth(); 396 return isHorizontalWritingMode() ? region-> regionRect().width() : region->regionRect().height();392 return isHorizontalWritingMode() ? region->flowThreadPortionRect().width() : region->flowThreadPortionRect().height(); 397 393 } 398 394 … … 402 398 if (!region) 403 399 return 0; 404 return isHorizontalWritingMode() ? region-> regionRect().height() : region->regionRect().width();400 return isHorizontalWritingMode() ? region->flowThreadPortionRect().height() : region->flowThreadPortionRect().width(); 405 401 } 406 402 … … 411 407 return 0; 412 408 413 LayoutUnit regionLogicalBottom = isHorizontalWritingMode() ? region-> regionRect().maxY() : region->regionRect().maxX();409 LayoutUnit regionLogicalBottom = isHorizontalWritingMode() ? region->flowThreadPortionRect().maxY() : region->flowThreadPortionRect().maxX(); 414 410 LayoutUnit remainingHeight = regionLogicalBottom - position; 415 411 if (pageBoundaryRule == IncludePageBoundary) { 416 412 // If IncludePageBoundary is set, the line exactly on the top edge of a 417 413 // region will act as being part of the previous region. 418 LayoutUnit regionHeight = isHorizontalWritingMode() ? region-> regionRect().height() : region->regionRect().width();414 LayoutUnit regionHeight = isHorizontalWritingMode() ? region->flowThreadPortionRect().height() : region->flowThreadPortionRect().width(); 419 415 remainingHeight = intMod(remainingHeight, regionHeight); 420 416 } … … 439 435 return 0; 440 436 441 LayoutRect flippedRegionRect(renderRegion-> regionRect());437 LayoutRect flippedRegionRect(renderRegion->flowThreadPortionRect()); 442 438 flipForWritingMode(flippedRegionRect); 443 439 … … 547 543 if (!region->isValid()) 548 544 continue; 549 return isHorizontalWritingMode() ? region-> regionRect().x() : region->regionRect().y();545 return isHorizontalWritingMode() ? region->flowThreadPortionRect().x() : region->flowThreadPortionRect().y(); 550 546 } 551 547 ASSERT_NOT_REACHED(); … … 675 671 continue; 676 672 } 677 LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region-> regionRect().y() : region->regionRect().x());678 LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region-> regionRect().maxY() : region->regionRect().maxX());673 LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().y() : region->flowThreadPortionRect().x()); 674 LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().maxY() : region->flowThreadPortionRect().maxX()); 679 675 RenderRegion::RegionState previousState = region->regionState(); 680 676 RenderRegion::RegionState state = RenderRegion::RegionFit; -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r126859 r126895 77 77 void computeLogicalHeight(); 78 78 79 void paint IntoRegion(PaintInfo&, RenderRegion*, const LayoutPoint& paintOffset);80 bool hitTest Region(RenderRegion*, const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset);79 void paintFlowThreadPortionInRegion(PaintInfo&, RenderRegion*, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const LayoutPoint&) const; 80 bool hitTestFlowThreadPortionInRegion(RenderRegion*, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) const; 81 81 82 82 bool hasRegions() const { return m_regionList.size(); } -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp
r126603 r126895 76 76 77 77 // Our region rect determines our column count. We have as many columns as needed to fit all the content. 78 LayoutUnit logicalHeightInColumns = flowThread()->isHorizontalWritingMode() ? regionRect().height() : regionRect().width();78 LayoutUnit logicalHeightInColumns = flowThread()->isHorizontalWritingMode() ? flowThreadPortionRect().height() : flowThreadPortionRect().width(); 79 79 return ceil(static_cast<float>(logicalHeightInColumns) / computedColumnHeight()); 80 80 } … … 168 168 { 169 169 // For each rectangle, set it as the region rectangle and then let flow thread painting do the rest. 170 // We make multiple calls to paint IntoRegion, changing the rectangles each time.170 // We make multiple calls to paintFlowThreadPortionInRegion, changing the rectangles each time. 171 171 unsigned colCount = columnCount(); 172 172 if (!colCount) -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r126859 r126895 63 63 } 64 64 65 LayoutRect RenderRegion:: regionOversetRect() const65 LayoutRect RenderRegion::flowThreadPortionOverflowRect() const 66 66 { 67 67 // FIXME: Would like to just use hasOverflowClip() but we aren't a block yet. When RenderRegion is eliminated and … … 71 71 bool isLastRegionWithRegionOverflowBreak = (isLastRegion() && (style()->regionOverflow() == BreakRegionOverflow)); 72 72 if ((clipX && clipY) || !isValid() || !m_flowThread || isLastRegionWithRegionOverflowBreak) 73 return regionRect();73 return flowThreadPortionRect(); 74 74 75 75 LayoutRect flowThreadOverflow = m_flowThread->visualOverflowRect(); … … 79 79 LayoutRect clipRect; 80 80 if (m_flowThread->isHorizontalWritingMode()) { 81 LayoutUnit minY = isFirstRegion() ? (flowThreadOverflow.y() - outlineSize) : regionRect().y();82 LayoutUnit maxY = isLastRegion() ? max( regionRect().maxY(), flowThreadOverflow.maxY()) + outlineSize : regionRect().maxY();83 LayoutUnit minX = clipX ? regionRect().x() : (flowThreadOverflow.x() - outlineSize);84 LayoutUnit maxX = clipX ? regionRect().maxX() : (flowThreadOverflow.maxX() + outlineSize);81 LayoutUnit minY = isFirstRegion() ? (flowThreadOverflow.y() - outlineSize) : flowThreadPortionRect().y(); 82 LayoutUnit maxY = isLastRegion() ? max(flowThreadPortionRect().maxY(), flowThreadOverflow.maxY()) + outlineSize : flowThreadPortionRect().maxY(); 83 LayoutUnit minX = clipX ? flowThreadPortionRect().x() : (flowThreadOverflow.x() - outlineSize); 84 LayoutUnit maxX = clipX ? flowThreadPortionRect().maxX() : (flowThreadOverflow.maxX() + outlineSize); 85 85 clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY); 86 86 } else { 87 LayoutUnit minX = isFirstRegion() ? (flowThreadOverflow.x() - outlineSize) : regionRect().x();88 LayoutUnit maxX = isLastRegion() ? max( regionRect().maxX(), flowThreadOverflow.maxX()) + outlineSize : regionRect().maxX();89 LayoutUnit minY = clipY ? regionRect().y() : (flowThreadOverflow.y() - outlineSize);90 LayoutUnit maxY = clipY ? regionRect().maxY() : (flowThreadOverflow.maxY() + outlineSize);87 LayoutUnit minX = isFirstRegion() ? (flowThreadOverflow.x() - outlineSize) : flowThreadPortionRect().x(); 88 LayoutUnit maxX = isLastRegion() ? max(flowThreadPortionRect().maxX(), flowThreadOverflow.maxX()) + outlineSize : flowThreadPortionRect().maxX(); 89 LayoutUnit minY = clipY ? flowThreadPortionRect().y() : (flowThreadOverflow.y() - outlineSize); 90 LayoutUnit maxY = clipY ? flowThreadPortionRect().maxY() : (flowThreadOverflow.maxY() + outlineSize); 91 91 clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY); 92 92 } … … 114 114 115 115 setRegionObjectsRegionStyle(); 116 m_flowThread->paint IntoRegion(paintInfo, this, LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop()));116 m_flowThread->paintFlowThreadPortionInRegion(paintInfo, this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop())); 117 117 restoreRegionObjectsOriginalStyle(); 118 118 } … … 132 132 if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) { 133 133 // Check the contents of the RenderFlowThread. 134 if (m_flowThread && m_flowThread->hitTest Region(this, request, result, locationInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop())))134 if (m_flowThread && m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result, locationInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop()))) 135 135 return true; 136 136 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); … … 173 173 RenderReplaced::layout(); 174 174 if (m_flowThread && isValid()) { 175 LayoutRect oldRegionRect( regionRect());175 LayoutRect oldRegionRect(flowThreadPortionRect()); 176 176 if (!isHorizontalWritingMode()) 177 177 oldRegionRect = oldRegionRect.transposedRect(); … … 288 288 return 0; 289 289 if (m_flowThread->isHorizontalWritingMode()) 290 return regionRect().y();291 return regionRect().x();290 return flowThreadPortionRect().y(); 291 return flowThreadPortionRect().x(); 292 292 } 293 293 -
trunk/Source/WebCore/rendering/RenderRegion.h
r126859 r126895 52 52 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 53 53 54 void set RegionRect(const LayoutRect& rect) { m_regionRect = rect; }55 LayoutRect regionRect() const { return m_regionRect; }56 LayoutRect regionOversetRect() const;54 void setFlowThreadPortionRect(const LayoutRect& rect) { m_flowThreadPortionRect = rect; } 55 LayoutRect flowThreadPortionRect() const { return m_flowThreadPortionRect; } 56 LayoutRect flowThreadPortionOverflowRect() const; 57 57 58 58 void attachRegion(); … … 128 128 // regions is always done before the regions themselves. 129 129 RenderNamedFlowThread* m_parentNamedFlowThread; 130 LayoutRect m_ regionRect;130 LayoutRect m_flowThreadPortionRect; 131 131 132 132 // This map holds unique information about a block that is split across regions. -
trunk/Source/WebCore/rendering/RenderRegionSet.cpp
r126602 r126895 47 47 // of the flow thread content. This is because it is always capable of generating an 48 48 // infinite number of boxes in order to hold all of the remaining content. 49 LayoutRect rect( regionRect());49 LayoutRect rect(flowThreadPortionRect()); 50 50 51 51 // Get the offset within the flow thread in its block progression direction. Then get the … … 58 58 LayoutRect layoutRect = flowThread()->layoutOverflowRect(); 59 59 LayoutUnit logicalHeightWithOverflow = (isHorizontal ? layoutRect.maxY() - flowThread()->y() : layoutRect.maxX() - flowThread()->x()) - logicalTopOffset; 60 set RegionRect(LayoutRect(rect.x(), rect.y(), isHorizontal ? rect.width() : logicalHeightWithOverflow, isHorizontal ? logicalHeightWithOverflow : rect.height()));60 setFlowThreadPortionRect(LayoutRect(rect.x(), rect.y(), isHorizontal ? rect.width() : logicalHeightWithOverflow, isHorizontal ? logicalHeightWithOverflow : rect.height())); 61 61 } 62 62
Note:
See TracChangeset
for help on using the changeset viewer.