Changeset 87753 in webkit
- Timestamp:
- May 31, 2011 2:55:41 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87752 r87753 1 2011-05-31 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Simon Fraser. 4 5 Change InlineBox::paint and its overloaded variants to use IntPoint 6 https://bugs.webkit.org/show_bug.cgi?id=61804 7 8 Changing InlineBox::paint, its 7 overloaded variants, and RootInlineBox::paintEllipsisBox 9 to use IntPoint for their paint offset instead of a pair of ints. 10 11 No new tests since this is just a refactoring. 12 13 * rendering/EllipsisBox.cpp: 14 (WebCore::EllipsisBox::paint): 15 * rendering/EllipsisBox.h: 16 * rendering/InlineBox.cpp: 17 (WebCore::InlineBox::paint): 18 * rendering/InlineBox.h: 19 * rendering/InlineFlowBox.cpp: 20 (WebCore::InlineFlowBox::paint): 21 * rendering/InlineFlowBox.h: 22 * rendering/InlineTextBox.cpp: 23 (WebCore::InlineTextBox::paint): 24 * rendering/InlineTextBox.h: 25 * rendering/RenderBlock.cpp: 26 (WebCore::RenderBlock::paintEllipsisBoxes): 27 * rendering/RenderBoxModelObject.cpp: 28 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 29 * rendering/RenderLineBoxList.cpp: 30 (WebCore::RenderLineBoxList::paint): 31 * rendering/RootInlineBox.cpp: 32 (WebCore::RootInlineBox::paintEllipsisBox): 33 (WebCore::RootInlineBox::paint): 34 * rendering/RootInlineBox.h: 35 * rendering/svg/SVGInlineFlowBox.cpp: 36 (WebCore::SVGInlineFlowBox::paint): 37 * rendering/svg/SVGInlineFlowBox.h: 38 * rendering/svg/SVGInlineTextBox.cpp: 39 (WebCore::SVGInlineTextBox::paint): 40 * rendering/svg/SVGInlineTextBox.h: 41 * rendering/svg/SVGRootInlineBox.cpp: 42 (WebCore::SVGRootInlineBox::paint): 43 * rendering/svg/SVGRootInlineBox.h: 44 1 45 2011-05-31 James Robinson <jamesr@chromium.org> 2 46 -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r87152 r87753 31 31 namespace WebCore { 32 32 33 void EllipsisBox::paint(PaintInfo& paintInfo, int tx, int ty, int lineTop, int lineBottom)33 void EllipsisBox::paint(PaintInfo& paintInfo, const IntPoint& paintOffset, int lineTop, int lineBottom) 34 34 { 35 35 GraphicsContext* context = paintInfo.context; … … 47 47 const Font& font = style->font(); 48 48 if (selectionState() != RenderObject::SelectionNone) { 49 paintSelection(context, tx, ty, style, font);49 paintSelection(context, paintOffset.x(), paintOffset.y(), style, font); 50 50 51 51 // Select the correct color for painting the text. … … 56 56 57 57 // FIXME: Why is this always LTR? Fix by passing correct text run flags below. 58 context->drawText(font, RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(m_x + tx, m_y + ty+ style->fontMetrics().ascent()));58 context->drawText(font, RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(m_x + paintOffset.x(), m_y + paintOffset.y() + style->fontMetrics().ascent())); 59 59 60 60 // Restore the regular fill color. … … 67 67 if (m_markupBox) { 68 68 // Paint the markup box 69 tx += m_x + m_logicalWidth - m_markupBox->x(); 70 ty += m_y + style->fontMetrics().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(m_firstLine)->fontMetrics().ascent()); 71 m_markupBox->paint(paintInfo, tx, ty, lineTop, lineBottom); 69 IntPoint adjustedPaintOffset = paintOffset; 70 adjustedPaintOffset.move(m_x + m_logicalWidth - m_markupBox->x(), 71 m_y + style->fontMetrics().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(m_firstLine)->fontMetrics().ascent())); 72 m_markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); 72 73 } 73 74 } -
trunk/Source/WebCore/rendering/EllipsisBox.h
r86705 r87753 40 40 } 41 41 42 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);42 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 43 43 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, int lineTop, int lineBottom); 44 44 void setSelectionState(RenderObject::SelectionState s) { m_selectionState = s; } -
trunk/Source/WebCore/rendering/InlineBox.cpp
r86705 r87753 194 194 } 195 195 196 void InlineBox::paint(PaintInfo& paintInfo, int tx, int ty, int /* lineTop */, int /*lineBottom*/)196 void InlineBox::paint(PaintInfo& paintInfo, const IntPoint& paintOffset, int /* lineTop */, int /*lineBottom*/) 197 197 { 198 198 if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 199 199 return; 200 200 201 IntPoint childPoint = IntPoint(tx, ty);201 IntPoint childPoint = paintOffset; 202 202 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock(). 203 203 childPoint = renderer()->containingBlock()->flipForWritingMode(toRenderBox(renderer()), childPoint, RenderBox::ParentToChildFlippingAdjustment); -
trunk/Source/WebCore/rendering/InlineBox.h
r86705 r87753 130 130 } 131 131 132 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);132 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 133 133 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, int lineTop, int lineBottom); 134 134 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r87018 r87753 947 947 } 948 948 949 void InlineFlowBox::paint(PaintInfo& paintInfo, int tx, int ty, int lineTop, int lineBottom)949 void InlineFlowBox::paint(PaintInfo& paintInfo, const IntPoint& paintOffset, int lineTop, int lineBottom) 950 950 { 951 951 IntRect overflowRect(visualOverflowRect(lineTop, lineBottom)); 952 952 overflowRect.inflate(renderer()->maximalOutlineSize(paintInfo.phase)); 953 953 flipForWritingMode(overflowRect); 954 overflowRect.move( tx, ty);954 overflowRect.move(paintOffset); 955 955 956 956 if (!paintInfo.rect.intersects(overflowRect)) … … 992 992 } 993 993 } else if (paintInfo.phase == PaintPhaseMask) { 994 paintMask(paintInfo, tx, ty);994 paintMask(paintInfo, paintOffset.x(), paintOffset.y()); 995 995 return; 996 996 } else { 997 997 // Paint our background, border and box-shadow. 998 paintBoxDecorations(paintInfo, tx, ty);998 paintBoxDecorations(paintInfo, paintOffset.x(), paintOffset.y()); 999 999 } 1000 1000 } … … 1012 1012 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1013 1013 if (curr->renderer()->isText() || !curr->boxModelObject()->hasSelfPaintingLayer()) 1014 curr->paint(childInfo, tx, ty, lineTop, lineBottom);1014 curr->paint(childInfo, paintOffset, lineTop, lineBottom); 1015 1015 } 1016 1016 } -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r86705 r87753 109 109 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver); 110 110 void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const IntRect&); 111 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);111 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 112 112 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, int lineTop, int lineBottom); 113 113 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r87687 r87753 464 464 } 465 465 466 void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty, int /*lineTop*/, int /*lineBottom*/)466 void InlineTextBox::paint(PaintInfo& paintInfo, const IntPoint& paintOffset, int /*lineTop*/, int /*lineBottom*/) 467 467 { 468 468 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || … … 474 474 int logicalLeftSide = logicalLeftVisualOverflow(); 475 475 int logicalRightSide = logicalRightVisualOverflow(); 476 int logicalStart = logicalLeftSide + (isHorizontal() ? tx : ty);476 int logicalStart = logicalLeftSide + (isHorizontal() ? paintOffset.x() : paintOffset.y()); 477 477 int logicalExtent = logicalRightSide - logicalLeftSide; 478 478 479 479 int paintEnd = isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rect.maxY(); 480 480 int paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect.y(); 481 482 IntPoint adjustedPaintOffset = paintOffset; 481 483 482 484 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) … … 504 506 int widthOfHiddenText = m_logicalWidth - widthOfVisibleText; 505 507 // FIXME: The hit testing logic also needs to take this translation int account. 506 if (isHorizontal()) 507 tx += isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText; 508 else 509 ty += isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText; 508 IntSize truncationOffset(isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText, 0); 509 adjustedPaintOffset.move(isHorizontal() ? truncationOffset : truncationOffset.transposedSize()); 510 510 } 511 511 } … … 515 515 RenderStyle* styleToUse = renderer()->style(m_firstLine); 516 516 517 ty -= styleToUse->isHorizontalWritingMode() ? 0 : logicalHeight();517 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? 0 : -logicalHeight()); 518 518 519 519 FloatPoint boxOrigin = locationIncludingFlipping(); 520 boxOrigin.move( tx, ty);520 boxOrigin.move(adjustedPaintOffset.x(), adjustedPaintOffset.y()); 521 521 FloatRect boxRect(boxOrigin, IntSize(logicalWidth(), logicalHeight())); 522 522 … … 545 545 // Custom highlighters go behind everything else. 546 546 if (styleToUse->highlight() != nullAtom && !context->paintingDisabled()) 547 paintCustomHighlight( tx, ty, styleToUse->highlight());547 paintCustomHighlight(adjustedPaintOffset.x(), adjustedPaintOffset.y(), styleToUse->highlight()); 548 548 #endif 549 549 -
trunk/Source/WebCore/rendering/InlineTextBox.h
r87483 r87753 111 111 112 112 protected: 113 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);113 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 114 114 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, int lineTop, int lineBottom); 115 115 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r87443 r87753 2609 2609 h = curr->logicalHeight(); 2610 2610 if (curr->ellipsisBox() && yPos < paintInfo.rect.maxY() && yPos + h > paintInfo.rect.y()) 2611 curr->paintEllipsisBox(paintInfo, tx, ty, curr->lineTop(), curr->lineBottom());2611 curr->paintEllipsisBox(paintInfo, IntPoint(tx, ty), curr->lineTop(), curr->lineBottom()); 2612 2612 } 2613 2613 } -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r87121 r87753 695 695 if (box) { 696 696 RootInlineBox* root = box->root(); 697 box->paint(info, scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y(), root->lineTop(), root->lineBottom());697 box->paint(info, IntPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom()); 698 698 } else { 699 699 int x = isBox() ? toRenderBox(this)->x() : 0; -
trunk/Source/WebCore/rendering/RenderLineBoxList.cpp
r87019 r87753 260 260 if (lineIntersectsDirtyRect(renderer, curr, info, tx, ty)) { 261 261 RootInlineBox* root = curr->root(); 262 curr->paint(info, tx, ty, root->lineTop(), root->lineBottom());262 curr->paint(info, IntPoint(tx, ty), root->lineTop(), root->lineBottom()); 263 263 } 264 264 } -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r86705 r87753 134 134 } 135 135 136 void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, int tx, int ty, int lineTop, int lineBottom) const136 void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, const IntPoint& paintOffset, int lineTop, int lineBottom) const 137 137 { 138 138 if (hasEllipsisBox() && paintInfo.shouldPaintWithinRoot(renderer()) && renderer()->style()->visibility() == VISIBLE 139 139 && paintInfo.phase == PaintPhaseForeground) 140 ellipsisBox()->paint(paintInfo, tx, ty, lineTop, lineBottom);140 ellipsisBox()->paint(paintInfo, paintOffset, lineTop, lineBottom); 141 141 } 142 142 … … 179 179 #endif 180 180 181 void RootInlineBox::paint(PaintInfo& paintInfo, int tx, int ty, int lineTop, int lineBottom)182 { 183 InlineFlowBox::paint(paintInfo, tx, ty, lineTop, lineBottom);184 paintEllipsisBox(paintInfo, tx, ty, lineTop, lineBottom);181 void RootInlineBox::paint(PaintInfo& paintInfo, const IntPoint& paintOffset, int lineTop, int lineBottom) 182 { 183 InlineFlowBox::paint(paintInfo, paintOffset, lineTop, lineBottom); 184 paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom); 185 185 #if PLATFORM(MAC) 186 186 RenderStyle* styleToUse = renderer()->style(m_firstLine); 187 187 if (styleToUse->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 188 paintCustomHighlight(paintInfo, tx, ty, styleToUse->highlight());188 paintCustomHighlight(paintInfo, paintOffset.x(), paintOffset.y(), styleToUse->highlight()); 189 189 #endif 190 190 } -
trunk/Source/WebCore/rendering/RootInlineBox.h
r86705 r87753 84 84 EllipsisBox* ellipsisBox() const; 85 85 86 void paintEllipsisBox(PaintInfo&, int tx, int ty, int lineTop, int lineBottom) const;86 void paintEllipsisBox(PaintInfo&, const IntPoint&, int lineTop, int lineBottom) const; 87 87 88 88 virtual void clearTruncation(); … … 96 96 #endif 97 97 98 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);98 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 99 99 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, int tx, int ty, int lineTop, int lineBottom); 100 100 -
trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
r87483 r87753 50 50 } 51 51 52 void SVGInlineFlowBox::paint(PaintInfo& paintInfo, int, int, int, int)52 void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const IntPoint&, int, int) 53 53 { 54 54 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); … … 66 66 computeTextMatchMarkerRectForRenderer(toRenderSVGInlineText(static_cast<SVGInlineTextBox*>(child)->textRenderer())); 67 67 68 child->paint(childPaintInfo, 0, 0, 0, 0);68 child->paint(childPaintInfo, IntPoint(), 0, 0); 69 69 } 70 70 } -
trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.h
r82611 r87753 42 42 43 43 void paintSelectionBackground(PaintInfo&); 44 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);44 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 45 45 46 46 virtual IntRect calculateBoundaries() const; -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r87152 r87753 241 241 } 242 242 243 void SVGInlineTextBox::paint(PaintInfo& paintInfo, int, int, int, int)243 void SVGInlineTextBox::paint(PaintInfo& paintInfo, const IntPoint&, int, int) 244 244 { 245 245 ASSERT(paintInfo.shouldPaintWithinRoot(renderer())); -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h
r82611 r87753 47 47 48 48 void paintSelectionBackground(PaintInfo&); 49 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);49 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 50 50 virtual IntRect selectionRect(int absx, int absy, int startPosition, int endPosition); 51 51 -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
r86927 r87753 37 37 namespace WebCore { 38 38 39 void SVGRootInlineBox::paint(PaintInfo& paintInfo, int, int, int, int)39 void SVGRootInlineBox::paint(PaintInfo& paintInfo, const IntPoint&, int, int) 40 40 { 41 41 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); … … 65 65 SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(toRenderSVGInlineText(static_cast<SVGInlineTextBox*>(child)->textRenderer())); 66 66 67 child->paint(childPaintInfo, 0, 0, 0, 0);67 child->paint(childPaintInfo, IntPoint(), 0, 0); 68 68 } 69 69 } -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h
r86927 r87753 46 46 void setLogicalHeight(int height) { m_logicalHeight = height; } 47 47 48 virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);48 virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom); 49 49 50 50 void computePerCharacterLayoutInformation();
Note: See TracChangeset
for help on using the changeset viewer.