Changeset 95725 in webkit


Ignore:
Timestamp:
Sep 22, 2011 10:09:22 AM (13 years ago)
Author:
andersca@apple.com
Message:

Get rid of Widget::setBoundsSize
https://bugs.webkit.org/show_bug.cgi?id=68491

Reviewed by Sam Weinig.

This basically reverts http://trac.webkit.org/changeset/79167 and http://trac.webkit.org/changeset/75897
which were added to make zoom gestures work with WebKit1, but since we don't support zoom gestures in WebKit1
anymore, it's better for code cleanliness to get rid of Widget::setBoundsSize and the associated code. While this
will unfortunately break transformed iframes in WebKit1, but Simon says that it's an acceptable tradeoff.

Source/WebCore:

  • WebCore.exp.in:
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::open):

  • page/FrameView.cpp:

(WebCore::FrameView::create):

  • platform/ScrollView.cpp:

(WebCore::ScrollView::visibleContentRect):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::wheelEvent):

  • platform/ScrollView.h:
  • platform/Widget.cpp:
  • platform/Widget.h:

(WebCore::Widget::resize):

  • platform/chromium/PopupContainer.cpp:

(WebCore::PopupContainer::refresh):

  • platform/gtk/ScrollViewGtk.cpp:

(WebCore::ScrollView::visibleContentRect):

  • platform/mac/WidgetMac.mm:

(WebCore::Widget::paint):

  • rendering/RenderWidget.cpp:

(WebCore::RenderWidget::setWidgetGeometry):
(WebCore::RenderWidget::setWidget):
(WebCore::RenderWidget::updateWidgetPosition):

  • rendering/RenderWidget.h:

Source/WebKit/mac:

  • Plugins/Hosted/WebHostedNetscapePluginView.mm:

(-[WebHostedNetscapePluginView updateAndSetWindow]):

  • WebView/WebFrameView.mm:
Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95724 r95725  
     12011-09-22  Anders Carlsson  <andersca@apple.com>
     2
     3        Get rid of Widget::setBoundsSize
     4        https://bugs.webkit.org/show_bug.cgi?id=68491
     5
     6        Reviewed by Sam Weinig.
     7
     8        This basically reverts http://trac.webkit.org/changeset/79167 and http://trac.webkit.org/changeset/75897
     9        which were added to make zoom gestures work with WebKit1, but since we don't support zoom gestures in WebKit1
     10        anymore, it's better for code cleanliness to get rid of Widget::setBoundsSize and the associated code. While this
     11        will unfortunately break transformed iframes in WebKit1, but Simon says that it's an acceptable tradeoff.
     12
     13        * WebCore.exp.in:
     14        * loader/FrameLoader.cpp:
     15        (WebCore::FrameLoader::open):
     16        * page/FrameView.cpp:
     17        (WebCore::FrameView::create):
     18        * platform/ScrollView.cpp:
     19        (WebCore::ScrollView::visibleContentRect):
     20        (WebCore::ScrollView::updateScrollbars):
     21        (WebCore::ScrollView::wheelEvent):
     22        * platform/ScrollView.h:
     23        * platform/Widget.cpp:
     24        * platform/Widget.h:
     25        (WebCore::Widget::resize):
     26        * platform/chromium/PopupContainer.cpp:
     27        (WebCore::PopupContainer::refresh):
     28        * platform/gtk/ScrollViewGtk.cpp:
     29        (WebCore::ScrollView::visibleContentRect):
     30        * platform/mac/WidgetMac.mm:
     31        (WebCore::Widget::paint):
     32        * rendering/RenderWidget.cpp:
     33        (WebCore::RenderWidget::setWidgetGeometry):
     34        (WebCore::RenderWidget::setWidget):
     35        (WebCore::RenderWidget::updateWidgetPosition):
     36        * rendering/RenderWidget.h:
     37
    1382011-09-21  David Hyatt  <hyatt@apple.com>
    239
  • trunk/Source/WebCore/WebCore.exp.in

    r95717 r95725  
    826826__ZN7WebCore6RegionC1Ev
    827827__ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE
    828 __ZN7WebCore6Widget13setBoundsSizeERKNS_7IntSizeE
    829828__ZN7WebCore6Widget16removeFromParentEv
    830829__ZN7WebCore6Widget17frameRectsChangedEv
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r95593 r95725  
    20622062
    20632063    // Use the current ScrollView's frame rect.
    2064     if (m_frame->view()) {
    2065         IntRect rect = m_frame->view()->frameRect();
    2066         view->setFrameRect(rect);
    2067         view->setBoundsSize(rect.size());
    2068     }
     2064    if (m_frame->view())
     2065        view->setFrameRect(m_frame->view()->frameRect());
    20692066    m_frame->setView(view);
    20702067   
  • trunk/Source/WebCore/page/FrameView.cpp

    r95715 r95725  
    163163    RefPtr<FrameView> view = adoptRef(new FrameView(frame));
    164164    view->Widget::setFrameRect(LayoutRect(view->location(), initialSize));
    165     view->setInitialBoundsSize(initialSize);
    166165    view->show();
    167166    return view.release();
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r95570 r95725  
    238238
    239239    return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()),
    240                    IntSize(max(0, m_boundsSize.width() - verticalScrollbarWidth),
    241                            max(0, m_boundsSize.height() - horizontalScrollbarHeight)));
     240                   IntSize(max(0, width() - verticalScrollbarWidth),
     241                           max(0, height() - horizontalScrollbarHeight)));
    242242}
    243243#endif
     
    471471       
    472472        IntSize docSize = contentsSize();
    473         IntSize frameSize = m_boundsSize;
     473        IntSize frameSize = frameRect().size();
    474474
    475475        if (hScroll == ScrollbarAuto) {
     
    533533        IntRect oldRect(m_horizontalScrollbar->frameRect());
    534534        IntRect hBarRect = IntRect(0,
    535                                    m_boundsSize.height() - m_horizontalScrollbar->height(),
    536                                    m_boundsSize.width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
     535                                   height() - m_horizontalScrollbar->height(),
     536                                   width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
    537537                                   m_horizontalScrollbar->height());
    538538        m_horizontalScrollbar->setFrameRect(hBarRect);
     
    553553        int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);
    554554        IntRect oldRect(m_verticalScrollbar->frameRect());
    555         IntRect vBarRect = IntRect(m_boundsSize.width() - m_verticalScrollbar->width(),
     555        IntRect vBarRect = IntRect(width() - m_verticalScrollbar->width(),
    556556                                   0,
    557557                                   m_verticalScrollbar->width(),
    558                                    m_boundsSize.height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
     558                                   height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
    559559        m_verticalScrollbar->setFrameRect(vBarRect);
    560560        if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect())
     
    828828}
    829829
    830 void ScrollView::setBoundsSize(const IntSize& newSize)
    831 {
    832     if (newSize == m_boundsSize)
    833         return;
    834 
    835     Widget::setBoundsSize(newSize);
    836     m_boundsSize = newSize;
    837 
    838     if (platformWidget())
    839         return;
    840 
    841     updateScrollbars(m_scrollOffset);
    842     if (!m_useFixedLayout)
    843         contentsResized();
    844 
    845     positionScrollbarLayers();
    846 }
    847 
    848 void ScrollView::setInitialBoundsSize(const IntSize& newSize)
    849 {
    850     ASSERT(m_boundsSize.isZero());
    851     m_boundsSize = newSize;
    852 }
    853 
    854830void ScrollView::frameRectsChanged()
    855831{
     
    922898        return cornerRect;
    923899
    924     if (m_horizontalScrollbar && m_boundsSize.width() - m_horizontalScrollbar->width() > 0) {
     900    if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) {
    925901        cornerRect.unite(IntRect(m_horizontalScrollbar->width(),
    926                                  m_boundsSize.height() - m_horizontalScrollbar->height(),
    927                                  m_boundsSize.width() - m_horizontalScrollbar->width(),
     902                                 height() - m_horizontalScrollbar->height(),
     903                                 width() - m_horizontalScrollbar->width(),
    928904                                 m_horizontalScrollbar->height()));
    929905    }
    930906
    931     if (m_verticalScrollbar && m_boundsSize.height() - m_verticalScrollbar->height() > 0) {
    932         cornerRect.unite(IntRect(m_boundsSize.width() - m_verticalScrollbar->width(),
     907    if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) {
     908        cornerRect.unite(IntRect(width() - m_verticalScrollbar->width(),
    933909                                 m_verticalScrollbar->height(),
    934910                                 m_verticalScrollbar->width(),
    935                                  m_boundsSize.height() - m_verticalScrollbar->height()));
     911                                 height() - m_verticalScrollbar->height()));
    936912    }
    937913   
     
    11331109bool ScrollView::scrollbarCornerPresent() const
    11341110{
    1135     return (m_horizontalScrollbar && m_boundsSize.width() - m_horizontalScrollbar->width() > 0) ||
    1136            (m_verticalScrollbar && m_boundsSize.height() - m_verticalScrollbar->height() > 0);
     1111    return (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0)
     1112        || (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0);
    11371113}
    11381114
  • trunk/Source/WebCore/platform/ScrollView.h

    r95570 r95725  
    228228    // Widget override to update our scrollbars and notify our contents of the resize.
    229229    virtual void setFrameRect(const IntRect&);
    230     virtual void setBoundsSize(const IntSize&);
    231230
    232231    // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
     
    303302    IntRect fixedVisibleContentRect() const { return m_fixedVisibleContentRect; }
    304303
    305     IntSize boundsSize() const { return m_boundsSize; }
    306     void setInitialBoundsSize(const IntSize&);
    307 
    308304    // These functions are used to create/destroy scrollbars.
    309305    void setHasHorizontalScrollbar(bool);
     
    363359
    364360    bool m_containsScrollableAreaWithOverlayScrollbars;
    365 
    366     IntSize m_boundsSize;
    367361
    368362    void init();
  • trunk/Source/WebCore/platform/Widget.cpp

    r90734 r95725  
    107107
    108108#if !PLATFORM(MAC)
    109 void Widget::setBoundsSize(const IntSize&)
    110 {
    111 }
    112 
    113109IntRect Widget::convertFromRootToContainingWindow(const Widget*, const IntRect& rect)
    114110{
  • trunk/Source/WebCore/platform/Widget.h

    r95673 r95725  
    150150
    151151    virtual void setFrameRect(const IntRect&);
    152     virtual void setBoundsSize(const IntSize&);
    153152    virtual IntRect frameRect() const;
    154153    IntRect boundsRect() const { return IntRect(0, 0, width(),  height()); }
    155154
    156     void resize(int w, int h) { setFrameRect(IntRect(x(), y(), w, h)); setBoundsSize(IntSize(w, h)); }
    157     void resize(const IntSize& s) { setFrameRect(IntRect(location(), s)); setBoundsSize(s); }
     155    void resize(int w, int h) { setFrameRect(IntRect(x(), y(), w, h)); }
     156    void resize(const IntSize& s) { setFrameRect(IntRect(location(), s)); }
    158157    void move(int x, int y) { setFrameRect(IntRect(x, y, width(), height())); }
    159158    void move(const IntPoint& p) { setFrameRect(IntRect(p, size())); }
  • trunk/Source/WebCore/platform/chromium/PopupContainer.cpp

    r94797 r95725  
    410410
    411411    listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0));
    412     setBoundsSize(m_originalFrameRect.size());
    413412
    414413    listBox()->updateFromElement();
  • trunk/Source/WebCore/platform/gtk/ScrollViewGtk.cpp

    r91707 r95725  
    7171    if (!shouldCreateMainFrameScrollbar(this)) {
    7272        return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()),
    73                        IntSize(max(0, m_boundsSize.width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)),
    74                                max(0, m_boundsSize.height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0))));
     73                       IntSize(max(0, width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)),
     74                               max(0, height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0))));
    7575    }
    7676
  • trunk/Source/WebCore/platform/mac/WidgetMac.mm

    r95673 r95725  
    3232#import "Cursor.h"
    3333#import "Document.h"
    34 #import "FloatConversion.h"
    3534#import "Font.h"
    3635#import "Frame.h"
     
    186185}
    187186
    188 void Widget::setBoundsSize(const IntSize& size)
    189 {
    190     NSSize nsSize = size;
    191 
    192     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    193     NSView *outerView = getOuterView();
    194     if (!outerView)
    195         return;
    196 
    197     // Take a reference to this Widget, because sending messages to outerView can invoke arbitrary
    198     // code, which can deref it.
    199     RefPtr<Widget> protectedThis(this);
    200     if (!NSEqualSizes(nsSize, [outerView bounds].size)) {
    201         [outerView setBoundsSize:nsSize];
    202         [outerView setNeedsDisplay:NO];
    203     }
    204     END_BLOCK_OBJC_EXCEPTIONS;
    205 }
    206 
    207187NSView *Widget::getOuterView() const
    208188{
     
    229209    RefPtr<Widget> protectedThis(this);
    230210
    231     IntPoint transformOrigin = frameRect().location();
    232     AffineTransform widgetToViewTranform = makeMapBetweenRects(IntRect(IntPoint(), frameRect().size()), [view bounds]);
    233 
    234211    NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
    235212    if (currentContext == [[view window] graphicsContext] || ![currentContext isDrawingToScreen]) {
    236213        // This is the common case of drawing into a window or printing.
    237214        BEGIN_BLOCK_OBJC_EXCEPTIONS;
    238        
    239         CGContextRef context = (CGContextRef)[currentContext graphicsPort];
    240 
    241         CGContextSaveGState(context);
    242         CGContextTranslateCTM(context, transformOrigin.x(), transformOrigin.y());
    243         CGContextScaleCTM(context, narrowPrecisionToFloat(widgetToViewTranform.xScale()), narrowPrecisionToFloat(widgetToViewTranform.yScale()));
    244         CGContextTranslateCTM(context, -transformOrigin.x(), -transformOrigin.y());
    245 
    246         IntRect dirtyRect = r;
    247         dirtyRect.moveBy(-transformOrigin);
    248         if (![view isFlipped])
    249             dirtyRect.setY([view bounds].size.height - dirtyRect.maxY());
    250 
    251         [view displayRectIgnoringOpacity:dirtyRect];
    252 
    253         CGContextRestoreGState(context);
    254 
     215        [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]];
    255216        END_BLOCK_OBJC_EXCEPTIONS;
    256217    } else {
     
    277238        CGContextSaveGState(cgContext);
    278239
    279         CGContextTranslateCTM(cgContext, transformOrigin.x(), transformOrigin.y());
    280         CGContextScaleCTM(cgContext, narrowPrecisionToFloat(widgetToViewTranform.xScale()), narrowPrecisionToFloat(widgetToViewTranform.yScale()));
    281         CGContextTranslateCTM(cgContext, -transformOrigin.x(), -transformOrigin.y());
    282 
    283240        NSRect viewFrame = [view frame];
    284241        NSRect viewBounds = [view bounds];
     
    288245        CGContextScaleCTM(cgContext, 1, -1);
    289246
    290         IntRect dirtyRect = r;
    291         dirtyRect.moveBy(-transformOrigin);
    292         if (![view isFlipped])
    293             dirtyRect.setY([view bounds].size.height - dirtyRect.maxY());
    294 
    295247        BEGIN_BLOCK_OBJC_EXCEPTIONS;
    296248        {
    297249            NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES];
    298             [view displayRectIgnoringOpacity:dirtyRect inContext:nsContext];
     250            [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:nsContext];
    299251        }
    300252        END_BLOCK_OBJC_EXCEPTIONS;
  • trunk/Source/WebCore/rendering/RenderWidget.cpp

    r95673 r95725  
    141141}
    142142
    143 bool RenderWidget::setWidgetGeometry(const IntRect& frame, const IntSize& boundsSize)
     143bool RenderWidget::setWidgetGeometry(const IntRect& frame)
    144144{
    145145    if (!node())
     
    158158    RefPtr<Node> protectedNode(node());
    159159    m_widget->setFrameRect(frame);
    160     if (m_widget) // setFrameRect can run arbitrary script, which might clear m_widget.
    161         m_widget->setBoundsSize(boundsSize);
    162160   
    163161#if USE(ACCELERATED_COMPOSITING)
     
    191189                if (m_widget->isFrameView()) {
    192190                    contentBox.setLocation(absoluteContentBox.location());
    193                     setWidgetGeometry(contentBox, contentBox.size());
     191                    setWidgetGeometry(contentBox);
    194192                } else
    195                     setWidgetGeometry(absoluteContentBox, contentBox.size());
     193                    setWidgetGeometry(absoluteContentBox);
    196194            }
    197195            if (style()->visibility() != VISIBLE)
     
    329327    if (m_widget->isFrameView()) {
    330328        contentBox.setLocation(absoluteContentBox.location());
    331         boundsChanged = setWidgetGeometry(contentBox, contentBox.size());
     329        boundsChanged = setWidgetGeometry(contentBox);
    332330    } else
    333         boundsChanged = setWidgetGeometry(absoluteContentBox, contentBox.size());
     331        boundsChanged = setWidgetGeometry(absoluteContentBox);
    334332   
    335333    // if the frame bounds got changed, or if view needs layout (possibly indicating
  • trunk/Source/WebCore/rendering/RenderWidget.h

    r92492 r95725  
    7070    virtual void setOverlapTestResult(bool);
    7171
    72     bool setWidgetGeometry(const IntRect&, const IntSize&);
     72    bool setWidgetGeometry(const IntRect&);
    7373
    7474    RefPtr<Widget> m_widget;
  • trunk/Source/WebKit/mac/ChangeLog

    r95678 r95725  
     12011-09-22  Anders Carlsson  <andersca@apple.com>
     2
     3        Get rid of Widget::setBoundsSize
     4        https://bugs.webkit.org/show_bug.cgi?id=68491
     5
     6        Reviewed by Sam Weinig.
     7
     8        This basically reverts http://trac.webkit.org/changeset/79167 and http://trac.webkit.org/changeset/75897
     9        which were added to make zoom gestures work with WebKit1, but since we don't support zoom gestures in WebKit1
     10        anymore, it's better for code cleanliness to get rid of Widget::setBoundsSize and the associated code. While this
     11        will unfortunately break transformed iframes in WebKit1, but Simon says that it's an acceptable tradeoff.
     12
     13        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
     14        (-[WebHostedNetscapePluginView updateAndSetWindow]):
     15        * WebView/WebFrameView.mm:
     16
    1172011-09-19  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm

    r92068 r95725  
    216216   
    217217    _proxy->resize(boundsInWindow, visibleRectInWindow);
    218 
    219     CGRect bounds = NSRectToCGRect([self bounds]);
    220     CGRect frame = NSRectToCGRect([self frame]);
    221    
    222     // We're not scaled, or in a subframe
    223     CATransform3D scaleTransform = CATransform3DIdentity;
    224     if (CGSizeEqualToSize(bounds.size, frame.size)) {
    225         // We're in a subframe. Backing store is boundsInWindow.size.
    226         if (boundsInWindow.size.width && boundsInWindow.size.height)
    227             scaleTransform = CATransform3DMakeScale(frame.size.width / boundsInWindow.size.width, frame.size.height / boundsInWindow.size.height, 1);
    228     } else {
    229         // We're in the main frame with scaling. Need to mimic the frame/bounds scaling on Widgets.
    230         if (frame.size.width && frame.size.height)
    231             scaleTransform = CATransform3DMakeScale(bounds.size.width / frame.size.width, bounds.size.height / frame.size.height, 1);
    232     }
    233 
    234     _pluginLayer.get().sublayerTransform = scaleTransform;
    235218}
    236219
  • trunk/Source/WebKit/mac/WebView/WebFrameView.mm

    r95570 r95725  
    511511}
    512512
    513 - (void)setBoundsSize:(NSSize)size
    514 {
    515     [super setBoundsSize:size];
    516     [[self _scrollView] setFrameSize:size];
    517 }
    518 
    519513- (void)viewDidMoveToWindow
    520514{
Note: See TracChangeset for help on using the changeset viewer.