Title: [102456] trunk/Source/WebCore
Revision
102456
Author
[email protected]
Date
2011-12-09 09:38:17 -0800 (Fri, 09 Dec 2011)

Log Message

Inspector: Don't translate the context when rendering the highlights on a tiled layer.
https://bugs.webkit.org/show_bug.cgi?id=74085

Reviewed by Kenneth Rohde Christiansen.

When the frame view is using fixed layouting, the page overlay is the size of the whole
page and the context shouldn't be translated. The visible rect is still used in that
case to display element titles within the visible rect.

Also:
- Rename overlayRect to visibleRect to reduce confusion in this case.
- Remove the superfluous boundingBox check.

* inspector/DOMNodeHighlighter.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102455 => 102456)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 17:35:12 UTC (rev 102455)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 17:38:17 UTC (rev 102456)
@@ -1,3 +1,20 @@
+2011-12-08  Jocelyn Turcotte  <[email protected]>
+
+        Inspector: Don't translate the context when rendering the highlights on a tiled layer.
+        https://bugs.webkit.org/show_bug.cgi?id=74085
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        When the frame view is using fixed layouting, the page overlay is the size of the whole
+        page and the context shouldn't be translated. The visible rect is still used in that
+        case to display element titles within the visible rect.
+
+        Also:
+        - Rename overlayRect to visibleRect to reduce confusion in this case.
+        - Remove the superfluous boundingBox check.
+
+        * inspector/DOMNodeHighlighter.cpp:
+
 2011-12-09  Vsevolod Vlasov  <[email protected]>
 
         Unreviewed inspector utilities syntax fix.

Modified: trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp (102455 => 102456)


--- trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2011-12-09 17:35:12 UTC (rev 102455)
+++ trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp	2011-12-09 17:38:17 UTC (rev 102456)
@@ -221,7 +221,7 @@
     }
 }
 
-void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* renderer, 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& visibleRect, WebCore::Settings* settings)
 {
 
     DEFINE_STATIC_LOCAL(Color, backgroundColor, (255, 255, 194));
@@ -292,25 +292,25 @@
     LayoutUnit dx = -borderWidthPx;
     LayoutUnit dy = borderWidthPx;
 
-    // If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
-    if (titleRect.maxX() + dx > overlayRect.maxX())
-        dx = overlayRect.maxX() - titleRect.maxX();
+    // If the tip sticks beyond the right of visibleRect, right-align the tip with the said boundary.
+    if (titleRect.maxX() + dx > visibleRect.maxX())
+        dx = visibleRect.maxX() - titleRect.maxX();
 
-    // 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() - borderWidthPx;
+    // If the tip sticks beyond the left of visibleRect, left-align the tip with the said boundary.
+    if (titleRect.x() + dx < visibleRect.x())
+        dx = visibleRect.x() - titleRect.x() - borderWidthPx;
 
-    // If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
-    if (titleRect.maxY() + dy > overlayRect.maxY()) {
+    // If the tip sticks beyond the bottom of visibleRect, show the tip at top of bounding box.
+    if (titleRect.maxY() + dy > visibleRect.maxY()) {
         dy = anchorBox.y() - titleRect.maxY() - borderWidthPx;
-        // If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
-        if (titleRect.maxY() + dy > overlayRect.maxY())
-            dy = overlayRect.maxY() - titleRect.maxY();
+        // If the tip still sticks beyond the bottom of visibleRect, bottom-align the tip with the said boundary.
+        if (titleRect.maxY() + dy > visibleRect.maxY())
+            dy = visibleRect.maxY() - titleRect.maxY();
     }
 
-    // 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;
+    // If the tip sticks beyond the top of visibleRect, show the tip at top of visibleRect.
+    if (titleRect.y() + dy < visibleRect.y())
+        dy = visibleRect.y() - titleRect.y() + borderWidthPx;
 
     titleRect.move(dx, dy);
 
@@ -376,10 +376,10 @@
     LayoutRect titleAnchorBox = boundingBox;
 
     FrameView* view = containingFrame->page()->mainFrame()->view();
-    FloatRect overlayRect = view->visibleContentRect();
-    if (!overlayRect.contains(boundingBox) && !boundingBox.contains(enclosingLayoutRect(overlayRect)))
-        overlayRect = view->visibleContentRect();
-    context.translate(-overlayRect.x(), -overlayRect.y());
+    FloatRect visibleRect = view->visibleContentRect();
+    // Don't translate the context if the frame is rendered in page coordinates.
+    if (!view->delegatesScrolling())
+        context.translate(-visibleRect.x(), -visibleRect.y());
 
     // RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
 #if ENABLE(SVG)
@@ -450,7 +450,7 @@
         return;
 
     if (highlightData->showInfo)
-        drawElementTitle(context, node, renderer, boundingBox, titleAnchorBox, overlayRect, containingFrame->settings());
+        drawElementTitle(context, node, renderer, boundingBox, titleAnchorBox, visibleRect, containingFrame->settings());
 }
 
 void drawRectHighlight(GraphicsContext& context, Document* document, HighlightData* highlightData)
@@ -459,8 +459,9 @@
         return;
     FrameView* view = document->frame()->view();
 
-    FloatRect overlayRect = view->visibleContentRect();
-    context.translate(-overlayRect.x(), -overlayRect.y());
+    FloatRect visibleRect = view->visibleContentRect();
+    if (!view->delegatesScrolling())
+        context.translate(-visibleRect.x(), -visibleRect.y());
 
     FloatRect highlightRect(*(highlightData->rect));
     drawOutlinedQuad(context, highlightRect, highlightData->content, highlightData->contentOutline);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to