Changeset 100059 in webkit
- Timestamp:
- Nov 11, 2011 6:53:52 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r100057 r100059 1 2011-11-11 Levi Weintraub <leviw@chromium.org> 2 3 Revert Page to operate on integers 4 https://bugs.webkit.org/show_bug.cgi?id=72185 5 6 Reviewed by Eric Seidel. 7 8 Reverting the page classes to integers from LayoutUnits. It's not necessary to expose 9 LayoutUnits in these classes, so we'll avoid doing so. 10 11 No new tests, no change in behavior. 12 13 * page/EventHandler.cpp: 14 (WebCore::EventHandler::handleMousePressEvent): 15 (WebCore::EventHandler::sendContextMenuEventForKey): 16 (WebCore::EventHandler::dragHysteresisExceeded): 17 (WebCore::EventHandler::handleDrag): 18 * page/EventHandler.h: 19 * page/Frame.cpp: 20 (WebCore::Frame::documentAtPoint): 21 * page/Frame.h: 22 * page/FrameView.cpp: 23 (WebCore::FrameView::create): 24 (WebCore::FrameView::invalidateRect): 25 (WebCore::FrameView::setFrameRect): 26 (WebCore::FrameView::setContentsSize): 27 (WebCore::FrameView::adjustViewSize): 28 (WebCore::FrameView::repaintContentRectangle): 29 (WebCore::FrameView::invalidateScrollbarRect): 30 (WebCore::FrameView::getTickmarks): 31 (WebCore::FrameView::windowResizerRect): 32 (WebCore::FrameView::setVisibleScrollerThumbRect): 33 (WebCore::FrameView::updateScrollCorner): 34 (WebCore::FrameView::paintScrollCorner): 35 (WebCore::FrameView::paintContents): 36 (WebCore::FrameView::paintOverhangAreas): 37 (WebCore::FrameView::convertFromRenderer): 38 (WebCore::FrameView::convertToRenderer): 39 (WebCore::FrameView::convertToContainingView): 40 (WebCore::FrameView::convertFromContainingView): 41 * page/FrameView.h: 42 * page/Page.cpp: 43 (WebCore::Page::setPageScaleFactor): 44 * page/Page.h: 45 * page/SpatialNavigation.cpp: 46 (WebCore::scrollInDirection): 47 1 48 2011-11-11 Dominic Mazzoni <dmazzoni@google.com> 2 49 -
trunk/Source/WebCore/page/EventHandler.cpp
r99755 r100059 1399 1399 // Save the document point we generate in case the window coordinate is invalidated by what happens 1400 1400 // when we dispatch the event. 1401 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.pos());1401 IntPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.pos()); 1402 1402 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); 1403 1403 … … 1446 1446 if (FrameView* view = m_frame->view()) { 1447 1447 RenderLayer* layer = m_clickNode->renderer() ? m_clickNode->renderer()->enclosingLayer() : 0; 1448 LayoutPoint p = view->windowToContents(mouseEvent.pos());1448 IntPoint p = view->windowToContents(mouseEvent.pos()); 1449 1449 if (layer && layer->isPointInResizeControl(p)) { 1450 1450 layer->setInResizeMode(true); … … 2309 2309 int rightAligned = 0; 2310 2310 #endif 2311 LayoutPoint location;2311 IntPoint location; 2312 2312 2313 2313 Node* focusedNode = doc->focusedNode(); … … 2317 2317 if (start.deprecatedNode() && (selection->rootEditableElement() || selection->isRange())) { 2318 2318 RefPtr<Range> selectionRange = selection->toNormalizedRange(); 2319 LayoutRect firstRect = m_frame->editor()->firstRectForRange(selectionRange.get());2320 2321 LayoutUnit x = rightAligned ? firstRect.maxX() : firstRect.x();2322 location = LayoutPoint(x, firstRect.maxY());2319 IntRect firstRect = m_frame->editor()->firstRectForRange(selectionRange.get()); 2320 2321 int x = rightAligned ? firstRect.maxX() : firstRect.x(); 2322 location = IntPoint(x, firstRect.maxY()); 2323 2323 } else if (focusedNode) { 2324 2324 RenderBoxModelObject* box = focusedNode->renderBoxModelObject(); 2325 2325 if (!box) 2326 2326 return false; 2327 LayoutRect clippedRect = box->absoluteClippedOverflowRect();2328 location = LayoutPoint(clippedRect.x(), clippedRect.maxY() - 1);2327 IntRect clippedRect = box->absoluteClippedOverflowRect(); 2328 location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1); 2329 2329 } else { 2330 location = LayoutPoint(2330 location = IntPoint( 2331 2331 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin, 2332 2332 kContextMenuMargin); … … 2335 2335 m_frame->view()->setCursor(pointerCursor()); 2336 2336 2337 LayoutPoint position = view->contentsToWindow(location);2338 LayoutPoint globalPosition = view->contentsToScreen(LayoutRect(location, LayoutSize())).location();2337 IntPoint position = view->contentsToWindow(location); 2338 IntPoint globalPosition = view->contentsToScreen(IntRect(location, IntSize())).location(); 2339 2339 2340 2340 Node* targetNode = doc->focusedNode(); … … 2721 2721 if (!view) 2722 2722 return false; 2723 LayoutPoint dragLocation = view->windowToContents(flooredLayoutPoint(dragViewportLocation));2724 LayoutSize delta = dragLocation - m_mouseDownPos;2723 IntPoint dragLocation = view->windowToContents(flooredIntPoint(dragViewportLocation)); 2724 IntSize delta = dragLocation - m_mouseDownPos; 2725 2725 2726 2726 int threshold = GeneralDragHysteresis; … … 2874 2874 // FIXME: This doesn't work correctly with transforms. 2875 2875 FloatPoint absPos = renderer->localToAbsolute(); 2876 LayoutSize delta = m_mouseDownPos - roundedLayoutPoint(absPos);2876 IntSize delta = m_mouseDownPos - roundedIntPoint(absPos); 2877 2877 dragState().m_dragClipboard->setDragImageElement(dragState().m_dragSrc.get(), toPoint(delta)); 2878 2878 } else { -
trunk/Source/WebCore/page/EventHandler.h
r99014 r100059 402 402 403 403 IntPoint m_currentMousePosition; 404 LayoutPoint m_mouseDownPos; // In our view's coords.404 IntPoint m_mouseDownPos; // In our view's coords. 405 405 double m_mouseDownTimestamp; 406 406 PlatformMouseEvent m_mouseDown; -
trunk/Source/WebCore/page/Frame.cpp
r99937 r100059 816 816 } 817 817 818 Document* Frame::documentAtPoint(const LayoutPoint& point)818 Document* Frame::documentAtPoint(const IntPoint& point) 819 819 { 820 820 if (!view()) -
trunk/Source/WebCore/page/Frame.h
r99099 r100059 188 188 189 189 VisiblePosition visiblePositionForPoint(const LayoutPoint& framePoint); 190 Document* documentAtPoint(const LayoutPoint& windowPoint);190 Document* documentAtPoint(const IntPoint& windowPoint); 191 191 PassRefPtr<Range> rangeForPoint(const LayoutPoint& framePoint); 192 192 -
trunk/Source/WebCore/page/FrameView.cpp
r100014 r100059 171 171 { 172 172 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 173 view->Widget::setFrameRect( LayoutRect(view->location(), initialSize));173 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); 174 174 view->show(); 175 175 return view.release(); … … 374 374 } 375 375 376 void FrameView::invalidateRect(const LayoutRect& rect)376 void FrameView::invalidateRect(const IntRect& rect) 377 377 { 378 378 if (!parent()) { … … 389 389 return; 390 390 391 LayoutRect repaintRect = rect;391 IntRect repaintRect = rect; 392 392 repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(), 393 393 renderer->borderTop() + renderer->paddingTop()); … … 395 395 } 396 396 397 void FrameView::setFrameRect(const LayoutRect& newRect)398 { 399 LayoutRect oldRect = frameRect();397 void FrameView::setFrameRect(const IntRect& newRect) 398 { 399 IntRect oldRect = frameRect(); 400 400 if (newRect == oldRect) 401 401 return; … … 489 489 } 490 490 491 void FrameView::setContentsSize(const LayoutSize& size)491 void FrameView::setContentsSize(const IntSize& size) 492 492 { 493 493 if (size == contentsSize()) … … 519 519 ASSERT(m_frame->view() == this); 520 520 521 const LayoutRect&rect = root->documentRect();522 const LayoutSize& size = rect.size();523 ScrollView::setScrollOrigin( LayoutPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize());521 const IntRect rect = root->documentRect(); 522 const IntSize& size = rect.size(); 523 ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize()); 524 524 525 525 setContentsSize(size); … … 1732 1732 const unsigned cRepaintRectUnionThreshold = 25; 1733 1733 1734 void FrameView::repaintContentRectangle(const LayoutRect& r, bool immediate)1734 void FrameView::repaintContentRectangle(const IntRect& r, bool immediate) 1735 1735 { 1736 1736 ASSERT(!m_frame->ownerElement()); 1737 1737 1738 1738 if (m_isTrackingRepaints) { 1739 LayoutRect repaintRect = r;1739 IntRect repaintRect = r; 1740 1740 repaintRect.move(-scrollOffset()); 1741 1741 m_trackedRepaintRects.append(repaintRect); … … 1744 1744 double delay = m_deferringRepaints ? 0 : adjustedDeferredRepaintDelay(); 1745 1745 if ((m_deferringRepaints || m_deferredRepaintTimer.isActive() || delay) && !immediate) { 1746 LayoutRect paintRect = r;1746 IntRect paintRect = r; 1747 1747 if (clipsRepaints() && !paintsEntireContents()) 1748 1748 paintRect.intersect(visibleContentRect()); … … 1750 1750 return; 1751 1751 if (m_repaintCount == cRepaintRectUnionThreshold) { 1752 LayoutRect unionedRect;1752 IntRect unionedRect; 1753 1753 for (unsigned i = 0; i < cRepaintRectUnionThreshold; ++i) 1754 1754 unionedRect.unite(m_repaintRects[i]); … … 2360 2360 } 2361 2361 2362 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const LayoutRect& rect)2362 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) 2363 2363 { 2364 2364 // Add in our offset within the FrameView. 2365 LayoutRect dirtyRect = rect;2365 IntRect dirtyRect = rect; 2366 2366 dirtyRect.moveBy(scrollbar->location()); 2367 2367 invalidateRect(dirtyRect); 2368 2368 } 2369 2369 2370 void FrameView::getTickmarks(Vector< LayoutRect>& tickmarks) const2370 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const 2371 2371 { 2372 2372 tickmarks = frame()->document()->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch); … … 2377 2377 Page* page = frame() ? frame()->page() : 0; 2378 2378 if (!page) 2379 return LayoutRect();2379 return IntRect(); 2380 2380 return page->chrome()->windowResizerRect(); 2381 2381 } … … 2413 2413 } 2414 2414 2415 void FrameView::setVisibleScrollerThumbRect(const LayoutRect& scrollerThumb)2415 void FrameView::setVisibleScrollerThumbRect(const IntRect& scrollerThumb) 2416 2416 { 2417 2417 Page* page = m_frame->page(); … … 2509 2509 RenderObject* renderer = 0; 2510 2510 RefPtr<RenderStyle> cornerStyle; 2511 LayoutRect cornerRect = scrollCornerRect();2511 IntRect cornerRect = scrollCornerRect(); 2512 2512 2513 2513 if (!cornerRect.isEmpty()) { … … 2549 2549 } 2550 2550 2551 void FrameView::paintScrollCorner(GraphicsContext* context, const LayoutRect& cornerRect)2551 void FrameView::paintScrollCorner(GraphicsContext* context, const IntRect& cornerRect) 2552 2552 { 2553 2553 if (context->updatingControlTints()) { … … 2691 2691 } 2692 2692 2693 void FrameView::paintContents(GraphicsContext* p, const LayoutRect& rect)2693 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) 2694 2694 { 2695 2695 if (!frame()) … … 2810 2810 } 2811 2811 2812 void FrameView::paintOverhangAreas(GraphicsContext* context, const LayoutRect& horizontalOverhangArea, const LayoutRect& verticalOverhangArea, const LayoutRect& dirtyRect)2812 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) 2813 2813 { 2814 2814 if (context->paintingDisabled()) … … 2944 2944 } 2945 2945 2946 LayoutRect FrameView::convertFromRenderer(const RenderObject* renderer, const LayoutRect& rendererRect) const2947 { 2948 LayoutRect rect = renderer->localToAbsoluteQuad(FloatRect(rendererRect)).enclosingBoundingBox();2946 IntRect FrameView::convertFromRenderer(const RenderObject* renderer, const IntRect& rendererRect) const 2947 { 2948 IntRect rect = renderer->localToAbsoluteQuad(FloatRect(rendererRect)).enclosingBoundingBox(); 2949 2949 2950 2950 // Convert from page ("absolute") to FrameView coordinates. … … 2954 2954 } 2955 2955 2956 LayoutRect FrameView::convertToRenderer(const RenderObject* renderer, const LayoutRect& viewRect) const2957 { 2958 LayoutRect rect = viewRect;2956 IntRect FrameView::convertToRenderer(const RenderObject* renderer, const IntRect& viewRect) const 2957 { 2958 IntRect rect = viewRect; 2959 2959 2960 2960 // Convert from FrameView coords into page ("absolute") coordinates. … … 2963 2963 // FIXME: we don't have a way to map an absolute rect down to a local quad, so just 2964 2964 // move the rect for now. 2965 rect.setLocation(rounded LayoutPoint(renderer->absoluteToLocal(rect.location(), false, true /* use transforms */)));2965 rect.setLocation(roundedIntPoint(renderer->absoluteToLocal(rect.location(), false, true /* use transforms */))); 2966 2966 return rect; 2967 2967 } 2968 2968 2969 LayoutPoint FrameView::convertFromRenderer(const RenderObject* renderer, const LayoutPoint& rendererPoint) const2970 { 2971 LayoutPoint point = roundedLayoutPoint(renderer->localToAbsolute(rendererPoint, false, true /* use transforms */));2969 IntPoint FrameView::convertFromRenderer(const RenderObject* renderer, const IntPoint& rendererPoint) const 2970 { 2971 IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, false, true /* use transforms */)); 2972 2972 2973 2973 // Convert from page ("absolute") to FrameView coordinates. … … 2976 2976 } 2977 2977 2978 LayoutPoint FrameView::convertToRenderer(const RenderObject* renderer, const LayoutPoint& viewPoint) const2979 { 2980 LayoutPoint point = viewPoint;2978 IntPoint FrameView::convertToRenderer(const RenderObject* renderer, const IntPoint& viewPoint) const 2979 { 2980 IntPoint point = viewPoint; 2981 2981 2982 2982 // Convert from FrameView coords into page ("absolute") coordinates. … … 2986 2986 } 2987 2987 2988 LayoutRect FrameView::convertToContainingView(const LayoutRect& localRect) const2988 IntRect FrameView::convertToContainingView(const IntRect& localRect) const 2989 2989 { 2990 2990 if (const ScrollView* parentScrollView = parent()) { … … 2996 2996 return localRect; 2997 2997 2998 LayoutRect rect(localRect);2998 IntRect rect(localRect); 2999 2999 // Add borders and padding?? 3000 3000 rect.move(renderer->borderLeft() + renderer->paddingLeft(), … … 3009 3009 } 3010 3010 3011 LayoutRect FrameView::convertFromContainingView(const LayoutRect& parentRect) const3011 IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const 3012 3012 { 3013 3013 if (const ScrollView* parentScrollView = parent()) { … … 3020 3020 return parentRect; 3021 3021 3022 LayoutRect rect = parentView->convertToRenderer(renderer, parentRect);3022 IntRect rect = parentView->convertToRenderer(renderer, parentRect); 3023 3023 // Subtract borders and padding 3024 3024 rect.move(-renderer->borderLeft() - renderer->paddingLeft(), … … 3033 3033 } 3034 3034 3035 LayoutPoint FrameView::convertToContainingView(const LayoutPoint& localPoint) const3035 IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const 3036 3036 { 3037 3037 if (const ScrollView* parentScrollView = parent()) { … … 3044 3044 return localPoint; 3045 3045 3046 LayoutPoint point(localPoint);3046 IntPoint point(localPoint); 3047 3047 3048 3048 // Add borders and padding … … 3058 3058 } 3059 3059 3060 LayoutPoint FrameView::convertFromContainingView(const LayoutPoint& parentPoint) const3060 IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const 3061 3061 { 3062 3062 if (const ScrollView* parentScrollView = parent()) { … … 3069 3069 return parentPoint; 3070 3070 3071 LayoutPoint point = parentView->convertToRenderer(renderer, parentPoint);3071 IntPoint point = parentView->convertToRenderer(renderer, parentPoint); 3072 3072 // Subtract borders and padding 3073 3073 point.move(-renderer->borderLeft() - renderer->paddingLeft(), -
trunk/Source/WebCore/page/FrameView.h
r99511 r100059 220 220 void removeWidgetToUpdate(RenderEmbeddedObject*); 221 221 222 virtual void paintContents(GraphicsContext*, const LayoutRect& damageRect);222 virtual void paintContents(GraphicsContext*, const IntRect& damageRect); 223 223 void setPaintBehavior(PaintBehavior); 224 224 PaintBehavior paintBehavior() const; … … 227 227 void setNodeToDraw(Node*); 228 228 229 virtual void paintOverhangAreas(GraphicsContext*, const LayoutRect& horizontalOverhangArea, const LayoutRect& verticalOverhangArea, const LayoutRect& dirtyRect);230 virtual void paintScrollCorner(GraphicsContext*, const LayoutRect& cornerRect);229 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); 230 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); 231 231 232 232 Color documentBackgroundColor() const; … … 337 337 void performPostLayoutTasks(); 338 338 339 virtual void repaintContentRectangle(const LayoutRect&, bool immediate);339 virtual void repaintContentRectangle(const IntRect&, bool immediate); 340 340 virtual void contentsResized(); 341 341 virtual void visibleContentsResized(); -
trunk/Source/WebCore/page/Page.cpp
r99613 r100059 620 620 } 621 621 622 void Page::setPageScaleFactor(float scale, const LayoutPoint& origin)622 void Page::setPageScaleFactor(float scale, const IntPoint& origin) 623 623 { 624 624 if (scale == m_pageScaleFactor) -
trunk/Source/WebCore/page/Page.h
r99613 r100059 246 246 void setMediaVolume(float volume); 247 247 248 void setPageScaleFactor(float scale, const LayoutPoint& origin);248 void setPageScaleFactor(float scale, const IntPoint& origin); 249 249 float pageScaleFactor() const { return m_pageScaleFactor; } 250 250 -
trunk/Source/WebCore/page/SpatialNavigation.cpp
r95901 r100059 362 362 } 363 363 364 frame->view()->scrollBy( LayoutSize(dx, dy));364 frame->view()->scrollBy(IntSize(dx, dy)); 365 365 return true; 366 366 }
Note: See TracChangeset
for help on using the changeset viewer.