Changeset 91417 in webkit
- Timestamp:
- Jul 20, 2011 4:18:27 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r91416 r91417 1 2011-07-20 Levi Weintraub <leviw@chromium.org> 2 3 Bring Int/Float graphics classes closer to parity 4 https://bugs.webkit.org/show_bug.cgi?id=64833 5 6 Reviewed by James Robinson. 7 8 In preparation of switching to Floating point data structures, bringing the 9 functionality and method names of the Int/Float graphics classes close together. 10 11 Also fixing some compiler errors when using Floats for layout units along the way. 12 13 No new tests, no functionality change. 14 15 * page/FrameView.cpp: 16 (WebCore::FrameView::convertFromRenderer): 17 * platform/ScrollView.cpp: 18 (WebCore::ScrollView::wheelEvent): 19 * platform/ScrollView.h: 20 (WebCore::ScrollView::convertChildToSelf): 21 (WebCore::ScrollView::convertSelfToChild): 22 * platform/graphics/FloatPoint.h: 23 (WebCore::operator-): Adding a single-parameter version. 24 * platform/graphics/FloatSize.cpp: 25 (WebCore::FloatSize::isZero): Adding isZero that uses epsilon for floats. 26 * platform/graphics/FloatSize.h: 27 * platform/graphics/IntPoint.h: 28 (WebCore::IntPoint::moveBy): Renaming IntPoint version to moveBy to mirror FloatPoint. 29 * platform/graphics/RoundedRect.cpp: 30 (WebCore::RoundedRect::Radii::expand): Switching to specific templatized max. 31 * platform/graphics/filters/FilterEffect.cpp: 32 (WebCore::FilterEffect::requestedRegionOfInputImageData): 33 * rendering/RenderBlock.cpp: Moving outstanding Int* functions to Layout units. 34 (WebCore::RenderBlock::paintContinuationOutlines): 35 (WebCore::RenderBlock::logicalRectToPhysicalRect): 36 * rendering/RenderBlock.h: 37 * rendering/RenderBox.cpp: 38 (WebCore::RenderBox::positionForPoint): 39 * rendering/RenderTable.cpp: 40 (WebCore::RenderTable::subtractCaptionRect): 41 * rendering/RenderTable.h: 42 * rendering/RenderTableCell.cpp: 43 (WebCore::RenderTableCell::styleOrColLogicalWidth): 44 (WebCore::RenderTableCell::setOverrideSizeFromRowHeight): 45 (WebCore::RenderTableCell::paintCollapsedBorder): 46 (WebCore::RenderTableCell::paintBackgroundsBehindCell): 47 * rendering/RenderTableCell.h: 48 * rendering/RenderView.h: 49 (WebCore::RenderView::pushLayoutState): 50 (WebCore::LayoutStateMaintainer::LayoutStateMaintainer): 51 (WebCore::LayoutStateMaintainer::push): 52 * rendering/RootInlineBox.cpp: 53 (WebCore::RootInlineBox::paddedLayoutOverflowRect): 54 (WebCore::setAscentAndDescent): 55 * rendering/RootInlineBox.h: 56 1 57 2011-07-20 Scott Graham <scottmg@chromium.org> 2 58 -
trunk/Source/WebCore/page/FrameView.cpp
r91314 r91417 2704 2704 2705 2705 // Convert from page ("absolute") to FrameView coordinates. 2706 point.move (-scrollPosition());2706 point.moveBy(-scrollPosition()); 2707 2707 return point; 2708 2708 } -
trunk/Source/WebCore/platform/ScrollView.cpp
r91146 r91417 1143 1143 // Scrollbars won't be transformed within us 1144 1144 IntPoint newPoint = localPoint; 1145 newPoint.move (scrollbar->location());1145 newPoint.moveBy(scrollbar->location()); 1146 1146 return newPoint; 1147 1147 } … … 1151 1151 IntPoint newPoint = parentPoint; 1152 1152 // Scrollbars won't be transformed within us 1153 newPoint.move (-scrollbar->location());1153 newPoint.moveBy(-scrollbar->location()); 1154 1154 return newPoint; 1155 1155 } -
trunk/Source/WebCore/platform/ScrollView.h
r91064 r91417 244 244 if (!isScrollViewScrollbar(child)) 245 245 newPoint = point - scrollOffset(); 246 newPoint.move (child->location());246 newPoint.moveBy(child->location()); 247 247 return newPoint; 248 248 } … … 253 253 if (!isScrollViewScrollbar(child)) 254 254 newPoint = point + scrollOffset(); 255 newPoint.move (-child->location());255 newPoint.moveBy(-child->location()); 256 256 return newPoint; 257 257 } -
trunk/Source/WebCore/platform/graphics/FloatPoint.h
r90517 r91417 213 213 } 214 214 215 inline FloatPoint operator-(const FloatPoint& a) 216 { 217 return FloatPoint(-a.x(), -a.y()); 218 } 219 215 220 inline bool operator==(const FloatPoint& a, const FloatPoint& b) 216 221 { -
trunk/Source/WebCore/platform/graphics/FloatSize.cpp
r66560 r91417 30 30 #include "FloatConversion.h" 31 31 #include "IntSize.h" 32 #include <limits> 32 33 #include <math.h> 34 35 using namespace std; 33 36 34 37 namespace WebCore { … … 43 46 } 44 47 48 bool FloatSize::isZero() const 49 { 50 return fabs(m_width) < numeric_limits<float>::epsilon() && fabs(m_height) < numeric_limits<float>::epsilon(); 51 } 52 45 53 FloatSize FloatSize::narrowPrecision(double width, double height) 46 54 { -
trunk/Source/WebCore/platform/graphics/FloatSize.h
r90167 r91417 63 63 64 64 bool isEmpty() const { return m_width <= 0 || m_height <= 0; } 65 bool isZero() const; 65 66 66 67 float aspectRatio() const { return m_width / m_height; } -
trunk/Source/WebCore/platform/graphics/IntPoint.h
r90167 r91417 92 92 93 93 void move(const IntSize& s) { move(s.width(), s.height()); } 94 void move (const IntPoint& offset) { move(offset.x(), offset.y()); }94 void moveBy(const IntPoint& offset) { move(offset.x(), offset.y()); } 95 95 void move(int dx, int dy) { m_x += dx; m_y += dy; } 96 96 void scale(float sx, float sy) -
trunk/Source/WebCore/platform/graphics/RoundedRect.cpp
r90832 r91417 62 62 void RoundedRect::Radii::expand(LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth) 63 63 { 64 m_topLeft.setWidth(max (0, m_topLeft.width() + leftWidth));65 m_topLeft.setHeight(max (0, m_topLeft.height() + topWidth));64 m_topLeft.setWidth(max<LayoutUnit>(0, m_topLeft.width() + leftWidth)); 65 m_topLeft.setHeight(max<LayoutUnit>(0, m_topLeft.height() + topWidth)); 66 66 67 m_topRight.setWidth(max (0, m_topRight.width() + rightWidth));68 m_topRight.setHeight(max (0, m_topRight.height() + topWidth));67 m_topRight.setWidth(max<LayoutUnit>(0, m_topRight.width() + rightWidth)); 68 m_topRight.setHeight(max<LayoutUnit>(0, m_topRight.height() + topWidth)); 69 69 70 m_bottomLeft.setWidth(max (0, m_bottomLeft.width() + leftWidth));71 m_bottomLeft.setHeight(max (0, m_bottomLeft.height() + bottomWidth));70 m_bottomLeft.setWidth(max<LayoutUnit>(0, m_bottomLeft.width() + leftWidth)); 71 m_bottomLeft.setHeight(max<LayoutUnit>(0, m_bottomLeft.height() + bottomWidth)); 72 72 73 m_bottomRight.setWidth(max (0, m_bottomRight.width() + rightWidth));74 m_bottomRight.setHeight(max (0, m_bottomRight.height() + bottomWidth));73 m_bottomRight.setWidth(max<LayoutUnit>(0, m_bottomRight.width() + rightWidth)); 74 m_bottomRight.setHeight(max<LayoutUnit>(0, m_bottomRight.height() + bottomWidth)); 75 75 } 76 76 -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp
r87303 r91417 70 70 ASSERT(hasResult()); 71 71 IntPoint location = m_absolutePaintRect.location(); 72 location.move (-effectRect.location());72 location.moveBy(-effectRect.location()); 73 73 return IntRect(location, m_absolutePaintRect.size()); 74 74 } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90869 r91417 2702 2702 RenderBlock* block = flow->containingBlock(); 2703 2703 for ( ; block && block != this; block = block->containingBlock()) 2704 accumulatedPaintOffset.move (block->location());2704 accumulatedPaintOffset.moveBy(block->location()); 2705 2705 ASSERT(block); 2706 2706 flow->paintOutline(info.context, accumulatedPaintOffset); … … 2808 2808 } 2809 2809 2810 IntRect RenderBlock::logicalRectToPhysicalRect(const IntPoint& rootBlockPhysicalPosition, const IntRect& logicalRect)2811 { 2812 IntRect result;2810 LayoutRect RenderBlock::logicalRectToPhysicalRect(const LayoutPoint& rootBlockPhysicalPosition, const LayoutRect& logicalRect) 2811 { 2812 LayoutRect result; 2813 2813 if (isHorizontalWritingMode()) 2814 2814 result = logicalRect; 2815 2815 else 2816 result = IntRect(logicalRect.y(), logicalRect.x(), logicalRect.height(), logicalRect.width());2816 result = LayoutRect(logicalRect.y(), logicalRect.x(), logicalRect.height(), logicalRect.width()); 2817 2817 flipForWritingMode(result); 2818 2818 result.moveBy(rootBlockPhysicalPosition); -
trunk/Source/WebCore/rendering/RenderBlock.h
r91057 r91417 142 142 RenderObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo*); 143 143 void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap); 144 IntRect logicalRectToPhysicalRect(const IntPoint& physicalPosition, const IntRect& logicalRect);144 LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, const LayoutRect& logicalRect); 145 145 146 146 // Helper methods for computing line counts and heights for line counts. -
trunk/Source/WebCore/rendering/RenderBox.cpp
r91386 r91417 3121 3121 LayoutPoint adjustedPoint = point; 3122 3122 if (isTableRow()) 3123 adjustedPoint.move (location());3123 adjustedPoint.moveBy(location()); 3124 3124 3125 3125 for (RenderObject* renderObject = firstChild(); renderObject; renderObject = renderObject->nextSibling()) { -
trunk/Source/WebCore/rendering/RenderTable.cpp
r91090 r91417 532 532 } 533 533 534 void RenderTable::subtractCaptionRect( IntRect& rect) const534 void RenderTable::subtractCaptionRect(LayoutRect& rect) const 535 535 { 536 536 if (!m_caption) 537 537 return; 538 538 539 int captionLogicalHeight = m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter();539 LayoutUnit captionLogicalHeight = m_caption->logicalHeight() + m_caption->marginBefore() + m_caption->marginAfter(); 540 540 bool captionIsBefore = (m_caption->style()->captionSide() != CAPBOTTOM) ^ style()->isFlippedBlocksWritingMode(); 541 541 if (style()->isHorizontalWritingMode()) { -
trunk/Source/WebCore/rendering/RenderTable.h
r90955 r91417 217 217 virtual void paint(PaintInfo&, const LayoutPoint&); 218 218 virtual void paintObject(PaintInfo&, const LayoutPoint&); 219 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);220 virtual void paintMask(PaintInfo&, const IntPoint&);219 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); 220 virtual void paintMask(PaintInfo&, const LayoutPoint&); 221 221 virtual void layout(); 222 222 virtual void computePreferredLogicalWidths(); … … 236 236 virtual void addOverflowFromChildren(); 237 237 238 void subtractCaptionRect( IntRect&) const;238 void subtractCaptionRect(LayoutRect&) const; 239 239 240 240 void recalcCaption(RenderBlock*) const; -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r91090 r91417 116 116 // See Bugzilla bug 8126 for details. 117 117 if (colWidthSum.isFixed() && colWidthSum.value() > 0) 118 colWidthSum = Length(max (0, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed);118 colWidthSum = Length(max<LayoutUnit>(0, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed); 119 119 return colWidthSum; 120 120 } … … 216 216 { 217 217 clearIntrinsicPadding(); 218 RenderBlock::setOverrideSize(LayoutSize(0, max (0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter())));218 RenderBlock::setOverrideSize(LayoutSize(0, max<LayoutUnit>(0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter()))); 219 219 } 220 220 … … 913 913 } 914 914 915 void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, const IntRect& paintRect)915 void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, const LayoutRect& paintRect) 916 916 { 917 917 if (!table()->currentBorderStyle() || graphicsContext->paintingDisabled()) … … 979 979 LayoutPoint adjustedPaintOffset = paintOffset; 980 980 if (backgroundObject != this) 981 adjustedPaintOffset.move (location());981 adjustedPaintOffset.moveBy(location()); 982 982 983 983 Color c = backgroundObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); -
trunk/Source/WebCore/rendering/RenderTableCell.h
r90955 r91417 97 97 virtual void paint(PaintInfo&, const LayoutPoint&); 98 98 99 void paintBackgroundsBehindCell(PaintInfo&, const IntPoint&, RenderObject* backgroundObject);99 void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject* backgroundObject); 100 100 101 101 int cellBaselinePosition() const; … … 151 151 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); 152 152 153 void paintCollapsedBorder(GraphicsContext*, const IntRect&);153 void paintCollapsedBorder(GraphicsContext*, const LayoutRect&); 154 154 155 155 int m_row; -
trunk/Source/WebCore/rendering/RenderView.h
r90882 r91417 174 174 175 175 // These functions may only be accessed by LayoutStateMaintainer. 176 bool pushLayoutState(RenderBox* renderer, const IntSize& offset, int pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0)176 bool pushLayoutState(RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) 177 177 { 178 178 // We push LayoutState even if layoutState is disabled because it stores layoutDelta too. … … 267 267 public: 268 268 // ctor to push now 269 LayoutStateMaintainer(RenderView* view, RenderBox* root, IntSize offset, bool disableState = false, int pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0)269 LayoutStateMaintainer(RenderView* view, RenderBox* root, LayoutSize offset, bool disableState = false, LayoutUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) 270 270 : m_view(view) 271 271 , m_disabled(disableState) … … 292 292 } 293 293 294 void push(RenderBox* root, IntSize offset, int pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0)294 void push(RenderBox* root, LayoutSize offset, LayoutUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) 295 295 { 296 296 ASSERT(!m_didStart); -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r90869 r91417 533 533 } 534 534 535 IntRect RootInlineBox::paddedLayoutOverflowRect(int endPadding) const536 { 537 IntRect lineLayoutOverflow = layoutOverflowRect(lineTop(), lineBottom());535 LayoutRect RootInlineBox::paddedLayoutOverflowRect(LayoutUnit endPadding) const 536 { 537 LayoutRect lineLayoutOverflow = layoutOverflowRect(lineTop(), lineBottom()); 538 538 if (!endPadding) 539 539 return lineLayoutOverflow; 540 540 541 // FIXME: Audit whether to use pixel snapped values when not using integers for layout: https://bugs.webkit.org/show_bug.cgi?id=63656 541 542 if (isHorizontal()) { 542 543 if (isLeftToRightDirection()) 543 lineLayoutOverflow.shiftMaxXEdgeTo(max (lineLayoutOverflow.maxX(), pixelSnappedLogicalRight() + endPadding));544 lineLayoutOverflow.shiftMaxXEdgeTo(max<LayoutUnit>(lineLayoutOverflow.maxX(), pixelSnappedLogicalRight() + endPadding)); 544 545 else 545 lineLayoutOverflow.shiftXEdgeTo(min (lineLayoutOverflow.x(), pixelSnappedLogicalLeft() - endPadding));546 lineLayoutOverflow.shiftXEdgeTo(min<LayoutUnit>(lineLayoutOverflow.x(), pixelSnappedLogicalLeft() - endPadding)); 546 547 } else { 547 548 if (isLeftToRightDirection()) 548 lineLayoutOverflow.shiftMaxYEdgeTo(max (lineLayoutOverflow.maxY(), pixelSnappedLogicalRight() + endPadding));549 lineLayoutOverflow.shiftMaxYEdgeTo(max<LayoutUnit>(lineLayoutOverflow.maxY(), pixelSnappedLogicalRight() + endPadding)); 549 550 else 550 lineLayoutOverflow.shiftYEdgeTo(min (lineLayoutOverflow.y(), pixelSnappedLogicalLeft() - endPadding));551 lineLayoutOverflow.shiftYEdgeTo(min<LayoutUnit>(lineLayoutOverflow.y(), pixelSnappedLogicalLeft() - endPadding)); 551 552 } 552 553 … … 554 555 } 555 556 556 static void setAscentAndDescent( int& ascent, int& descent, int newAscent, int newDescent, bool& ascentDescentSet)557 static void setAscentAndDescent(LayoutUnit& ascent, LayoutUnit& descent, LayoutUnit newAscent, LayoutUnit newDescent, bool& ascentDescentSet) 557 558 { 558 559 if (!ascentDescentSet) { -
trunk/Source/WebCore/rendering/RootInlineBox.h
r90869 r91417 139 139 bool hasAnnotationsAfter() const { return m_hasAnnotationsAfter; } 140 140 141 IntRect paddedLayoutOverflowRect(int endPadding) const;141 LayoutRect paddedLayoutOverflowRect(LayoutUnit endPadding) const; 142 142 143 143 void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, LayoutUnit& ascent, LayoutUnit& descent, bool& affectsAscent, bool& affectsDescent) const;
Note: See TracChangeset
for help on using the changeset viewer.