Changeset 88172 in webkit
- Timestamp:
- Jun 6, 2011 10:50:03 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r88166 r88172 1 2011-06-03 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch paintFloats, paintChildren, and paintEllipsisBoxes to use IntPoint 6 https://bugs.webkit.org/show_bug.cgi?id=62058 7 8 Switching paintFloats, paintChildren, and paintEllipsisBoxes to take IntPoints representing 9 their paint offsets instead of pairs of ints. 10 11 No new tests since this is simple refactoring. 12 13 * rendering/RenderBlock.cpp: 14 (WebCore::RenderBlock::paintColumnContents): 15 (WebCore::RenderBlock::paintContents): 16 (WebCore::RenderBlock::paintChildren): 17 (WebCore::RenderBlock::paintObject): 18 (WebCore::RenderBlock::paintFloats): 19 (WebCore::RenderBlock::paintEllipsisBoxes): 20 * rendering/RenderBlock.h: 21 1 22 2011-06-06 Steve Block <steveblock@google.com> 2 23 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r88122 r88172 2352 2352 int finalY = ty + offset.height(); 2353 2353 if (paintingFloats) 2354 paintFloats(info, finalX, finalY, paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);2354 paintFloats(info, IntPoint(finalX, finalY), paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip); 2355 2355 else 2356 2356 paintContents(info, finalX, finalY); … … 2376 2376 m_lineBoxes.paint(this, paintInfo, tx, ty); 2377 2377 else 2378 paintChildren(paintInfo, tx, ty);2379 } 2380 2381 void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)2378 paintChildren(paintInfo, IntPoint(tx, ty)); 2379 } 2380 2381 void RenderBlock::paintChildren(PaintInfo& paintInfo, const IntPoint& paintOffset) 2382 2382 { 2383 2383 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPhaseOutline : paintInfo.phase; … … 2397 2397 // Check for page-break-before: always, and if it's set, break and bail. 2398 2398 bool checkBeforeAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakBefore() == PBALWAYS); 2399 int absoluteChildY = paintOffset.y() + child->y(); 2399 2400 if (checkBeforeAlways 2400 && (ty + child->y())> paintInfo.rect.y()2401 && (ty + child->y())< paintInfo.rect.maxY()) {2402 view()->setBestTruncatedAt( ty + child->y(), this, true);2401 && absoluteChildY > paintInfo.rect.y() 2402 && absoluteChildY < paintInfo.rect.maxY()) { 2403 view()->setBestTruncatedAt(absoluteChildY, this, true); 2403 2404 return; 2404 2405 } … … 2406 2407 if (!child->isFloating() && child->isReplaced() && usePrintRect && child->height() <= renderView->printRect().height()) { 2407 2408 // Paginate block-level replaced elements. 2408 if ( ty + child->y()+ child->height() > renderView->printRect().maxY()) {2409 if ( ty + child->y()< renderView->truncatedAt())2410 renderView->setBestTruncatedAt( ty + child->y(), child);2409 if (absoluteChildY + child->height() > renderView->printRect().maxY()) { 2410 if (absoluteChildY < renderView->truncatedAt()) 2411 renderView->setBestTruncatedAt(absoluteChildY, child); 2411 2412 // If we were able to truncate, don't paint. 2412 if ( ty + child->y()>= renderView->truncatedAt())2413 if (absoluteChildY >= renderView->truncatedAt()) 2413 2414 break; 2414 2415 } 2415 2416 } 2416 2417 2417 IntPoint childPoint = flipForWritingMode(child, IntPoint(tx, ty), ParentToChildFlippingAdjustment);2418 IntPoint childPoint = flipForWritingMode(child, paintOffset, ParentToChildFlippingAdjustment); 2418 2419 if (!child->hasSelfPaintingLayer() && !child->isFloating()) 2419 2420 child->paint(info, childPoint.x(), childPoint.y()); … … 2422 2423 bool checkAfterAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakAfter() == PBALWAYS); 2423 2424 if (checkAfterAlways 2424 && ( ty + child->y()+ child->height()) > paintInfo.rect.y()2425 && ( ty + child->y()+ child->height()) < paintInfo.rect.maxY()) {2426 view()->setBestTruncatedAt( ty + child->y()+ child->height() + max(0, child->collapsedMarginAfter()), this, true);2425 && (absoluteChildY + child->height()) > paintInfo.rect.y() 2426 && (absoluteChildY + child->height()) < paintInfo.rect.maxY()) { 2427 view()->setBestTruncatedAt(absoluteChildY + child->height() + max(0, child->collapsedMarginAfter()), this, true); 2427 2428 return; 2428 2429 } … … 2502 2503 paintColumnContents(paintInfo, scrolledOffset.x(), scrolledOffset.y(), true); 2503 2504 else 2504 paintFloats(paintInfo, scrolledOffset .x(), scrolledOffset.y(), paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);2505 paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip); 2505 2506 } 2506 2507 … … 2555 2556 } 2556 2557 2557 void RenderBlock::paintFloats(PaintInfo& paintInfo, int tx, int ty, bool preservePhase)2558 void RenderBlock::paintFloats(PaintInfo& paintInfo, const IntPoint& paintOffset, bool preservePhase) 2558 2559 { 2559 2560 if (!m_floatingObjects) … … 2568 2569 PaintInfo currentPaintInfo(paintInfo); 2569 2570 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; 2570 IntPoint childPoint = flipFloatForWritingMode(r, IntPoint( tx + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), ty+ yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));2571 IntPoint childPoint = flipFloatForWritingMode(r, IntPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y())); 2571 2572 r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y()); 2572 2573 if (!preservePhase) { … … 2584 2585 } 2585 2586 2586 void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty)2587 void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, const IntPoint& paintOffset) 2587 2588 { 2588 2589 if (!paintInfo.shouldPaintWithinRoot(this) || !firstLineBox()) … … 2592 2593 // We can check the first box and last box and avoid painting if we don't 2593 2594 // intersect. 2594 int yPos = ty+ firstLineBox()->y();2595 int yPos = paintOffset.y() + firstLineBox()->y(); 2595 2596 int h = lastLineBox()->y() + lastLineBox()->logicalHeight() - firstLineBox()->y(); 2596 2597 if (yPos >= paintInfo.rect.maxY() || yPos + h <= paintInfo.rect.y()) … … 2601 2602 // based off positions of our first line box or our last line box. 2602 2603 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { 2603 yPos = ty+ curr->y();2604 yPos = paintOffset.y() + curr->y(); 2604 2605 h = curr->logicalHeight(); 2605 2606 if (curr->ellipsisBox() && yPos < paintInfo.rect.maxY() && yPos + h > paintInfo.rect.y()) 2606 curr->paintEllipsisBox(paintInfo, IntPoint(tx, ty), curr->lineTop(), curr->lineBottom());2607 curr->paintEllipsisBox(paintInfo, paintOffset, curr->lineTop(), curr->lineBottom()); 2607 2608 } 2608 2609 } -
trunk/Source/WebCore/rendering/RenderBlock.h
r88087 r88172 560 560 // End of functions defined in RenderBlockLineLayout.cpp. 561 561 562 void paintFloats(PaintInfo&, int tx, int ty, bool preservePhase = false);562 void paintFloats(PaintInfo&, const IntPoint&, bool preservePhase = false); 563 563 void paintContents(PaintInfo&, int tx, int ty); 564 564 void paintColumnContents(PaintInfo&, int tx, int ty, bool paintFloats = false); 565 565 void paintColumnRules(PaintInfo&, int tx, int ty); 566 void paintChildren(PaintInfo&, int tx, int ty);567 void paintEllipsisBoxes(PaintInfo&, int tx, int ty);566 void paintChildren(PaintInfo&, const IntPoint&); 567 void paintEllipsisBoxes(PaintInfo&, const IntPoint&); 568 568 void paintSelection(PaintInfo&, int tx, int ty); 569 569 void paintCaret(PaintInfo&, const IntPoint&, CaretType);
Note: See TracChangeset
for help on using the changeset viewer.