Changeset 95725 in webkit
- Timestamp:
- Sep 22, 2011 10:09:22 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95724 r95725 1 2011-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 1 38 2011-09-21 David Hyatt <hyatt@apple.com> 2 39 -
trunk/Source/WebCore/WebCore.exp.in
r95717 r95725 826 826 __ZN7WebCore6RegionC1Ev 827 827 __ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE 828 __ZN7WebCore6Widget13setBoundsSizeERKNS_7IntSizeE829 828 __ZN7WebCore6Widget16removeFromParentEv 830 829 __ZN7WebCore6Widget17frameRectsChangedEv -
trunk/Source/WebCore/loader/FrameLoader.cpp
r95593 r95725 2062 2062 2063 2063 // 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()); 2069 2066 m_frame->setView(view); 2070 2067 -
trunk/Source/WebCore/page/FrameView.cpp
r95715 r95725 163 163 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 164 164 view->Widget::setFrameRect(LayoutRect(view->location(), initialSize)); 165 view->setInitialBoundsSize(initialSize);166 165 view->show(); 167 166 return view.release(); -
trunk/Source/WebCore/platform/ScrollView.cpp
r95570 r95725 238 238 239 239 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))); 242 242 } 243 243 #endif … … 471 471 472 472 IntSize docSize = contentsSize(); 473 IntSize frameSize = m_boundsSize;473 IntSize frameSize = frameRect().size(); 474 474 475 475 if (hScroll == ScrollbarAuto) { … … 533 533 IntRect oldRect(m_horizontalScrollbar->frameRect()); 534 534 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), 537 537 m_horizontalScrollbar->height()); 538 538 m_horizontalScrollbar->setFrameRect(hBarRect); … … 553 553 int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); 554 554 IntRect oldRect(m_verticalScrollbar->frameRect()); 555 IntRect vBarRect = IntRect( m_boundsSize.width() - m_verticalScrollbar->width(),555 IntRect vBarRect = IntRect(width() - m_verticalScrollbar->width(), 556 556 0, 557 557 m_verticalScrollbar->width(), 558 m_boundsSize.height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));558 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); 559 559 m_verticalScrollbar->setFrameRect(vBarRect); 560 560 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect()) … … 828 828 } 829 829 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 854 830 void ScrollView::frameRectsChanged() 855 831 { … … 922 898 return cornerRect; 923 899 924 if (m_horizontalScrollbar && m_boundsSize.width() - m_horizontalScrollbar->width() > 0) {900 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) { 925 901 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(), 928 904 m_horizontalScrollbar->height())); 929 905 } 930 906 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(), 933 909 m_verticalScrollbar->height(), 934 910 m_verticalScrollbar->width(), 935 m_boundsSize.height() - m_verticalScrollbar->height()));911 height() - m_verticalScrollbar->height())); 936 912 } 937 913 … … 1133 1109 bool ScrollView::scrollbarCornerPresent() const 1134 1110 { 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); 1137 1113 } 1138 1114 -
trunk/Source/WebCore/platform/ScrollView.h
r95570 r95725 228 228 // Widget override to update our scrollbars and notify our contents of the resize. 229 229 virtual void setFrameRect(const IntRect&); 230 virtual void setBoundsSize(const IntSize&);231 230 232 231 // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32). … … 303 302 IntRect fixedVisibleContentRect() const { return m_fixedVisibleContentRect; } 304 303 305 IntSize boundsSize() const { return m_boundsSize; }306 void setInitialBoundsSize(const IntSize&);307 308 304 // These functions are used to create/destroy scrollbars. 309 305 void setHasHorizontalScrollbar(bool); … … 363 359 364 360 bool m_containsScrollableAreaWithOverlayScrollbars; 365 366 IntSize m_boundsSize;367 361 368 362 void init(); -
trunk/Source/WebCore/platform/Widget.cpp
r90734 r95725 107 107 108 108 #if !PLATFORM(MAC) 109 void Widget::setBoundsSize(const IntSize&)110 {111 }112 113 109 IntRect Widget::convertFromRootToContainingWindow(const Widget*, const IntRect& rect) 114 110 { -
trunk/Source/WebCore/platform/Widget.h
r95673 r95725 150 150 151 151 virtual void setFrameRect(const IntRect&); 152 virtual void setBoundsSize(const IntSize&);153 152 virtual IntRect frameRect() const; 154 153 IntRect boundsRect() const { return IntRect(0, 0, width(), height()); } 155 154 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)); } 158 157 void move(int x, int y) { setFrameRect(IntRect(x, y, width(), height())); } 159 158 void move(const IntPoint& p) { setFrameRect(IntRect(p, size())); } -
trunk/Source/WebCore/platform/chromium/PopupContainer.cpp
r94797 r95725 410 410 411 411 listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0)); 412 setBoundsSize(m_originalFrameRect.size());413 412 414 413 listBox()->updateFromElement(); -
trunk/Source/WebCore/platform/gtk/ScrollViewGtk.cpp
r91707 r95725 71 71 if (!shouldCreateMainFrameScrollbar(this)) { 72 72 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)))); 75 75 } 76 76 -
trunk/Source/WebCore/platform/mac/WidgetMac.mm
r95673 r95725 32 32 #import "Cursor.h" 33 33 #import "Document.h" 34 #import "FloatConversion.h"35 34 #import "Font.h" 36 35 #import "Frame.h" … … 186 185 } 187 186 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 arbitrary198 // 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 207 187 NSView *Widget::getOuterView() const 208 188 { … … 229 209 RefPtr<Widget> protectedThis(this); 230 210 231 IntPoint transformOrigin = frameRect().location();232 AffineTransform widgetToViewTranform = makeMapBetweenRects(IntRect(IntPoint(), frameRect().size()), [view bounds]);233 234 211 NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; 235 212 if (currentContext == [[view window] graphicsContext] || ![currentContext isDrawingToScreen]) { 236 213 // This is the common case of drawing into a window or printing. 237 214 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]]]; 255 216 END_BLOCK_OBJC_EXCEPTIONS; 256 217 } else { … … 277 238 CGContextSaveGState(cgContext); 278 239 279 CGContextTranslateCTM(cgContext, transformOrigin.x(), transformOrigin.y());280 CGContextScaleCTM(cgContext, narrowPrecisionToFloat(widgetToViewTranform.xScale()), narrowPrecisionToFloat(widgetToViewTranform.yScale()));281 CGContextTranslateCTM(cgContext, -transformOrigin.x(), -transformOrigin.y());282 283 240 NSRect viewFrame = [view frame]; 284 241 NSRect viewBounds = [view bounds]; … … 288 245 CGContextScaleCTM(cgContext, 1, -1); 289 246 290 IntRect dirtyRect = r;291 dirtyRect.moveBy(-transformOrigin);292 if (![view isFlipped])293 dirtyRect.setY([view bounds].size.height - dirtyRect.maxY());294 295 247 BEGIN_BLOCK_OBJC_EXCEPTIONS; 296 248 { 297 249 NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES]; 298 [view displayRectIgnoringOpacity: dirtyRectinContext:nsContext];250 [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:nsContext]; 299 251 } 300 252 END_BLOCK_OBJC_EXCEPTIONS; -
trunk/Source/WebCore/rendering/RenderWidget.cpp
r95673 r95725 141 141 } 142 142 143 bool RenderWidget::setWidgetGeometry(const IntRect& frame , const IntSize& boundsSize)143 bool RenderWidget::setWidgetGeometry(const IntRect& frame) 144 144 { 145 145 if (!node()) … … 158 158 RefPtr<Node> protectedNode(node()); 159 159 m_widget->setFrameRect(frame); 160 if (m_widget) // setFrameRect can run arbitrary script, which might clear m_widget.161 m_widget->setBoundsSize(boundsSize);162 160 163 161 #if USE(ACCELERATED_COMPOSITING) … … 191 189 if (m_widget->isFrameView()) { 192 190 contentBox.setLocation(absoluteContentBox.location()); 193 setWidgetGeometry(contentBox , contentBox.size());191 setWidgetGeometry(contentBox); 194 192 } else 195 setWidgetGeometry(absoluteContentBox , contentBox.size());193 setWidgetGeometry(absoluteContentBox); 196 194 } 197 195 if (style()->visibility() != VISIBLE) … … 329 327 if (m_widget->isFrameView()) { 330 328 contentBox.setLocation(absoluteContentBox.location()); 331 boundsChanged = setWidgetGeometry(contentBox , contentBox.size());329 boundsChanged = setWidgetGeometry(contentBox); 332 330 } else 333 boundsChanged = setWidgetGeometry(absoluteContentBox , contentBox.size());331 boundsChanged = setWidgetGeometry(absoluteContentBox); 334 332 335 333 // if the frame bounds got changed, or if view needs layout (possibly indicating -
trunk/Source/WebCore/rendering/RenderWidget.h
r92492 r95725 70 70 virtual void setOverlapTestResult(bool); 71 71 72 bool setWidgetGeometry(const IntRect& , const IntSize&);72 bool setWidgetGeometry(const IntRect&); 73 73 74 74 RefPtr<Widget> m_widget; -
trunk/Source/WebKit/mac/ChangeLog
r95678 r95725 1 2011-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 1 17 2011-09-19 Jer Noble <jer.noble@apple.com> 2 18 -
trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
r92068 r95725 216 216 217 217 _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 subframe223 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;235 218 } 236 219 -
trunk/Source/WebKit/mac/WebView/WebFrameView.mm
r95570 r95725 511 511 } 512 512 513 - (void)setBoundsSize:(NSSize)size514 {515 [super setBoundsSize:size];516 [[self _scrollView] setFrameSize:size];517 }518 519 513 - (void)viewDidMoveToWindow 520 514 {
Note: See TracChangeset
for help on using the changeset viewer.