[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

apavlov at chromium.org apavlov at chromium.org
Wed Dec 22 15:48:02 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e97e7f18d288143e5da08afbde2a5dbc7f02ed40
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 12 17:55:46 2010 +0000

    2010-11-11  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: Inspect element tooltip obscures element metrics
            https://bugs.webkit.org/show_bug.cgi?id=47822
    
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::drawNodeHighlight):
            (WebCore::InspectorController::drawElementTitle):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71922 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 42cef37..eb3040a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-11  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: Inspect element tooltip obscures element metrics
+        https://bugs.webkit.org/show_bug.cgi?id=47822
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::drawNodeHighlight):
+        (WebCore::InspectorController::drawElementTitle):
+
 2010-11-12  Luiz Agostini  <luiz.agostini at openbossa.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index cda3972..d3a7a49 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -1613,6 +1613,8 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const
     IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
     boundingBox.move(mainFrameOffset);
 
+    IntRect titleReferenceBox = boundingBox;
+
     ASSERT(m_inspectedPage);
 
     FrameView* view = m_inspectedPage->mainFrame()->view();
@@ -1640,6 +1642,10 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const
         IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
                           borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
 
+        titleReferenceBox = marginBox;
+        titleReferenceBox.move(mainFrameOffset);
+        titleReferenceBox.move(boundingBox.x(), boundingBox.y());
+
         FloatQuad absContentQuad = renderBox->localToAbsoluteQuad(FloatRect(contentBox));
         FloatQuad absPaddingQuad = renderBox->localToAbsoluteQuad(FloatRect(paddingBox));
         FloatQuad absBorderQuad = renderBox->localToAbsoluteQuad(FloatRect(borderBox));
@@ -1667,7 +1673,7 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const
         return;
 
     WebCore::Settings* settings = containingFrame->settings();
-    drawElementTitle(context, boundingBox, overlayRect, settings);
+    drawElementTitle(context, titleReferenceBox, overlayRect, settings);
 }
 
 void InspectorController::drawElementTitle(GraphicsContext& context, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings* settings) const
@@ -1725,12 +1731,27 @@ void InspectorController::drawElementTitle(GraphicsContext& context, const IntRe
     // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle).
     int dx = -borderWidthPx;
     int dy = borderWidthPx;
+
+    // If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
     if (titleRect.right() > overlayRect.right())
-        dx += overlayRect.right() - titleRect.right();
+        dx = overlayRect.right() - titleRect.right();
+
+    // If the tip sticks beyond the left of overlayRect, left-align the tip with the said boundary.
     if (titleRect.x() + dx < overlayRect.x())
-        dx = overlayRect.x() - titleRect.x();
-    if (titleRect.bottom() > overlayRect.bottom())
-        dy += overlayRect.bottom() - titleRect.bottom() - borderWidthPx;
+        dx = overlayRect.x() - titleRect.x() - borderWidthPx;
+
+    // If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
+    if (titleRect.bottom() > overlayRect.bottom()) {
+        dy = boundingBox.y() - titleRect.bottom() - borderWidthPx;
+        // If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
+        if (titleRect.bottom() + dy > overlayRect.bottom())
+            dy = overlayRect.bottom() - titleRect.bottom();
+    }
+
+    // If the tip sticks beyond the top of overlayRect, show the tip at top of overlayRect.
+    if (titleRect.y() + dy < overlayRect.y())
+        dy = overlayRect.y() - titleRect.y() + borderWidthPx;
+
     titleRect.move(dx, dy);
     context.setStrokeColor(tooltipBorderColor, ColorSpaceDeviceRGB);
     context.setStrokeThickness(borderWidthPx);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list