Title: [97726] trunk/Source/WebCore
Revision
97726
Author
[email protected]
Date
2011-10-18 01:04:38 -0700 (Tue, 18 Oct 2011)

Log Message

Web Inspector: [Chromium] Different dimensions are reported for elements onscreen and in the Metrics pane
https://bugs.webkit.org/show_bug.cgi?id=70242

Reviewed by Pavel Feldman.

* inspector/DOMNodeHighlighter.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97725 => 97726)


--- trunk/Source/WebCore/ChangeLog	2011-10-18 07:20:17 UTC (rev 97725)
+++ trunk/Source/WebCore/ChangeLog	2011-10-18 08:04:38 UTC (rev 97726)
@@ -1,3 +1,12 @@
+2011-10-17  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: [Chromium] Different dimensions are reported for elements onscreen and in the Metrics pane
+        https://bugs.webkit.org/show_bug.cgi?id=70242
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/DOMNodeHighlighter.cpp:
+
 2011-10-18  Kentaro Hara  <[email protected]>
 
         Unreviewed, rolling out r97697.

Modified: trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp (97725 => 97726)


--- trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2011-10-18 07:20:17 UTC (rev 97725)
+++ trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2011-10-18 08:04:38 UTC (rev 97726)
@@ -41,7 +41,9 @@
 #include "Node.h"
 #include "Page.h"
 #include "Range.h"
+#include "RenderBoxModelObject.h"
 #include "RenderInline.h"
+#include "RenderObject.h"
 #include "Settings.h"
 #include "StyledElement.h"
 #include "TextRun.h"
@@ -218,7 +220,7 @@
     }
 }
 
-void drawElementTitle(GraphicsContext& context, Node* node, const LayoutRect& boundingBox, const LayoutRect& anchorBox, const FloatRect& overlayRect, WebCore::Settings* settings)
+void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* renderer, const LayoutRect& boundingBox, const LayoutRect& anchorBox, const FloatRect& overlayRect, WebCore::Settings* settings)
 {
 
     DEFINE_STATIC_LOCAL(Color, backgroundColor, (255, 255, 194));
@@ -263,10 +265,12 @@
         }
     }
 
-    String widthNumberPart = " " + String::number(boundingBox.width());
+    RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderBoxModelObject(renderer) : 0;
+
+    String widthNumberPart = " " + String::number(modelObject ? adjustForAbsoluteZoom(modelObject->offsetWidth(), modelObject) : boundingBox.width());
     nodeTitle += widthNumberPart + pxString;
     nodeTitle += timesString;
-    String heightNumberPart = String::number(boundingBox.height());
+    String heightNumberPart = String::number(modelObject ? adjustForAbsoluteZoom(modelObject->offsetHeight(), modelObject) : boundingBox.height());
     nodeTitle += heightNumberPart + pxString;
 
     FontDescription desc;
@@ -442,7 +446,7 @@
         return;
 
     if (highlightData->showInfo)
-        drawElementTitle(context, node, boundingBox, titleAnchorBox, overlayRect, containingFrame->settings());
+        drawElementTitle(context, node, renderer, boundingBox, titleAnchorBox, overlayRect, containingFrame->settings());
 }
 
 void drawRectHighlight(GraphicsContext& context, Document* document, HighlightData* highlightData)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to