Changeset 111082 in webkit
- Timestamp:
- Mar 16, 2012 4:05:34 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r111080 r111082 1 2012-03-16 Levi Weintraub <leviw@chromium.org> 2 3 Prepare RenderObject for FractionalLayoutUnits 4 https://bugs.webkit.org/show_bug.cgi?id=81178 5 6 Reviewed by Eric Seidel. 7 8 This readies RenderObject to deal with FractionalLayoutUnits as a backend for the 9 LayoutUnit abstraction. 10 11 No new tests. No change in behavior. 12 13 * rendering/RenderObject.cpp: 14 (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect): Convenience method to be 15 used instead of absouluteClippedOverflowRect in platform code. Platform updates will come 16 in a separate patch. 17 (WebCore): 18 (WebCore::RenderObject::repaintAfterLayoutIfNeeded): Borders remain ints when we move to 19 sub-pixel layout. This adjusts border variables for this, and adds compiler fixes when 20 using std::max and std::min with mixed int/LayoutUnits. 21 (WebCore::RenderObject::adjustRectForOutlineAndShadow): Outlines, like borders, remain 22 ints in the new sub-pixel world. Using variables that reflect that. 23 * rendering/RenderObject.h: 24 (RenderObject): 25 (WebCore::adjustForAbsoluteZoom): Handles FractionalLayoutUnit values. Flooring is what 26 JavaScript requires since this is used with values that must return ints. 27 (WebCore): Adding FractionalLayoutUnit.h to support the new adjusteForAbsoluteZoom method. 28 1 29 2012-03-16 Brady Eidson <beidson@apple.com> 2 30 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r111048 r111082 1366 1366 } 1367 1367 1368 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const 1369 { 1370 return pixelSnappedIntRect(absoluteClippedOverflowRect()); 1371 } 1372 1368 1373 bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr, const LayoutRect* newOutlineBoxRectPtr) 1369 1374 { … … 1439 1444 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); 1440 1445 1441 LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : zeroLayoutUnit;1446 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; 1442 1447 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : zeroLayoutUnit; 1443 LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max (borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);1448 LayoutUnit borderWidth = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderRight, max<LayoutUnit>(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max<LayoutUnit>(ow, shadowRight); 1444 1449 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth, 1445 1450 newOutlineBox.y(), 1446 1451 width + borderWidth, 1447 1452 max(newOutlineBox.height(), oldOutlineBox.height())); 1448 LayoutUnit right = min (newBounds.maxX(), oldBounds.maxX());1453 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); 1449 1454 if (rightRect.x() < right) { 1450 1455 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); … … 1458 1463 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); 1459 1464 1460 LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : zeroLayoutUnit;1465 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; 1461 1466 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : zeroLayoutUnit; 1462 LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max (borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);1467 LayoutUnit borderHeight = max<LayoutUnit>(-outlineStyle->outlineOffset(), max<LayoutUnit>(borderBottom, max<LayoutUnit>(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max<LayoutUnit>(ow, shadowBottom); 1463 1468 LayoutRect bottomRect(newOutlineBox.x(), 1464 1469 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight, … … 2705 2710 void RenderObject::adjustRectForOutlineAndShadow(LayoutRect& rect) const 2706 2711 { 2707 LayoutUnit outlineSize = outlineStyleForRepaint()->outlineSize();2712 int outlineSize = outlineStyleForRepaint()->outlineSize(); 2708 2713 if (const ShadowData* boxShadow = style()->boxShadow()) { 2709 2714 boxShadow->adjustRectForShadow(rect, outlineSize); -
trunk/Source/WebCore/rendering/RenderObject.h
r110732 r111082 30 30 #include "Document.h" 31 31 #include "Element.h" 32 #include "FractionalLayoutUnit.h" 32 33 #include "FloatQuad.h" 33 34 #include "LayoutTypes.h" … … 718 719 return clippedOverflowRectForRepaint(0); 719 720 } 721 IntRect pixelSnappedAbsoluteClippedOverflowRect() const; 720 722 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; 721 723 virtual LayoutRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, LayoutUnit outlineWidth) const; … … 1142 1144 } 1143 1145 1146 inline int adjustForAbsoluteZoom(FractionalLayoutUnit value, RenderObject* renderer) 1147 { 1148 return adjustForAbsoluteZoom(value.floor(), renderer->style()); 1149 } 1150 1144 1151 inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* renderer) 1145 1152 {
Note: See TracChangeset
for help on using the changeset viewer.