Title: [113621] branches/subpixellayout/Source/WebCore
Revision
113621
Author
[email protected]
Date
2012-04-09 14:32:31 -0700 (Mon, 09 Apr 2012)

Log Message

Cleaning up LayoutUnit usage in DOMNodeHighlighter and removing unnecessary static_casts in ValidationMessage.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/html/ValidationMessage.cpp (113620 => 113621)


--- branches/subpixellayout/Source/WebCore/html/ValidationMessage.cpp	2012-04-09 21:30:38 UTC (rev 113620)
+++ branches/subpixellayout/Source/WebCore/html/ValidationMessage.cpp	2012-04-09 21:32:31 UTC (rev 113621)
@@ -120,12 +120,12 @@
         hostY -= containerLocation.y() + container->borderTop();
     }
 
-    bubble->setInlineStyleProperty(CSSPropertyTop, hostY + static_cast<double>(hostRect.height()), CSSPrimitiveValue::CSS_PX);
+    bubble->setInlineStyleProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX);
     // The 'left' value of ::-webkit-validation-bubble-arrow.
     const int bubbleArrowTopOffset = 32;
     double bubbleX = hostX;
     if (hostRect.width() / 2 < bubbleArrowTopOffset)
-        bubbleX = max(hostX + static_cast<double>(hostRect.width()) / 2 - bubbleArrowTopOffset, 0.0);
+        bubbleX = max(hostX + hostRect.width() / 2 - bubbleArrowTopOffset, 0.0);
     bubble->setInlineStyleProperty(CSSPropertyLeft, bubbleX, CSSPrimitiveValue::CSS_PX);
 }
 

Modified: branches/subpixellayout/Source/WebCore/inspector/DOMNodeHighlighter.cpp (113620 => 113621)


--- branches/subpixellayout/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2012-04-09 21:30:38 UTC (rev 113620)
+++ branches/subpixellayout/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2012-04-09 21:32:31 UTC (rev 113621)
@@ -143,16 +143,16 @@
         drawOutlinedQuad(context, absoluteQuads[i], highlightData->content, Color::transparent);
 }
 
-inline LayoutSize frameToMainFrameOffset(Frame* frame)
+inline IntSize frameToMainFrameOffset(Frame* frame)
 {
-    LayoutPoint mainFramePoint = frame->page()->mainFrame()->view()->rootViewToContents(frame->view()->contentsToRootView(IntPoint()));
-    return toLayoutSize(mainFramePoint);
+    IntPoint mainFramePoint = frame->page()->mainFrame()->view()->rootViewToContents(frame->view()->contentsToRootView(IntPoint()));
+    return toSize(mainFramePoint);
 }
 
 int drawSubstring(const TextRun& globalTextRun, int offset, int length, const Color& textColor, const Font& font, GraphicsContext& context, const LayoutRect& titleRect)
 {
     context.setFillColor(textColor, ColorSpaceDeviceRGB);
-    context.drawText(font, globalTextRun, FloatPoint(titleRect.x() + rectInflatePx, titleRect.y() + font.fontMetrics().height()), offset, offset + length);
+    context.drawText(font, globalTextRun, IntPoint(titleRect.pixelSnappedX() + rectInflatePx, titleRect.pixelSnappedY() + font.fontMetrics().height()), offset, offset + length);
     return offset + length;
 }
 
@@ -222,7 +222,7 @@
     }
 }
 
-void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* renderer, const LayoutRect& boundingBox, const LayoutRect& anchorBox, const FloatRect& visibleRect, WebCore::Settings* settings)
+void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* renderer, const IntRect& boundingBox, const IntRect& anchorBox, const FloatRect& visibleRect, WebCore::Settings* settings)
 {
     DEFINE_STATIC_LOCAL(Color, backgroundColor, (255, 255, 194));
     DEFINE_STATIC_LOCAL(Color, tagColor, (136, 18, 128)); // Same as .webkit-html-tag.
@@ -269,11 +269,11 @@
 
     RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderBoxModelObject(renderer) : 0;
 
-    String widthNumberPart = " " + String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width().toFloat());
+    String widthNumberPart = " " + String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width());
     nodeTitle.append(widthNumberPart);
     nodeTitle.append(pxString);
     nodeTitle.append(timesString);
-    String heightNumberPart = String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height().toFloat());
+    String heightNumberPart = String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height());
     nodeTitle.append(heightNumberPart);
     nodeTitle.append(pxString);
 
@@ -283,7 +283,7 @@
     font.update(0);
 
     TextRun nodeTitleRun(nodeTitle.toString());
-    FloatPoint titleBasePoint = FloatPoint(anchorBox.x(), anchorBox.maxY() - 1);
+    IntPoint titleBasePoint = IntPoint(anchorBox.x(), anchorBox.maxY() - 1);
     titleBasePoint.move(rectInflatePx, rectInflatePx);
     IntRect titleRect = enclosingIntRect(font.selectionRectForText(nodeTitleRun, titleBasePoint, fontHeightPx));
     titleRect.inflate(rectInflatePx);
@@ -368,12 +368,12 @@
     if (!renderer || !containingFrame)
         return;
 
-    LayoutSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
-    LayoutRect boundingBox = renderer->absoluteBoundingBoxRect();
+    IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
+    IntRect boundingBox = renderer->absoluteBoundingBoxRect();
 
     boundingBox.move(mainFrameOffset);
 
-    LayoutRect titleAnchorBox = boundingBox;
+    IntRect titleAnchorBox = boundingBox;
 
     FrameView* view = containingFrame->page()->mainFrame()->view();
     FloatRect visibleRect = view->visibleContentRect();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to