Changeset 90525 in webkit
- Timestamp:
- Jul 6, 2011 7:32:26 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90522 r90525 1 2011-07-06 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch offsetFromContainer and related to to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63659 7 8 Switch offsetFromContainer and related mapping methods to new layout unit 9 abstraction. 10 11 No new tests, no functionality changes. 12 13 * rendering/LayoutTypes.h: 14 (WebCore::enclosingLayoutRect): 15 (WebCore::roundedLayoutPoint): 16 (WebCore::roundedLayoutUnit): 17 Add LayoutUnit versions of enclosingIntRect, roundedIntPoint and lroundf. 18 For now these map to their int counterpart but once we switch to float or 19 fixed point they'll be no-ops and eventually will be removed. 20 21 * rendering/RenderBox.cpp: 22 (WebCore::RenderBox::mapLocalToContainer): 23 (WebCore::RenderBox::mapAbsoluteToLocalPoint): 24 (WebCore::RenderBox::offsetFromContainer): 25 * rendering/RenderBox.h: 26 * rendering/RenderInline.cpp: 27 (WebCore::RenderInline::linesBoundingBox): 28 (WebCore::RenderInline::offsetFromContainer): 29 (WebCore::RenderInline::mapLocalToContainer): 30 (WebCore::RenderInline::mapAbsoluteToLocalPoint): 31 (WebCore::RenderInline::relativePositionedInlineOffset): 32 * rendering/RenderInline.h: 33 * rendering/RenderObject.cpp: 34 (WebCore::RenderObject::offsetFromContainer): 35 (WebCore::RenderObject::offsetFromAncestorContainer): 36 * rendering/RenderObject.h: 37 * rendering/RenderTableCell.cpp: 38 (WebCore::RenderTableCell::offsetFromContainer): 39 * rendering/RenderTableCell.h: 40 * rendering/RenderThemeMac.mm: 41 (WebCore::RenderThemeMac::convertToPaintingRect): 42 1 43 2011-07-06 Levi Weintraub <leviw@chromium.org> 2 44 -
trunk/Source/WebCore/rendering/LayoutTypes.h
r90515 r90525 38 38 39 39 #include "FloatPoint.h" 40 #include "FloatRect.h" 40 41 #include "IntRect.h" 41 42 … … 46 47 typedef IntSize LayoutSize; 47 48 typedef IntRect LayoutRect; 49 50 inline LayoutRect enclosingLayoutRect(const FloatRect& rect) 51 { 52 return enclosingIntRect(rect); 53 } 48 54 49 55 inline LayoutPoint roundedLayoutPoint(const FloatPoint& p) -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90515 r90525 1239 1239 *wasFixed = fixed; 1240 1240 1241 IntSize containerOffset = offsetFromContainer(o, roundedIntPoint(transformState.mappedPoint()));1241 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint())); 1242 1242 1243 1243 bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); … … 1252 1252 // There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe 1253 1253 // to just subtract the delta between the repaintContainer and o. 1254 IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);1254 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContainer(o); 1255 1255 transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); 1256 1256 return; … … 1280 1280 o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState); 1281 1281 1282 IntSize containerOffset = offsetFromContainer(o, IntPoint());1282 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); 1283 1283 1284 1284 bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); … … 1291 1291 } 1292 1292 1293 IntSize RenderBox::offsetFromContainer(RenderObject* o, const IntPoint& point) const1293 LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const 1294 1294 { 1295 1295 ASSERT(o == container()); 1296 1296 1297 IntSize offset;1297 LayoutSize offset; 1298 1298 if (isRelPositioned()) 1299 1299 offset += relativePositionOffset(); … … 1302 1302 if (style()->position() != AbsolutePosition && style()->position() != FixedPosition) { 1303 1303 if (o->hasColumns()) { 1304 IntRect columnRect(frameRect());1304 LayoutRect columnRect(frameRect()); 1305 1305 toRenderBlock(o)->flipForWritingModeIncludingColumns(columnRect); 1306 offset += IntSize(columnRect.location().x(), columnRect.location().y());1306 offset += LayoutSize(columnRect.location().x(), columnRect.location().y()); 1307 1307 columnRect.moveBy(point); 1308 1308 o->adjustForColumns(offset, columnRect.location()); -
trunk/Source/WebCore/rendering/RenderBox.h
r90515 r90525 250 250 virtual void setOverrideSize(int); 251 251 252 virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;252 virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; 253 253 254 254 LayoutUnit computeBorderBoxLogicalWidth(LayoutUnit width) const; -
trunk/Source/WebCore/rendering/RenderInline.cpp
r90515 r90525 739 739 } 740 740 741 IntRect RenderInline::linesBoundingBox() const741 LayoutRect RenderInline::linesBoundingBox() const 742 742 { 743 743 if (!alwaysCreateLineBoxes()) { 744 744 ASSERT(!firstLineBox()); 745 return enclosing IntRect(culledInlineBoundingBox(this));746 } 747 748 IntRect result;745 return enclosingLayoutRect(culledInlineBoundingBox(this)); 746 } 747 748 LayoutRect result; 749 749 750 750 // See <rdar://problem/5289721>, for an unknown reason the linked list here is sometimes inconsistent, first is non-zero and last is zero. We have been … … 769 769 float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLineBox()->logicalBottom() - x; 770 770 float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide; 771 result = enclosing IntRect(FloatRect(x, y, width, height));771 result = enclosingLayoutRect(FloatRect(x, y, width, height)); 772 772 } 773 773 … … 1094 1094 } 1095 1095 1096 IntSize RenderInline::offsetFromContainer(RenderObject* container, const IntPoint& point) const1096 LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const LayoutPoint& point) const 1097 1097 { 1098 1098 ASSERT(container == this->container()); 1099 1099 1100 IntSize offset;1100 LayoutSize offset; 1101 1101 if (isRelPositioned()) 1102 1102 offset += relativePositionOffset(); … … 1135 1135 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedIntPoint(transformState.mappedPoint())) - centerPoint); 1136 1136 1137 IntSize containerOffset = offsetFromContainer(o, roundedIntPoint(transformState.mappedPoint()));1137 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint())); 1138 1138 1139 1139 bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); … … 1167 1167 o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState); 1168 1168 1169 IntSize containerOffset = offsetFromContainer(o, IntPoint());1169 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); 1170 1170 1171 1171 bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); … … 1286 1286 } 1287 1287 1288 IntSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const1288 LayoutSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const 1289 1289 { 1290 1290 // FIXME: This function isn't right with mixed writing modes. … … 1292 1292 ASSERT(isRelPositioned()); 1293 1293 if (!isRelPositioned()) 1294 return IntSize();1294 return LayoutSize(); 1295 1295 1296 1296 // When we have an enclosing relpositioned inline, we need to add in the offset of the first line … … 1298 1298 // relative to the inline itself. 1299 1299 1300 IntSize logicalOffset;1301 int inlinePosition;1302 int blockPosition;1300 LayoutSize logicalOffset; 1301 LayoutUnit inlinePosition; 1302 LayoutUnit blockPosition; 1303 1303 if (firstLineBox()) { 1304 inlinePosition = lroundf(firstLineBox()->logicalLeft());1304 inlinePosition = roundedLayoutUnit(firstLineBox()->logicalLeft()); 1305 1305 blockPosition = firstLineBox()->logicalTop(); 1306 1306 } else { -
trunk/Source/WebCore/rendering/RenderInline.h
r90515 r90525 52 52 virtual void absoluteQuads(Vector<FloatQuad>&); 53 53 54 virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;54 virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; 55 55 56 IntRect linesBoundingBox() const;56 LayoutRect linesBoundingBox() const; 57 57 IntRect linesVisualOverflowBoundingBox() const; 58 58 … … 74 74 virtual void updateDragState(bool dragOn); 75 75 76 IntSize relativePositionedInlineOffset(const RenderBox* child) const;76 LayoutSize relativePositionedInlineOffset(const RenderBox* child) const; 77 77 78 78 virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r90515 r90525 1932 1932 } 1933 1933 1934 IntSize RenderObject::offsetFromContainer(RenderObject* o, const IntPoint& point) const1934 LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const 1935 1935 { 1936 1936 ASSERT(o == container()); 1937 1937 1938 IntSize offset;1938 LayoutSize offset; 1939 1939 1940 1940 o->adjustForColumns(offset, point); … … 1946 1946 } 1947 1947 1948 IntSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const1949 { 1950 IntSize offset;1951 IntPoint referencePoint;1948 LayoutSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const 1949 { 1950 LayoutSize offset; 1951 LayoutPoint referencePoint; 1952 1952 const RenderObject* currContainer = this; 1953 1953 do { … … 1957 1957 break; 1958 1958 ASSERT(!currContainer->hasTransform()); 1959 IntSize currentOffset = currContainer->offsetFromContainer(nextContainer, referencePoint);1959 LayoutSize currentOffset = currContainer->offsetFromContainer(nextContainer, referencePoint); 1960 1960 offset += currentOffset; 1961 1961 referencePoint.move(currentOffset); -
trunk/Source/WebCore/rendering/RenderObject.h
r90515 r90525 589 589 // Return the offset from the container() renderer (excluding transforms). In multi-column layout, 590 590 // different offsets apply at different points, so return the offset that applies to the given point. 591 virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;591 virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; 592 592 // Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms. 593 IntSize offsetFromAncestorContainer(RenderObject*) const;593 LayoutSize offsetFromAncestorContainer(RenderObject*) const; 594 594 595 595 virtual void absoluteRects(Vector<IntRect>&, const IntPoint&) { } -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r90048 r90525 225 225 } 226 226 227 IntSize RenderTableCell::offsetFromContainer(RenderObject* o, const IntPoint& point) const227 LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const 228 228 { 229 229 ASSERT(o == container()); 230 230 231 IntSize offset = RenderBlock::offsetFromContainer(o, point);231 LayoutSize offset = RenderBlock::offsetFromContainer(o, point); 232 232 if (parent()) 233 233 offset.expand(-parentBox()->x(), -parentBox()->y()); -
trunk/Source/WebCore/rendering/RenderTableCell.h
r90048 r90525 146 146 virtual void paintMask(PaintInfo&, const LayoutPoint&); 147 147 148 virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;148 virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; 149 149 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); 150 150 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r90436 r90525 555 555 while (renderer && renderer != inputRenderer) { 556 556 RenderObject* containingRenderer = renderer->container(); 557 offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, IntPoint());557 offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, LayoutPoint()); 558 558 renderer = containingRenderer; 559 559 }
Note: See TracChangeset
for help on using the changeset viewer.