Title: [102944] branches/subpixellayout/Source/WebCore
Revision
102944
Author
[email protected]
Date
2011-12-15 08:55:05 -0800 (Thu, 15 Dec 2011)

Log Message

* Changing Renderer offsetLeft/Top/Width/Height to be LayoutUnits. Adding pixelSnapped versions as well.
* Changing AppUnit version of adjustForAbsoluteZoom to return an int and behave like the int version. This is
  needed to get zoomed values to read back properly.
* Moved snapSizeToPixel to AppUnit.h.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/inspector/DOMNodeHighlighter.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -269,11 +269,11 @@
 
     RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderBoxModelObject(renderer) : 0;
 
-    String widthNumberPart = " " + String::number(modelObject ? adjustForAbsoluteZoom(modelObject->offsetWidth(), modelObject) : boundingBox.width().toFloat());
+    String widthNumberPart = " " + String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width().toFloat());
     nodeTitle.append(widthNumberPart);
     nodeTitle.append(pxString);
     nodeTitle.append(timesString);
-    String heightNumberPart = String::number(modelObject ? adjustForAbsoluteZoom(modelObject->offsetHeight(), modelObject) : boundingBox.height().toFloat());
+    String heightNumberPart = String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height().toFloat());
     nodeTitle.append(heightNumberPart);
     nodeTitle.append(pxString);
 

Modified: branches/subpixellayout/Source/WebCore/page/PrintContext.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/page/PrintContext.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/page/PrintContext.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -249,8 +249,8 @@
     scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width());
     printContext.computePageRectsWithPageSize(scaledPageSize, false);
 
-    int top = box->offsetTop();
-    int left = box->offsetLeft();
+    int top = box->pixelSnappedOffsetTop();
+    int left = box->pixelSnappedOffsetLeft();
     size_t pageNumber = 0;
     for (; pageNumber < printContext.pageCount(); pageNumber++) {
         const IntRect& page = printContext.pageRect(pageNumber);

Modified: branches/subpixellayout/Source/WebCore/platform/AppUnit.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/platform/AppUnit.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/platform/AppUnit.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -497,7 +497,12 @@
     return a;
 }
 
+inline int snapSizeToPixel(AppUnit size, AppUnit location) 
+{
+    return (location + size).round() - location.round();
+}
 
+
 } // namespace WebCore
 
 namespace std {

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -463,11 +463,6 @@
     setNeedsLayout(false);
 }
 
-static inline int snapSizeToPixel(LayoutUnit size, LayoutUnit location)
-{
-    return (location + size).round() - location.round();   
-}
-
 // More IE extensions.  clientWidth and clientHeight represent the interior of an object
 // excluding border and scrollbar.
 LayoutUnit RenderBox::clientWidth() const

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -183,8 +183,10 @@
 
     // IE extensions. Used to calculate offsetWidth/Height.  Overridden by inlines (RenderFlow)
     // to return the remaining width on a given line (and the height of a single line).
-    virtual int offsetWidth() const { return pixelSnappedWidth(); }
-    virtual int offsetHeight() const { return pixelSnappedHeight(); }
+    virtual LayoutUnit offsetWidth() const { return width(); }
+    virtual LayoutUnit offsetHeight() const { return height(); }
+    virtual int pixelSnappedOffsetWidth() const { return pixelSnappedWidth(); }
+    virtual int pixelSnappedOffsetHeight() const { return pixelSnappedHeight(); }
 
     // More IE extensions.  clientWidth and clientHeight represent the interior of an object
     // excluding border and scrollbar.  clientLeft/Top are just the borderLeftWidth and borderTopWidth.

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -431,7 +431,7 @@
     return 0;
 }
 
-int RenderBoxModelObject::offsetLeft() const
+LayoutUnit RenderBoxModelObject::offsetLeft() const
 {
     // If the element is the HTML body element or does not have an associated box
     // return 0 and stop this algorithm.
@@ -462,10 +462,10 @@
         }
     }
 
-    return xPos.round();
+    return xPos;
 }
 
-int RenderBoxModelObject::offsetTop() const
+LayoutUnit RenderBoxModelObject::offsetTop() const
 {
     // If the element is the HTML body element or does not have an associated box
     // return 0 and stop this algorithm.
@@ -495,9 +495,19 @@
                 yPos += toRenderBox(offsetPar)->top();
         }
     }
-    return yPos.round();
+    return yPos;
 }
 
+int RenderBoxModelObject::pixelSnappedOffsetWidth() const
+{
+    return snapSizeToPixel(offsetWidth(), offsetLeft());
+}
+
+int RenderBoxModelObject::pixelSnappedOffsetHeight() const
+{
+    return snapSizeToPixel(offsetHeight(), offsetTop());
+}
+
 LayoutUnit RenderBoxModelObject::paddingTop(bool) const
 {
     LayoutUnit w = 0;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -55,10 +55,14 @@
 
     // IE extensions. Used to calculate offsetWidth/Height.  Overridden by inlines (RenderFlow)
     // to return the remaining width on a given line (and the height of a single line).
-    virtual int offsetLeft() const;
-    virtual int offsetTop() const;
-    virtual int offsetWidth() const = 0;
-    virtual int offsetHeight() const = 0;
+    virtual LayoutUnit offsetLeft() const;
+    virtual LayoutUnit offsetTop() const;
+    virtual LayoutUnit offsetWidth() const = 0;
+    virtual LayoutUnit offsetHeight() const = 0;
+    int pixelSnappedOffsetLeft() const { return offsetLeft().round(); }
+    int pixelSnappedOffsetTop() const { return offsetTop().round(); }
+    int pixelSnappedOffsetWidth() const;
+    int pixelSnappedOffsetHeight() const;
 
     virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderInline.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderInline.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderInline.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -637,17 +637,17 @@
     }
 }
 
-int RenderInline::offsetLeft() const
+LayoutUnit RenderInline::offsetLeft() const
 {
-    int x = RenderBoxModelObject::offsetLeft();
+    LayoutUnit x = RenderBoxModelObject::offsetLeft();
     if (InlineBox* firstBox = firstLineBoxIncludingCulling())
         x += firstBox->x();
     return x;
 }
 
-int RenderInline::offsetTop() const
+LayoutUnit RenderInline::offsetTop() const
 {
-    int y = RenderBoxModelObject::offsetTop();
+    LayoutUnit y = RenderBoxModelObject::offsetTop();
     if (InlineBox* firstBox = firstLineBoxIncludingCulling())
         y += firstBox->y();
     return y;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderInline.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderInline.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderInline.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -121,10 +121,10 @@
 
     virtual bool requiresLayer() const { return isRelPositioned() || isTransparent() || hasMask(); }
 
-    virtual int offsetLeft() const;
-    virtual int offsetTop() const;
-    virtual int offsetWidth() const { return linesBoundingBox().width().ceil(); }
-    virtual int offsetHeight() const { return linesBoundingBox().height().ceil(); }
+    virtual LayoutUnit offsetLeft() const;
+    virtual LayoutUnit offsetTop() const;
+    virtual LayoutUnit offsetWidth() const { return linesBoundingBox().width(); }
+    virtual LayoutUnit offsetHeight() const { return linesBoundingBox().height(); }
 
     virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
     virtual LayoutRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, LayoutUnit outlineWidth) const;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderObject.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderObject.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderObject.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -1037,14 +1037,14 @@
 #endif
 }
 
-inline float adjustForAbsoluteZoom(int value, RenderObject* renderer)
+inline int adjustForAbsoluteZoom(int value, RenderObject* renderer)
 {
     return adjustForAbsoluteZoom(value, renderer->style());
 }
 
-inline float adjustForAbsoluteZoom(AppUnit value, RenderObject* renderer)
+inline int adjustForAbsoluteZoom(AppUnit value, RenderObject* renderer)
 {
-    return adjustForAbsoluteZoom(value, renderer->style());
+    return adjustForAbsoluteZoom(value.floor(), renderer->style());
 }
 
 inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* renderer)

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTheme.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderTheme.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTheme.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -505,7 +505,7 @@
 LayoutPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const
 {
     LayoutUnit y = -size.height();
-    FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->offsetLeft(), y), true, true);
+    FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true);
     if (absPoint.y() < 0)
         y = muteButtonBox->height();
     return LayoutPoint(0, y);

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTreeAsText.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderTreeAsText.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTreeAsText.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -284,10 +284,12 @@
 
     // FIXME: Convert layout test results to report sub-pixel values, in the meantime using enclosingIntRect
     // for consistency with old results. This doesn't apply to tables, which are still laid out on integer bounds.
-    if (!o.isTable() && !o.isTableCell() && !o.isTableCol() && !o.isTableRow() && !o.isTableSection())
+    if (o.isTable() || o.isTableCell() || o.isTableCol() || o.isTableRow() || o.isTableSection())
+        r = IntRect(r);
+    else if (o.isImage())
+        r = pixelSnappedIntRect(r);
+    else
         r = enclosingIntRect(r);
-    else
-        r = IntRect(r);
 
 
     ts << " " << r;
@@ -616,6 +618,11 @@
                   const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const LayoutRect& clipRect, const LayoutRect& outlineClipRect,
                   LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
 {
+    IntRect adjustedLayoutBounds = pixelSnappedIntRect(layerBounds);
+    IntRect adjustedBackgroundClipRect = pixelSnappedIntRect(backgroundClipRect);
+    IntRect adjustedClipRect = pixelSnappedIntRect(clipRect);
+    IntRect adjustedOutlineClipRect = pixelSnappedIntRect(outlineClipRect);
+
     writeIndent(ts, indent);
 
     ts << "layer ";
@@ -623,15 +630,15 @@
     if (behavior & RenderAsTextShowAddresses)
         ts << static_cast<const void*>(&l) << " ";
       
-    ts << layerBounds;
+    ts << adjustedLayoutBounds;
 
-    if (!layerBounds.isEmpty()) {
-        if (!backgroundClipRect.contains(layerBounds))
-            ts << " backgroundClip " << backgroundClipRect;
-        if (!clipRect.contains(layerBounds))
-            ts << " clip " << clipRect;
-        if (!outlineClipRect.contains(layerBounds))
-            ts << " outlineClip " << outlineClipRect;
+    if (!adjustedLayoutBounds.isEmpty()) {
+        if (!adjustedBackgroundClipRect.contains(adjustedLayoutBounds))
+            ts << " backgroundClip " << adjustedBackgroundClipRect;
+        if (!adjustedClipRect.contains(adjustedLayoutBounds))
+            ts << " clip " << adjustedClipRect;
+        if (!adjustedOutlineClipRect.contains(adjustedLayoutBounds))
+            ts << " outlineClip " << adjustedOutlineClipRect;
     }
 
     if (l.renderer()->hasOverflowClip()) {

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderVideo.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderVideo.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderVideo.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -300,28 +300,28 @@
     return fullScreen->placeholder();
 }
 
-int RenderVideo::offsetLeft() const
+LayoutUnit RenderVideo::offsetLeft() const
 {
     if (const RenderBlock* block = rendererPlaceholder(this))
         return block->offsetLeft();
     return RenderMedia::offsetLeft();
 }
 
-int RenderVideo::offsetTop() const
+LayoutUnit RenderVideo::offsetTop() const
 {
     if (const RenderBlock* block = rendererPlaceholder(this))
         return block->offsetTop();
     return RenderMedia::offsetTop();
 }
 
-int RenderVideo::offsetWidth() const
+LayoutUnit RenderVideo::offsetWidth() const
 {
     if (const RenderBlock* block = rendererPlaceholder(this))
         return block->offsetWidth();
     return RenderMedia::offsetWidth();
 }
 
-int RenderVideo::offsetHeight() const
+LayoutUnit RenderVideo::offsetHeight() const
 {
     if (const RenderBlock* block = rendererPlaceholder(this))
         return block->offsetHeight();

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderVideo.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/RenderVideo.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderVideo.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -75,10 +75,10 @@
     virtual int minimumReplacedHeight() const;
 
 #if ENABLE(FULLSCREEN_API)
-    virtual int offsetLeft() const;
-    virtual int offsetTop() const;
-    virtual int offsetWidth() const;
-    virtual int offsetHeight() const;
+    virtual LayoutUnit offsetLeft() const;
+    virtual LayoutUnit offsetTop() const;
+    virtual LayoutUnit offsetWidth() const;
+    virtual LayoutUnit offsetHeight() const;
 #endif
 
     void updatePlayer();

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -60,7 +60,7 @@
 int RenderMathMLBlock::nonOperatorHeight() const
 {
     if (!isRenderMathMLOperator())
-        return offsetHeight();
+        return pixelSnappedOffsetHeight();
         
     return 0;
 }
@@ -90,22 +90,22 @@
     info.context->setStrokeStyle(SolidStroke);
     info.context->setStrokeColor(Color(0, 0, 255), ColorSpaceSRGB);
     
-    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y()));
-    info.context->drawLine(IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y()), IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y() + offsetHeight()));
-    info.context->drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + offsetHeight()), IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y() + offsetHeight()));
-    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + offsetHeight()));
+    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y()));
+    info.context->drawLine(IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y()), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()));
+    info.context->drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()));
+    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()));
     
     int topStart = paddingTop();
     
     info.context->setStrokeColor(Color(0, 255, 0), ColorSpaceSRGB);
     
-    info.context->drawLine(IngPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + topStart), IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y() + topStart));
+    info.context->drawLine(IngPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + topStart), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + topStart));
     
     int baseline = baselinePosition(AlphabeticBaseline, true, HorizontalLine).round();
     
     info.context->setStrokeColor(Color(255, 0, 0), ColorSpaceSRGB);
     
-    info.context->drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + baseline), IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y() + baseline));
+    info.context->drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + baseline), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + baseline));
 }
 #endif // ENABLE(DEBUG_MATH_LAYOUT)
 

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -56,7 +56,7 @@
     {
         if (object && object->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(object);
-            return box->offsetHeight();
+            return box->pixelSnappedOffsetHeight();
         }
         
         return 0;
@@ -65,7 +65,7 @@
     {
         if (object && object->isBoxModelObject()) {
             const RenderBoxModelObject* box = toRenderBoxModelObject(object);
-            return box->offsetHeight();
+            return box->pixelSnappedOffsetHeight();
         }
         
         return 0;
@@ -74,7 +74,7 @@
     {
         if (object && object->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(object);
-            return box->offsetWidth();
+            return box->pixelSnappedOffsetWidth();
         }
         
         return 0;
@@ -83,7 +83,7 @@
     {
         if (object && object->isBoxModelObject()) {
             const RenderBoxModelObject* box = toRenderBoxModelObject(object);
-            return box->offsetWidth();
+            return box->pixelSnappedOffsetWidth();
         }
         
         return 0;

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -148,9 +148,9 @@
             adjustForThickness++;
         RenderMathMLBlock* numerator = toRenderMathMLBlock(firstChild());
         if (numerator->isRenderMathMLRow())
-            verticalOffset = numerator->offsetHeight() + adjustForThickness;
+            verticalOffset = numerator->pixelSnappedOffsetHeight() + adjustForThickness;
         else 
-            verticalOffset = numerator->offsetHeight();        
+            verticalOffset = numerator->pixelSnappedOffsetHeight();        
     }
     
     IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location());
@@ -162,7 +162,7 @@
     info.context->setStrokeStyle(SolidStroke);
     info.context->setStrokeColor(style()->visitedDependentColor(CSSPropertyColor), ColorSpaceSRGB);
     
-    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y()));
+    info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y()));
 }
 
 LayoutUnit RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
@@ -175,7 +175,7 @@
         else if (nextSibling())
             refStyle = nextSibling()->style();
         int shift = int(ceil((refStyle->fontMetrics().xHeight() + 1) / 2));
-        return numerator->offsetHeight() + shift;
+        return numerator->pixelSnappedOffsetHeight() + shift;
     }
     return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, lineDirection, linePositionMode);
 }

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -108,18 +108,18 @@
     
     RenderBoxModelObject* indexBox = toRenderBoxModelObject(lastChild());
     
-    int maxHeight = indexBox->offsetHeight();
+    int maxHeight = indexBox->pixelSnappedOffsetHeight();
     // default to the font size in pixels if we're empty
     if (!maxHeight)
         maxHeight = style()->fontSize();
-    int width = indexBox->offsetWidth();
+    int width = indexBox->pixelSnappedOffsetWidth();
     
     int indexWidth = 0;
     RenderObject* current = firstChild();
     while (current != lastChild()) {
         if (current->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(current);
-            indexWidth += box->offsetWidth();
+            indexWidth += box->pixelSnappedOffsetWidth();
         }
         current = current->nextSibling();
     }
@@ -199,7 +199,7 @@
     if (!firstChild() || !lastChild())
         return;
 
-    int maxHeight = toRenderBoxModelObject(lastChild())->offsetHeight();
+    int maxHeight = toRenderBoxModelObject(lastChild())->pixelSnappedOffsetHeight();
     
     RenderObject* current = lastChild()->firstChild();
     if (current)
@@ -230,9 +230,9 @@
     if (!indexBox)
         return;
     
-    int indexShift = indexBox->offsetWidth() + topStartShift;
+    int indexShift = indexBox->pixelSnappedOffsetWidth() + topStartShift;
     int radicalHeight = static_cast<int>((1 - gRadicalTopLeftPointYPos) * maxHeight);
-    int rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->offsetHeight() - (maxHeight + static_cast<int>(gRootPadding * style()->fontSize()));
+    int rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->pixelSnappedOffsetHeight() - (maxHeight + static_cast<int>(gRootPadding * style()->fontSize()));
     
     style()->setPaddingLeft(Length(indexShift, Fixed));
     if (rootMarginTop > 0)

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -54,8 +54,8 @@
         } else if (current->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(current);
             // Check to see if this box has a larger height
-            if (box->offsetHeight() > maxHeight)
-                maxHeight = box->offsetHeight();
+            if (box->pixelSnappedOffsetHeight() > maxHeight)
+                maxHeight = box->pixelSnappedOffsetHeight();
         }
         
     }
@@ -77,21 +77,21 @@
         if (current->isRenderMathMLBlock()) {
             RenderMathMLBlock* block = toRenderMathMLBlock(current);
             // Check to see if the non-operator block has a greater height.
-            if (!block->hasBase() && !block->isRenderMathMLOperator() && block->offsetHeight() > maxHeight)
-                maxHeight = block->offsetHeight();
+            if (!block->hasBase() && !block->isRenderMathMLOperator() && block->pixelSnappedOffsetHeight() > maxHeight)
+                maxHeight = block->pixelSnappedOffsetHeight();
             if (block->hasBase() && block->nonOperatorHeight() > maxHeight) 
                 maxHeight = block->nonOperatorHeight();
             // If the block is an operator, capture the maximum height and increment the count.
             if (block->isRenderMathMLOperator()) {
-                if (block->offsetHeight() > operatorHeight)
-                    operatorHeight = block->offsetHeight();
+                if (block->pixelSnappedOffsetHeight() > operatorHeight)
+                    operatorHeight = block->pixelSnappedOffsetHeight();
                 operatorCount++;
             }
         } else if (current->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(current);
             // Check to see if this box has a larger height.
-            if (box->offsetHeight() > maxHeight)
-                maxHeight = box->offsetHeight();
+            if (box->pixelSnappedOffsetHeight() > maxHeight)
+                maxHeight = box->pixelSnappedOffsetHeight();
         }
     }
     

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -84,9 +84,9 @@
             RenderBoxModelObject* box = toRenderBoxModelObject(current);
             
             // Check to see if this box has a larger height
-            if (box->offsetHeight() > maxHeight)
-                maxHeight = box->offsetHeight();
-            width += box->offsetWidth();
+            if (box->pixelSnappedOffsetHeight() > maxHeight)
+                maxHeight = box->pixelSnappedOffsetHeight();
+            width += box->pixelSnappedOffsetWidth();
         }
         current = current->nextSibling();
     }
@@ -167,8 +167,8 @@
         if (current->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(current);
             
-            if (box->offsetHeight() > maxHeight)
-                maxHeight = box->offsetHeight();
+            if (box->pixelSnappedOffsetHeight() > maxHeight)
+                maxHeight = box->pixelSnappedOffsetHeight();
             
             box->style()->setVerticalAlign(BASELINE);
         }

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -170,7 +170,7 @@
                     maxHeight = height;
                 current = current->nextSibling();
             }
-            int heightDiff = m_scripts ? (m_scripts->offsetHeight() - maxHeight) / 2 : 0;
+            int heightDiff = m_scripts ? (m_scripts->pixelSnappedOffsetHeight() - maxHeight) / 2 : 0;
             if (heightDiff < 0) 
                 heightDiff = 0;
             base->style()->setPaddingTop(Length(heightDiff, Fixed));
@@ -185,9 +185,9 @@
 {
     RenderObject* base = firstChild();
     if (!base) 
-        return offsetHeight();
+        return pixelSnappedOffsetHeight();
     
-    LayoutUnit baseline = offsetHeight();
+    LayoutUnit baseline = pixelSnappedOffsetHeight();
     if (!base || !base->isBoxModelObject()) 
         return baseline;
 
@@ -197,7 +197,7 @@
         if (m_scripts && base && base->isBoxModelObject()) {
             RenderBoxModelObject* box = toRenderBoxModelObject(base);
             
-            int topAdjust = (m_scripts->offsetHeight() - box->offsetHeight()) / 2;
+            int topAdjust = (m_scripts->pixelSnappedOffsetHeight() - box->pixelSnappedOffsetHeight()) / 2;
         
             // FIXME: The last bit of this calculation should be more exact. Why is the 2-3px scaled for zoom necessary?
             // The baseline is top spacing of the base + the baseline of the base + adjusted space for zoom

Modified: branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp	2011-12-15 16:55:05 UTC (rev 102944)
@@ -113,7 +113,7 @@
 {
     if (obj->isBoxModelObject()) {
         RenderBoxModelObject* box = toRenderBoxModelObject(obj);
-        return box->offsetHeight();
+        return box->pixelSnappedOffsetHeight();
     }
    
     return 0;

Modified: branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.h (102943 => 102944)


--- branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.h	2011-12-15 16:46:16 UTC (rev 102943)
+++ branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.h	2011-12-15 16:55:05 UTC (rev 102944)
@@ -1603,9 +1603,9 @@
     return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
 }
 
-inline float adjustForAbsoluteZoom(AppUnit value, const RenderStyle* style)
+inline int adjustForAbsoluteZoom(AppUnit value, const RenderStyle* style)
 {
-    return value / style->effectiveZoom();
+    return adjustForAbsoluteZoom(value.floor(), style);
 }
 
 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to