Title: [194210] trunk/Source/WebCore
Revision
194210
Author
[email protected]
Date
2015-12-16 22:56:55 -0800 (Wed, 16 Dec 2015)

Log Message

Fix the debug region overlays for RTL documents
https://bugs.webkit.org/show_bug.cgi?id=152372

Reviewed by Darin Adler.

Fix document overlays to use document coordinates when painting, which requires
translating the CTM, and counter-translating the dirtyRect by the scroll origin.
This is only non-zero for RTL documents.

While doing this, I noticed that the scroll origin was misplaced by the scrollbar
width when using overlay scrollbars. Fix by using occupiedWidth/Height() in
ScrollView::updateScrollbars(). I was not able to make a test for this change.

* page/FrameView.cpp:
(WebCore::FrameView::adjustViewSize):
* page/PageOverlay.cpp:
(WebCore::PageOverlay::drawRect):
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (194209 => 194210)


--- trunk/Source/WebCore/ChangeLog	2015-12-17 05:53:40 UTC (rev 194209)
+++ trunk/Source/WebCore/ChangeLog	2015-12-17 06:56:55 UTC (rev 194210)
@@ -1,3 +1,25 @@
+2015-12-16  Simon Fraser  <[email protected]>
+
+        Fix the debug region overlays for RTL documents
+        https://bugs.webkit.org/show_bug.cgi?id=152372
+
+        Reviewed by Darin Adler.
+        
+        Fix document overlays to use document coordinates when painting, which requires
+        translating the CTM, and counter-translating the dirtyRect by the scroll origin.
+        This is only non-zero for RTL documents.
+        
+        While doing this, I noticed that the scroll origin was misplaced by the scrollbar
+        width when using overlay scrollbars. Fix by using occupiedWidth/Height() in
+        ScrollView::updateScrollbars(). I was not able to make a test for this change.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustViewSize):
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::drawRect):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::updateScrollbars):
+
 2015-12-16  Andy Estes  <[email protected]>
 
         [iOS] Block loading external stylesheets in the Content-Disposition: attachment sandbox

Modified: trunk/Source/WebCore/page/FrameView.cpp (194209 => 194210)


--- trunk/Source/WebCore/page/FrameView.cpp	2015-12-17 05:53:40 UTC (rev 194209)
+++ trunk/Source/WebCore/page/FrameView.cpp	2015-12-17 06:56:55 UTC (rev 194210)
@@ -641,7 +641,7 @@
     const IntSize& size = rect.size();
     ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !frame().document()->printing(), size == contentsSize());
 
-    LOG(Layout, "FrameView %p adjustViewSize: unscaled document size changed to %dx%d (scaled to %dx%d)", this, renderView->unscaledDocumentRect().width(), renderView->unscaledDocumentRect().height(), size.width(), size.height());
+    LOG_WITH_STREAM(Layout, stream << "FrameView " << this << " adjustViewSize: unscaled document rect changed to " << renderView->unscaledDocumentRect() << " (scaled to " << size << ")");
 
     setContentsSize(size);
 }

Modified: trunk/Source/WebCore/page/PageOverlay.cpp (194209 => 194210)


--- trunk/Source/WebCore/page/PageOverlay.cpp	2015-12-17 05:53:40 UTC (rev 194209)
+++ trunk/Source/WebCore/page/PageOverlay.cpp	2015-12-17 06:56:55 UTC (rev 194210)
@@ -178,6 +178,15 @@
         return;
 
     GraphicsContextStateSaver stateSaver(graphicsContext);
+
+    if (m_overlayType == PageOverlay::OverlayType::Document) {
+        if (FrameView* frameView = m_page->mainFrame().view()) {
+            auto offset = frameView->scrollOrigin();
+            graphicsContext.translate(toFloatSize(offset));
+            paintRect.moveBy(-offset);
+        }
+    }
+
     m_client.drawRect(*this, graphicsContext, paintRect);
 }
     

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (194209 => 194210)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2015-12-17 05:53:40 UTC (rev 194209)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2015-12-17 06:56:55 UTC (rev 194210)
@@ -659,7 +659,7 @@
 
         if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizontalScrollbar || !avoidScrollbarCreation())) {
             if (scrollOrigin().y() && !newHasHorizontalScrollbar)
-                ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scrollOrigin().y() - m_horizontalScrollbar->height()));
+                ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scrollOrigin().y() - m_horizontalScrollbar->occupiedHeight()));
             if (m_horizontalScrollbar)
                 m_horizontalScrollbar->invalidate();
 
@@ -672,7 +672,7 @@
 
         if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrollbar || !avoidScrollbarCreation())) {
             if (scrollOrigin().x() && !newHasVerticalScrollbar)
-                ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_verticalScrollbar->width(), scrollOrigin().y()));
+                ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_verticalScrollbar->occupiedWidth(), scrollOrigin().y()));
             if (m_verticalScrollbar)
                 m_verticalScrollbar->invalidate();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to