Changeset 95715 in webkit
- Timestamp:
- Sep 22, 2011 6:30:59 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95714 r95715 1 2011-09-22 Alpha Lam <hclam@chromium.org> 2 3 https://bugs.webkit.org/show_bug.cgi?id=68081 4 Add layout test for page scale and scrolling. 5 6 Reviewed by Simon Fraser. 7 8 Add tests to cover the following cases: 9 1. Scale and scroll window 10 2. Scale and scroll document.body 11 3. Scale and scroll iframe's contentWindow 12 4. Scale and scroll iframe's contentDocument.body 13 14 * fast/events/scale-and-scroll-body-expected.png: Added. 15 * fast/events/scale-and-scroll-body-expected.txt: Added. 16 * fast/events/scale-and-scroll-body.html: Added. 17 * fast/events/scale-and-scroll-iframe-body-expected.png: Added. 18 * fast/events/scale-and-scroll-iframe-body-expected.txt: Added. 19 * fast/events/scale-and-scroll-iframe-body.html: Added. 20 * fast/events/scale-and-scroll-iframe-window-expected.png: Added. 21 * fast/events/scale-and-scroll-iframe-window-expected.txt: Added. 22 * fast/events/scale-and-scroll-iframe-window.html: Added. 23 * fast/events/scale-and-scroll-window-expected.png: Added. 24 * fast/events/scale-and-scroll-window-expected.txt: Added. 25 * fast/events/scale-and-scroll-window.html: Added. 26 1 27 2011-09-22 Andreas Kling <kling@webkit.org> 2 28 -
trunk/Source/WebCore/ChangeLog
r95714 r95715 1 2011-09-22 Alpha Lam <hclam@chromium.org> 2 3 https://bugs.webkit.org/show_bug.cgi?id=68081 4 Fix scroll in page scaling mode. 5 6 Reviewed by Simon Fraser. 7 8 The following things are done in this patch: 9 1. Rename Frame::pageScaleFactor() to Frame::frameScaleFactor() to better 10 reflect its purpose. 11 2. Frame::frameScaleFactor() returns the scale factor of this frame with 12 respect to the container. So for the main frame it'll return the scale 13 factor of the page, inner frames will return 1.0 14 3. scrollBy(), scrollX() and scrollY() to take into account of the frame 15 scale factor, causing incorrect coordinates reported to Javascript. 16 17 Tests: fast/events/scale-and-scroll-body.html 18 fast/events/scale-and-scroll-iframe-body.html 19 fast/events/scale-and-scroll-iframe-window.html 20 fast/events/scale-and-scroll-window.html 21 22 * html/HTMLBodyElement.cpp: 23 (WebCore::adjustForZoom): 24 (WebCore::HTMLBodyElement::setScrollLeft): 25 (WebCore::HTMLBodyElement::setScrollTop): 26 * loader/HistoryController.cpp: 27 (WebCore::HistoryController::saveScrollPositionAndViewStateToItem): 28 * page/DOMWindow.cpp: 29 (WebCore::DOMWindow::scrollX): 30 (WebCore::DOMWindow::scrollY): 31 (WebCore::DOMWindow::scrollTo): 32 * page/Frame.cpp: 33 (WebCore::Frame::frameScaleFactor): Return page's scale factor if this is 34 main frame, otherwise 1.0 35 * page/Frame.h: 36 * page/FrameView.cpp: 37 (WebCore::FrameView::applyOverflowToViewport): 38 (WebCore::FrameView::scrollXForFixedPosition): 39 (WebCore::FrameView::scrollYForFixedPosition): 40 1 41 2011-09-22 Andreas Kling <kling@webkit.org> 2 42 -
trunk/Source/WebCore/WebCore.exp.in
r95685 r95715 747 747 __ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE 748 748 __ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE 749 __ZNK7WebCore5Frame15 pageScaleFactorEv749 __ZNK7WebCore5Frame15frameScaleFactorEv 750 750 __ZN7WebCore5Frame25setPageAndTextZoomFactorsEff 751 751 __ZN7WebCore5Frame27resizePageRectsKeepingRatioERKNS_9FloatSizeES3_ -
trunk/Source/WebCore/html/HTMLBodyElement.cpp
r95612 r95715 268 268 { 269 269 Frame* frame = document->frame(); 270 float zoomFactor = frame->pageZoomFactor() * frame-> pageScaleFactor();270 float zoomFactor = frame->pageZoomFactor() * frame->frameScaleFactor(); 271 271 if (zoomFactor == 1) 272 272 return value; … … 296 296 if (!view) 297 297 return; 298 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZoomFactor() * frame-> pageScaleFactor()), view->scrollY()));298 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), view->scrollY())); 299 299 } 300 300 … … 318 318 if (!view) 319 319 return; 320 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor() * frame-> pageScaleFactor())));320 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor() * frame->frameScaleFactor()))); 321 321 } 322 322 -
trunk/Source/WebCore/loader/HistoryController.cpp
r95612 r95715 87 87 item->setScrollPoint(m_frame->view()->scrollPosition()); 88 88 89 item->setPageScaleFactor(m_frame-> pageScaleFactor());89 item->setPageScaleFactor(m_frame->frameScaleFactor()); 90 90 91 91 // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client. -
trunk/Source/WebCore/page/DOMWindow.cpp
r95612 r95715 1144 1144 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1145 1145 1146 return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor());1146 return static_cast<int>(view->scrollX() / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor())); 1147 1147 } 1148 1148 … … 1158 1158 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1159 1159 1160 return static_cast<int>(view->scrollY() / m_frame->pageZoomFactor());1160 return static_cast<int>(view->scrollY() / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor())); 1161 1161 } 1162 1162 … … 1385 1385 return; 1386 1386 1387 int zoomedX = static_cast<int>(x * m_frame->pageZoomFactor() );1388 int zoomedY = static_cast<int>(y * m_frame->pageZoomFactor() );1387 int zoomedX = static_cast<int>(x * m_frame->pageZoomFactor() * m_frame->frameScaleFactor()); 1388 int zoomedY = static_cast<int>(y * m_frame->pageZoomFactor() * m_frame->frameScaleFactor()); 1389 1389 view->setScrollPosition(IntPoint(zoomedX, zoomedY)); 1390 1390 } -
trunk/Source/WebCore/page/Frame.cpp
r95612 r95715 1024 1024 } 1025 1025 1026 float Frame:: pageScaleFactor() const1026 float Frame::frameScaleFactor() const 1027 1027 { 1028 1028 Page* page = this->page(); 1029 if (!page) 1029 1030 // Main frame is scaled with respect to he container but inner frames are not scaled with respect to the main frame. 1031 if (!page || page->mainFrame() != this) 1030 1032 return 1; 1031 1033 return page->pageScaleFactor(); -
trunk/Source/WebCore/page/Frame.h
r95612 r95715 162 162 void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor); 163 163 164 // Convenience helper method that grabs the pageScaleFactor from Page.165 float pageScaleFactor() const;164 // Scale factor of this frame with respect to the container. 165 float frameScaleFactor() const; 166 166 167 167 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/page/FrameView.cpp
r95685 r95715 526 526 527 527 // To combat the inability to scroll on a page with overflow:hidden on the root when scaled, disregard hidden when 528 // there is a pageScaleFactor that is greater than one on the main frame.529 530 bool overrideHidden = m_frame->page() && m_frame->page()->mainFrame() == m_frame && m_frame-> pageScaleFactor() > 1;528 // there is a frameScaleFactor that is greater than one on the main frame. 529 530 bool overrideHidden = m_frame->page() && m_frame->page()->mainFrame() == m_frame && m_frame->frameScaleFactor() > 1; 531 531 532 532 switch (o->style()->overflowX()) { … … 1350 1350 return x; 1351 1351 1352 float pageScaleFactor = m_frame->pageScaleFactor();1352 float frameScaleFactor = m_frame->frameScaleFactor(); 1353 1353 1354 1354 // When the page is scaled, the scaled "viewport" with respect to which fixed object are positioned 1355 1355 // doesn't move as fast as the content view, so that when the content is scrolled all the way to the 1356 1356 // end, the bottom of the scaled "viewport" touches the bottom of the real viewport. 1357 float dragFactor = (contentsWidth() - visibleContentWidth * pageScaleFactor) / maxX;1358 1359 return x * dragFactor / pageScaleFactor;1357 float dragFactor = (contentsWidth() - visibleContentWidth * frameScaleFactor) / maxX; 1358 1359 return x * dragFactor / frameScaleFactor; 1360 1360 } 1361 1361 … … 1385 1385 return y; 1386 1386 1387 float pageScaleFactor = m_frame->pageScaleFactor();1388 float dragFactor = (contentsHeight() - visibleContentHeight * pageScaleFactor) / maxY;1389 1390 return y * dragFactor / pageScaleFactor;1387 float frameScaleFactor = m_frame->frameScaleFactor(); 1388 float dragFactor = (contentsHeight() - visibleContentHeight * frameScaleFactor) / maxY; 1389 1390 return y * dragFactor / frameScaleFactor; 1391 1391 } 1392 1392 -
trunk/Source/WebKit2/ChangeLog
r95710 r95715 1 2011-09-22 Alpha Lam <hclam@chromium.org> 2 3 https://bugs.webkit.org/show_bug.cgi?id=68081 4 Fix scroll in page scaling mode. 5 6 Reviewed by Simon Fraser. 7 8 * WebProcess/Plugins/PluginView.cpp: Rename pageScaleFactor to frameScaleFactor. 9 (WebKit::PluginView::handleEvent): 10 (WebKit::PluginView::viewGeometryDidChange): 11 (WebKit::PluginView::clipRectInWindowCoordinates): 12 1 13 2011-09-22 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 14 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r95585 r95715 583 583 focusPluginElement(); 584 584 585 // Adjust mouse coordinates to account for pageScaleFactor586 WebMouseEvent eventWithScaledCoordinates(*static_cast<const WebMouseEvent*>(currentEvent), frame()-> pageScaleFactor());585 // Adjust mouse coordinates to account for frameScaleFactor 586 WebMouseEvent eventWithScaledCoordinates(*static_cast<const WebMouseEvent*>(currentEvent), frame()->frameScaleFactor()); 587 587 didHandleEvent = m_plugin->handleMouseEvent(eventWithScaledCoordinates); 588 588 } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) { … … 650 650 IntRect frameRectInWindowCoordinates = parent()->contentsToWindow(frameRect()); 651 651 652 // Adjust bounds to account for pageScaleFactor653 frameRectInWindowCoordinates.scale(1 / frame()-> pageScaleFactor());652 // Adjust bounds to account for frameScaleFactor 653 frameRectInWindowCoordinates.scale(1 / frame()->frameScaleFactor()); 654 654 m_plugin->geometryDidChange(frameRectInWindowCoordinates, clipRectInWindowCoordinates()); 655 655 } … … 677 677 frameRectInWindowCoordinates.intersect(windowClipRect); 678 678 679 frameRectInWindowCoordinates.scale(1 / frame-> pageScaleFactor());679 frameRectInWindowCoordinates.scale(1 / frame->frameScaleFactor()); 680 680 return frameRectInWindowCoordinates; 681 681 }
Note: See TracChangeset
for help on using the changeset viewer.