Changeset 79167 in webkit


Ignore:
Timestamp:
Feb 20, 2011 7:06:48 PM (13 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/9028929> REGRESSION (r75897): Scaling applied twice to an iframe with a transformed ancestor

Reviewed by Maciej Stachowiak.

Source/WebCore:

Test: fast/frames/iframe-scale-applied-twice.html

  • page/FrameView.cpp:

(WebCore::FrameView::create): Set the initial bounds of the view to match the
frame size.

  • platform/ScrollView.cpp:

(WebCore::ScrollView::visibleContentRect): Based on bounds, not frame size.
(WebCore::ScrollView::updateScrollbars): Ditto.
(WebCore::ScrollView::setFrameRect): Moved code that really handles bounds size
change to setBoundsSize().
(WebCore::ScrollView::setBoundsSize): Added.
(WebCore::ScrollView::setInitialBoundsSize): Added. Sets the bounds size but does
not update anything.
(WebCore::ScrollView::frameRectsChanged): Based on bounds, not frame size.
(WebCore::ScrollView::scrollbarCornerPresent): Ditto.

  • platform/ScrollView.h:

(WebCore::ScrollView::boundsSize): Added this getter.

  • platform/Widget.h:

(WebCore::Widget::resize): Set the bounds size to the frame size.

  • platform/mac/ScrollbarThemeMac.mm:

(WebCore::ScrollbarThemeMac::paint): Fixed an error in the indirect drawing code
path where the buffer rect was resized to capture only the damaged part, but was
still drawn in the original location.

LayoutTests:

  • fast/frames/iframe-scale-applied-twice-expected.txt: Added.
  • fast/frames/iframe-scale-applied-twice.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r79161 r79167  
     12011-02-20  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        <rdar://problem/9028929> REGRESSION (r75897): Scaling applied twice to an iframe with a transformed ancestor
     6
     7        * fast/frames/iframe-scale-applied-twice-expected.txt: Added.
     8        * fast/frames/iframe-scale-applied-twice.html: Added.
     9
    1102011-02-20  Ami Fischman  <fischman@chromium.org>
    211
  • trunk/Source/WebCore/ChangeLog

    r79159 r79167  
     12011-02-20  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        <rdar://problem/9028929> REGRESSION (r75897): Scaling applied twice to an iframe with a transformed ancestor
     6
     7        Test: fast/frames/iframe-scale-applied-twice.html
     8
     9        * page/FrameView.cpp:
     10        (WebCore::FrameView::create): Set the initial bounds of the view to match the
     11        frame size.
     12        * platform/ScrollView.cpp:
     13        (WebCore::ScrollView::visibleContentRect): Based on bounds, not frame size.
     14        (WebCore::ScrollView::updateScrollbars): Ditto.
     15        (WebCore::ScrollView::setFrameRect): Moved code that really handles bounds size
     16        change to setBoundsSize().
     17        (WebCore::ScrollView::setBoundsSize): Added.
     18        (WebCore::ScrollView::setInitialBoundsSize): Added. Sets the bounds size but does
     19        not update anything.
     20        (WebCore::ScrollView::frameRectsChanged): Based on bounds, not frame size.
     21        (WebCore::ScrollView::scrollbarCornerPresent): Ditto.
     22        * platform/ScrollView.h:
     23        (WebCore::ScrollView::boundsSize): Added this getter.
     24        * platform/Widget.h:
     25        (WebCore::Widget::resize): Set the bounds size to the frame size.
     26        * platform/mac/ScrollbarThemeMac.mm:
     27        (WebCore::ScrollbarThemeMac::paint): Fixed an error in the indirect drawing code
     28        path where the buffer rect was resized to capture only the damaged part, but was
     29        still drawn in the original location.
     30
    1312011-02-20  Alexey Proskuryakov  <ap@apple.com>
    232
  • trunk/Source/WebCore/page/FrameView.cpp

    r79053 r79167  
    157157    RefPtr<FrameView> view = adoptRef(new FrameView(frame));
    158158    view->Widget::setFrameRect(IntRect(view->pos(), initialSize));
     159    view->setInitialBoundsSize(initialSize);
    159160    view->show();
    160161    return view.release();
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r78928 r79167  
    241241
    242242    return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()),
    243                    IntSize(max(0, width() - verticalScrollbarWidth),
    244                            max(0, height() - horizontalScrollbarHeight)));
     243                   IntSize(max(0, m_boundsSize.width() - verticalScrollbarWidth),
     244                           max(0, m_boundsSize.height() - horizontalScrollbarHeight)));
    245245}
    246246#endif
     
    471471       
    472472        IntSize docSize = contentsSize();
    473         IntSize frameSize = frameRect().size();
     473        IntSize frameSize = m_boundsSize;
    474474
    475475        if (hScroll == ScrollbarAuto) {
     
    536536        IntRect oldRect(m_horizontalScrollbar->frameRect());
    537537        IntRect hBarRect = IntRect(0,
    538                                    height() - m_horizontalScrollbar->height(),
    539                                    width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
     538                                   m_boundsSize.height() - m_horizontalScrollbar->height(),
     539                                   m_boundsSize.width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
    540540                                   m_horizontalScrollbar->height());
    541541        m_horizontalScrollbar->setFrameRect(hBarRect);
     
    556556        int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);
    557557        IntRect oldRect(m_verticalScrollbar->frameRect());
    558         IntRect vBarRect = IntRect(width() - m_verticalScrollbar->width(),
     558        IntRect vBarRect = IntRect(m_boundsSize.width() - m_verticalScrollbar->width(),
    559559                                   0,
    560560                                   m_verticalScrollbar->width(),
    561                                    height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
     561                                   m_boundsSize.height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
    562562        m_verticalScrollbar->setFrameRect(vBarRect);
    563563        if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect())
     
    795795
    796796    Widget::setFrameRect(newRect);
    797 
    798     if (platformWidget())
    799         return;
    800    
    801     if (newRect.width() != oldRect.width() || newRect.height() != oldRect.height()) {
    802         updateScrollbars(m_scrollOffset);
    803         if (!m_useFixedLayout)
    804             contentsResized();
    805     }
     797}
     798
     799void ScrollView::setBoundsSize(const IntSize& newSize)
     800{
     801    if (newSize == m_boundsSize)
     802        return;
     803
     804    Widget::setBoundsSize(newSize);
     805    m_boundsSize = newSize;
     806
     807    if (platformWidget())
     808        return;
     809
     810    updateScrollbars(m_scrollOffset);
     811    if (!m_useFixedLayout)
     812        contentsResized();
    806813
    807814    frameRectsChanged();
     815}
     816
     817void ScrollView::setInitialBoundsSize(const IntSize& newSize)
     818{
     819    ASSERT(m_boundsSize.isZero());
     820    m_boundsSize = newSize;
    808821}
    809822
     
    842855        return cornerRect;
    843856
    844     if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) {
     857    if (m_horizontalScrollbar && m_boundsSize.width() - m_horizontalScrollbar->width() > 0) {
    845858        cornerRect.unite(IntRect(m_horizontalScrollbar->width(),
    846                                  height() - m_horizontalScrollbar->height(),
    847                                  width() - m_horizontalScrollbar->width(),
     859                                 m_boundsSize.height() - m_horizontalScrollbar->height(),
     860                                 m_boundsSize.width() - m_horizontalScrollbar->width(),
    848861                                 m_horizontalScrollbar->height()));
    849862    }
    850863
    851     if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) {
    852         cornerRect.unite(IntRect(width() - m_verticalScrollbar->width(),
     864    if (m_verticalScrollbar && m_boundsSize.height() - m_verticalScrollbar->height() > 0) {
     865        cornerRect.unite(IntRect(m_boundsSize.width() - m_verticalScrollbar->width(),
    853866                                 m_verticalScrollbar->height(),
    854867                                 m_verticalScrollbar->width(),
    855                                  height() - m_verticalScrollbar->height()));
     868                                 m_boundsSize.height() - m_verticalScrollbar->height()));
    856869    }
    857870   
     
    10131026bool ScrollView::scrollbarCornerPresent() const
    10141027{
    1015     return (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) ||
    1016            (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0);
     1028    return (m_horizontalScrollbar && m_boundsSize.width() - m_horizontalScrollbar->width() > 0) ||
     1029           (m_verticalScrollbar && m_boundsSize.height() - m_verticalScrollbar->height() > 0);
    10171030}
    10181031
  • trunk/Source/WebCore/platform/ScrollView.h

    r78928 r79167  
    223223    // Widget override to update our scrollbars and notify our contents of the resize.
    224224    virtual void setFrameRect(const IntRect&);
     225    virtual void setBoundsSize(const IntSize&);
    225226
    226227    // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
     
    287288    virtual void contentsResized() = 0;
    288289    virtual void visibleContentsResized() = 0;
     290
     291    IntSize boundsSize() const { return m_boundsSize; }
     292    void setInitialBoundsSize(const IntSize&);
    289293
    290294    // These functions are used to create/destroy scrollbars.
     
    356360    // vertical-rl / rtl            YES                     YES
    357361    IntPoint m_scrollOrigin;
     362
     363    IntSize m_boundsSize;
    358364
    359365    void init();
  • trunk/Source/WebCore/platform/Widget.h

    r75897 r79167  
    158158    IntRect boundsRect() const { return IntRect(0, 0, width(),  height()); }
    159159
    160     void resize(int w, int h) { setFrameRect(IntRect(x(), y(), w, h)); }
    161     void resize(const IntSize& s) { setFrameRect(IntRect(pos(), s)); }
     160    void resize(int w, int h) { setFrameRect(IntRect(x(), y(), w, h)); setBoundsSize(IntSize(w, h)); }
     161    void resize(const IntSize& s) { setFrameRect(IntRect(pos(), s)); setBoundsSize(s); }
    162162    void move(int x, int y) { setFrameRect(IntRect(x, y, width(), height())); }
    163163    void move(const IntPoint& p) { setFrameRect(IntRect(p, size())); }
  • trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm

    r78917 r79167  
    514514        IntRect bufferRect(scrollbar->frameRect());
    515515        bufferRect.intersect(damageRect);
    516         bufferRect.move(-scrollbar->frameRect().x(), -scrollbar->frameRect().y());
    517516       
    518517        OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(bufferRect.size());
    519518        if (!imageBuffer)
    520519            return true;
    521        
     520
     521        imageBuffer->context()->translate(scrollbar->frameRect().x() - bufferRect.x(), scrollbar->frameRect().y() - bufferRect.y());
    522522        HIThemeDrawTrack(&trackInfo, 0, imageBuffer->context()->platformContext(), kHIThemeOrientationNormal);
    523         context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, scrollbar->frameRect().location());
     523        context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, bufferRect.location());
    524524    }
    525525
Note: See TracChangeset for help on using the changeset viewer.