Changeset 106884 in webkit
- Timestamp:
- Feb 6, 2012 5:36:25 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106883 r106884 1 2012-02-06 Levi Weintraub <leviw@chromium.org> 2 3 Correct usage of LayoutUnits in dom, editing, page, accessibility, inspector, and loader 4 https://bugs.webkit.org/show_bug.cgi?id=77891 5 6 Reviewed by Darin Adler. 7 8 Updating the usage of LayoutUnits in the dom, editing, page, accessibility, inspector, and loader 9 directories to properly use LayoutUnits vs ints. 10 11 No new tests. No new behavior. 12 13 * accessibility/AccessibilityObject.h: 14 (WebCore::AccessibilityObject::boundsForVisiblePositionRange): 15 (WebCore::AccessibilityObject::doAXBoundsForRange): 16 * accessibility/AccessibilityRenderObject.cpp: 17 (WebCore::AccessibilityRenderObject::isOffScreen): 18 (WebCore::AccessibilityRenderObject::clickPoint): 19 (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange): 20 (WebCore::AccessibilityRenderObject::doAXBoundsForRange): 21 (WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest): 22 * accessibility/AccessibilityRenderObject.h: 23 (AccessibilityRenderObject): 24 * accessibility/AccessibilitySlider.cpp: 25 (WebCore::AccessibilitySlider::elementAccessibilityHitTest): 26 * accessibility/AccessibilitySlider.h: 27 (AccessibilitySlider): 28 * accessibility/mac/WebAccessibilityObjectWrapper.mm: 29 (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]): 30 * css/CSSComputedStyleDeclaration.cpp: 31 (WebCore::computedTransform): 32 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 33 * dom/Clipboard.h: 34 (WebCore::Clipboard::dragLocation): 35 (Clipboard): 36 * dom/DocumentMarkerController.cpp: 37 (WebCore::DocumentMarkerController::renderedRectsForMarkers): 38 * dom/DocumentMarkerController.h: 39 * dom/Element.cpp: 40 (WebCore::Element::screenRect): 41 * dom/Element.h: 42 (Element): 43 * editing/Editor.cpp: 44 (WebCore::Editor::rangeForPoint): 45 (WebCore::Editor::firstRectForRange): 46 * editing/RenderedPosition.cpp: 47 (WebCore::RenderedPosition::absoluteRect): 48 * editing/RenderedPosition.h: 49 (WebCore::RenderedPosition::absoluteRect): 50 (RenderedPosition): 51 * editing/VisiblePosition.h: 52 (VisiblePosition): 53 * inspector/DOMNodeHighlighter.cpp: 54 * loader/SubframeLoader.cpp: 55 (WebCore::SubframeLoader::createJavaAppletWidget): 56 * loader/SubframeLoader.h: 57 (SubframeLoader): 58 * page/EventHandler.cpp: 59 (WebCore::EventHandler::handleMousePressEvent): 60 * page/Frame.cpp: 61 (WebCore::Frame::nodeImage): 62 * page/win/FrameCGWin.cpp: 63 (WebCore::Frame::nodeImage): 64 1 65 2012-02-05 Kentaro Hara <haraken@chromium.org> 2 66 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r105590 r106884 585 585 586 586 String stringForVisiblePositionRange(const VisiblePositionRange&) const; 587 virtual LayoutRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return LayoutRect(); }587 virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return IntRect(); } 588 588 int lengthForVisiblePositionRange(const VisiblePositionRange&) const; 589 589 virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const { } … … 616 616 617 617 virtual String doAXStringForRange(const PlainTextRange&) const { return String(); } 618 virtual LayoutRect doAXBoundsForRange(const PlainTextRange&) const { return LayoutRect(); }618 virtual IntRect doAXBoundsForRange(const PlainTextRange&) const { return IntRect(); } 619 619 String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&) const; 620 620 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r105295 r106884 710 710 LayoutRect contentRect = m_renderer->absoluteClippedOverflowRect(); 711 711 FrameView* view = m_renderer->frame()->view(); 712 FloatRect viewRect = view->visibleContentRect();712 IntRect viewRect = view->visibleContentRect(); 713 713 viewRect.intersect(contentRect); 714 714 return viewRect.isEmpty(); … … 1500 1500 } 1501 1501 1502 LayoutPoint AccessibilityRenderObject::clickPoint()1502 IntPoint AccessibilityRenderObject::clickPoint() 1503 1503 { 1504 1504 // Headings are usually much wider than their textual content. If the mid point is used, often it can be wrong. … … 1512 1512 VisibleSelection visSelection = selection(); 1513 1513 VisiblePositionRange range = VisiblePositionRange(visSelection.visibleStart(), visSelection.visibleEnd()); 1514 LayoutRect bounds = boundsForVisiblePositionRange(range);1514 IntRect bounds = boundsForVisiblePositionRange(range); 1515 1515 #if PLATFORM(MAC) 1516 1516 bounds.setLocation(m_renderer->document()->view()->screenToContents(bounds.location())); 1517 1517 #endif 1518 return LayoutPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.height() / 2));1518 return IntPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.height() / 2)); 1519 1519 } 1520 1520 … … 2595 2595 } 2596 2596 2597 LayoutRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const2597 IntRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const 2598 2598 { 2599 2599 if (visiblePositionRange.isNull()) 2600 return LayoutRect();2600 return IntRect(); 2601 2601 2602 2602 // Create a mutable VisiblePositionRange. … … 2812 2812 // specified by the given range. This is the bounding rectangle a sighted user would see 2813 2813 // on the display screen, in pixels. 2814 LayoutRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const2814 IntRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const 2815 2815 { 2816 2816 if (allowsTextRanges()) 2817 2817 return boundsForVisiblePositionRange(visiblePositionRangeForRange(range)); 2818 return LayoutRect();2819 } 2820 2821 AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTMLAreaElement* area, const IntPoint& point) const2818 return IntRect(); 2819 } 2820 2821 AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTMLAreaElement* area, const LayoutPoint& point) const 2822 2822 { 2823 2823 if (!area) -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r105295 r106884 155 155 156 156 // Should be called on the root accessibility object to kick off a hit test. 157 virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const;157 virtual AccessibilityObject* accessibilityHitTest(const LayoutPoint&) const; 158 158 159 159 virtual Element* actionElement() const; … … 167 167 virtual LayoutRect elementRect() const; 168 168 virtual LayoutSize size() const; 169 virtual LayoutPoint clickPoint();169 virtual IntPoint clickPoint(); 170 170 171 171 void setRenderer(RenderObject* renderer) { m_renderer = renderer; } … … 229 229 virtual VisiblePositionRange visiblePositionRange() const; 230 230 virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const; 231 virtual LayoutRect boundsForVisiblePositionRange(const VisiblePositionRange&) const;231 virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const; 232 232 virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const; 233 233 virtual bool supportsARIAFlowTo() const; … … 251 251 252 252 virtual String doAXStringForRange(const PlainTextRange&) const; 253 virtual LayoutRect doAXBoundsForRange(const PlainTextRange&) const;253 virtual IntRect doAXBoundsForRange(const PlainTextRange&) const; 254 254 255 255 virtual String stringValueForMSAA() const; -
trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp
r97629 r106884 102 102 } 103 103 104 AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const IntPoint& point) const104 AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const LayoutPoint& point) const 105 105 { 106 106 if (m_children.size()) { -
trunk/Source/WebCore/accessibility/AccessibilitySlider.h
r98421 r106884 49 49 HTMLInputElement* element() const; 50 50 virtual bool accessibilityIsIgnored() const; 51 virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const;51 virtual AccessibilityObject* elementAccessibilityHitTest(const LayoutPoint&) const; 52 52 53 53 virtual AccessibilityRole roleValue() const { return SliderRole; } -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm
r103552 r106884 2606 2606 2607 2607 // Simulate a click in the middle of the object. 2608 LayoutPoint clickPoint = m_object->clickPoint();2608 IntPoint clickPoint = m_object->clickPoint(); 2609 2609 2610 2610 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime()); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r106695 r106884 669 669 return cssValuePool->createIdentifierValue(CSSValueNone); 670 670 671 IntRect box = sizingBox(renderer);671 LayoutRect box = sizingBox(renderer); 672 672 673 673 TransformationMatrix transform; … … 2114 2114 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 2115 2115 if (renderer) { 2116 IntRect box = sizingBox(renderer);2116 LayoutRect box = sizingBox(renderer); 2117 2117 list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), cssValuePool)); 2118 2118 list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), cssValuePool)); -
trunk/Source/WebCore/dom/Clipboard.h
r98821 r106884 70 70 virtual PassRefPtr<FileList> files() const = 0; 71 71 72 LayoutPoint dragLocation() const { return m_dragLoc; }72 IntPoint dragLocation() const { return m_dragLoc; } 73 73 CachedImage* dragImage() const { return m_dragImage.get(); } 74 virtual void setDragImage(CachedImage*, const LayoutPoint&) = 0;74 virtual void setDragImage(CachedImage*, const IntPoint&) = 0; 75 75 Node* dragImageElement() const { return m_dragImageElement.get(); } 76 virtual void setDragImageElement(Node*, const LayoutPoint&) = 0;76 virtual void setDragImageElement(Node*, const IntPoint&) = 0; 77 77 78 virtual DragImageRef createDragImage( LayoutPoint& dragLocation) const = 0;78 virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0; 79 79 #if ENABLE(DRAG_SUPPORT) 80 80 virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0; … … 118 118 119 119 protected: 120 LayoutPoint m_dragLoc;120 IntPoint m_dragLoc; 121 121 CachedResourceHandle<CachedImage> m_dragImage; 122 122 RefPtr<Node> m_dragImageElement; -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r99814 r106884 378 378 } 379 379 380 Vector< LayoutRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)381 { 382 Vector< LayoutRect> result;380 Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType) 381 { 382 Vector<IntRect> result; 383 383 384 384 if (!possiblyHasMarkers(markerType)) -
trunk/Source/WebCore/dom/DocumentMarkerController.h
r99814 r106884 73 73 Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes); 74 74 Vector<DocumentMarker> markersForNode(Node*); 75 Vector< LayoutRect> renderedRectsForMarkers(DocumentMarker::MarkerType);75 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); 76 76 void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes); 77 77 -
trunk/Source/WebCore/dom/Element.cpp
r106757 r106884 567 567 } 568 568 569 LayoutRect Element::screenRect() const569 IntRect Element::screenRect() const 570 570 { 571 571 if (!renderer()) 572 return LayoutRect();572 return IntRect(); 573 573 // FIXME: this should probably respect transforms 574 574 return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRectIgnoringTransforms()); -
trunk/Source/WebCore/dom/Element.h
r106833 r106884 188 188 189 189 // Returns the absolute bounding box translated into screen coordinates: 190 LayoutRect screenRect() const;190 IntRect screenRect() const; 191 191 192 192 void removeAttribute(const String& name); -
trunk/Source/WebCore/editing/Editor.cpp
r106695 r106884 2319 2319 } 2320 2320 2321 PassRefPtr<Range> Editor::rangeForPoint(const LayoutPoint& windowPoint)2321 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint) 2322 2322 { 2323 2323 Document* document = m_frame->documentAtPoint(windowPoint); … … 2634 2634 IntRect Editor::firstRectForRange(Range* range) const 2635 2635 { 2636 int extraWidthToEndOfLine = 0;2636 LayoutUnit extraWidthToEndOfLine = 0; 2637 2637 ASSERT(range->startContainer()); 2638 2638 ASSERT(range->endContainer()); -
trunk/Source/WebCore/editing/RenderedPosition.cpp
r101561 r106884 225 225 } 226 226 227 LayoutRect RenderedPosition::absoluteRect( int* extraWidthToEndOfLine) const227 LayoutRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const 228 228 { 229 229 if (isNull()) -
trunk/Source/WebCore/editing/RenderedPosition.h
r95964 r106884 69 69 70 70 LayoutRect absoluteRect() const { return absoluteRect(0); } 71 LayoutRect absoluteRect( int& extraWidthToEndOfLine) const { return absoluteRect(&extraWidthToEndOfLine); }71 LayoutRect absoluteRect(LayoutUnit& extraWidthToEndOfLine) const { return absoluteRect(&extraWidthToEndOfLine); } 72 72 73 73 private: … … 82 82 bool atRightBoundaryOfBidiRun(ShouldMatchBidiLevel, unsigned char bidiLevelOfRun) const; 83 83 84 LayoutRect absoluteRect( int* extraWidthToEndOfLine) const;84 LayoutRect absoluteRect(LayoutUnit* extraWidthToEndOfLine) const; 85 85 86 86 RenderObject* m_renderer; -
trunk/Source/WebCore/editing/VisiblePosition.h
r93443 r106884 94 94 95 95 // Rect is local to the returned renderer 96 IntRect localCaretRect(RenderObject*&) const;96 LayoutRect localCaretRect(RenderObject*&) const; 97 97 // Bounds of (possibly transformed) caret in absolute coords 98 98 IntRect absoluteCaretBounds() const; -
trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp
r103992 r106884 289 289 290 290 // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle). 291 LayoutUnit dx = -borderWidthPx;292 LayoutUnit dy = borderWidthPx;291 int dx = -borderWidthPx; 292 int dy = borderWidthPx; 293 293 294 294 // If the tip sticks beyond the right of visibleRect, right-align the tip with the said boundary. -
trunk/Source/WebCore/loader/SubframeLoader.cpp
r106818 r106884 192 192 #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) 193 193 194 PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)194 PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const LayoutSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) 195 195 { 196 196 String baseURLString; -
trunk/Source/WebCore/loader/SubframeLoader.h
r95901 r106884 33 33 34 34 #include "FrameLoaderTypes.h" 35 #include "LayoutTypes.h" 35 36 #include "PlatformString.h" 36 37 #include <wtf/Forward.h> … … 72 73 #endif 73 74 74 PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args);75 PassRefPtr<Widget> createJavaAppletWidget(const LayoutSize&, HTMLAppletElement*, const HashMap<String, String>& args); 75 76 76 77 bool allowPlugins(ReasonForCallingAllowPlugins); -
trunk/Source/WebCore/page/EventHandler.cpp
r106649 r106884 1482 1482 // Save the document point we generate in case the window coordinate is invalidated by what happens 1483 1483 // when we dispatch the event. 1484 IntPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position());1484 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position()); 1485 1485 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); 1486 1486 -
trunk/Source/WebCore/page/Frame.cpp
r106695 r106884 1072 1072 m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode. 1073 1073 1074 IntRect topLevelRect;1074 LayoutRect topLevelRect; 1075 1075 IntRect paintingRect = renderer->paintingRootRect(topLevelRect); 1076 1076 -
trunk/Source/WebCore/page/win/FrameCGWin.cpp
r86451 r106884 98 98 return 0; 99 99 100 IntRect topLevelRect;100 LayoutRect topLevelRect; 101 101 IntRect paintingRect = renderer->paintingRootRect(topLevelRect); 102 102
Note: See TracChangeset
for help on using the changeset viewer.