Changeset 194210 in webkit


Ignore:
Timestamp:
Dec 16, 2015 10:56:55 PM (8 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r194209 r194210  
     12015-12-16  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fix the debug region overlays for RTL documents
     4        https://bugs.webkit.org/show_bug.cgi?id=152372
     5
     6        Reviewed by Darin Adler.
     7       
     8        Fix document overlays to use document coordinates when painting, which requires
     9        translating the CTM, and counter-translating the dirtyRect by the scroll origin.
     10        This is only non-zero for RTL documents.
     11       
     12        While doing this, I noticed that the scroll origin was misplaced by the scrollbar
     13        width when using overlay scrollbars. Fix by using occupiedWidth/Height() in
     14        ScrollView::updateScrollbars(). I was not able to make a test for this change.
     15
     16        * page/FrameView.cpp:
     17        (WebCore::FrameView::adjustViewSize):
     18        * page/PageOverlay.cpp:
     19        (WebCore::PageOverlay::drawRect):
     20        * platform/ScrollView.cpp:
     21        (WebCore::ScrollView::updateScrollbars):
     22
    1232015-12-16  Andy Estes  <aestes@apple.com>
    224
  • trunk/Source/WebCore/page/FrameView.cpp

    r194184 r194210  
    642642    ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !frame().document()->printing(), size == contentsSize());
    643643
    644     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());
     644    LOG_WITH_STREAM(Layout, stream << "FrameView " << this << " adjustViewSize: unscaled document rect changed to " << renderView->unscaledDocumentRect() << " (scaled to " << size << ")");
    645645
    646646    setContentsSize(size);
  • trunk/Source/WebCore/page/PageOverlay.cpp

    r194117 r194210  
    179179
    180180    GraphicsContextStateSaver stateSaver(graphicsContext);
     181
     182    if (m_overlayType == PageOverlay::OverlayType::Document) {
     183        if (FrameView* frameView = m_page->mainFrame().view()) {
     184            auto offset = frameView->scrollOrigin();
     185            graphicsContext.translate(toFloatSize(offset));
     186            paintRect.moveBy(-offset);
     187        }
     188    }
     189
    181190    m_client.drawRect(*this, graphicsContext, paintRect);
    182191}
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r194184 r194210  
    660660        if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizontalScrollbar || !avoidScrollbarCreation())) {
    661661            if (scrollOrigin().y() && !newHasHorizontalScrollbar)
    662                 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scrollOrigin().y() - m_horizontalScrollbar->height()));
     662                ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scrollOrigin().y() - m_horizontalScrollbar->occupiedHeight()));
    663663            if (m_horizontalScrollbar)
    664664                m_horizontalScrollbar->invalidate();
     
    673673        if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrollbar || !avoidScrollbarCreation())) {
    674674            if (scrollOrigin().x() && !newHasVerticalScrollbar)
    675                 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_verticalScrollbar->width(), scrollOrigin().y()));
     675                ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_verticalScrollbar->occupiedWidth(), scrollOrigin().y()));
    676676            if (m_verticalScrollbar)
    677677                m_verticalScrollbar->invalidate();
Note: See TracChangeset for help on using the changeset viewer.