Changeset 106884 in webkit


Ignore:
Timestamp:
Feb 6, 2012 5:36:25 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Correct usage of LayoutUnits in dom, editing, page, accessibility, inspector, and loader
https://bugs.webkit.org/show_bug.cgi?id=77891

Reviewed by Darin Adler.

Updating the usage of LayoutUnits in the dom, editing, page, accessibility, inspector, and loader
directories to properly use LayoutUnits vs ints.

No new tests. No new behavior.

  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::boundsForVisiblePositionRange):
(WebCore::AccessibilityObject::doAXBoundsForRange):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::isOffScreen):
(WebCore::AccessibilityRenderObject::clickPoint):
(WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange):
(WebCore::AccessibilityRenderObject::doAXBoundsForRange):
(WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest):

  • accessibility/AccessibilityRenderObject.h:

(AccessibilityRenderObject):

  • accessibility/AccessibilitySlider.cpp:

(WebCore::AccessibilitySlider::elementAccessibilityHitTest):

  • accessibility/AccessibilitySlider.h:

(AccessibilitySlider):

  • accessibility/mac/WebAccessibilityObjectWrapper.mm:

(-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::computedTransform):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • dom/Clipboard.h:

(WebCore::Clipboard::dragLocation):
(Clipboard):

  • dom/DocumentMarkerController.cpp:

(WebCore::DocumentMarkerController::renderedRectsForMarkers):

  • dom/DocumentMarkerController.h:
  • dom/Element.cpp:

(WebCore::Element::screenRect):

  • dom/Element.h:

(Element):

  • editing/Editor.cpp:

(WebCore::Editor::rangeForPoint):
(WebCore::Editor::firstRectForRange):

  • editing/RenderedPosition.cpp:

(WebCore::RenderedPosition::absoluteRect):

  • editing/RenderedPosition.h:

(WebCore::RenderedPosition::absoluteRect):
(RenderedPosition):

  • editing/VisiblePosition.h:

(VisiblePosition):

  • inspector/DOMNodeHighlighter.cpp:
  • loader/SubframeLoader.cpp:

(WebCore::SubframeLoader::createJavaAppletWidget):

  • loader/SubframeLoader.h:

(SubframeLoader):

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMousePressEvent):

  • page/Frame.cpp:

(WebCore::Frame::nodeImage):

  • page/win/FrameCGWin.cpp:

(WebCore::Frame::nodeImage):

Location:
trunk/Source/WebCore
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106883 r106884  
     12012-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
    1652012-02-05  Kentaro Hara  <haraken@chromium.org>
    266
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r105590 r106884  
    585585
    586586    String stringForVisiblePositionRange(const VisiblePositionRange&) const;
    587     virtual LayoutRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return LayoutRect(); }
     587    virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return IntRect(); }
    588588    int lengthForVisiblePositionRange(const VisiblePositionRange&) const;
    589589    virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const { }
     
    616616
    617617    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(); }
    619619    String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&) const;
    620620
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r105295 r106884  
    710710    LayoutRect contentRect = m_renderer->absoluteClippedOverflowRect();
    711711    FrameView* view = m_renderer->frame()->view();
    712     FloatRect viewRect = view->visibleContentRect();
     712    IntRect viewRect = view->visibleContentRect();
    713713    viewRect.intersect(contentRect);
    714714    return viewRect.isEmpty();
     
    15001500}
    15011501
    1502 LayoutPoint AccessibilityRenderObject::clickPoint()
     1502IntPoint AccessibilityRenderObject::clickPoint()
    15031503{
    15041504    // Headings are usually much wider than their textual content. If the mid point is used, often it can be wrong.
     
    15121512    VisibleSelection visSelection = selection();
    15131513    VisiblePositionRange range = VisiblePositionRange(visSelection.visibleStart(), visSelection.visibleEnd());
    1514     LayoutRect bounds = boundsForVisiblePositionRange(range);
     1514    IntRect bounds = boundsForVisiblePositionRange(range);
    15151515#if PLATFORM(MAC)
    15161516    bounds.setLocation(m_renderer->document()->view()->screenToContents(bounds.location()));
    15171517#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));
    15191519}
    15201520   
     
    25952595}
    25962596
    2597 LayoutRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const
     2597IntRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const
    25982598{
    25992599    if (visiblePositionRange.isNull())
    2600         return LayoutRect();
     2600        return IntRect();
    26012601   
    26022602    // Create a mutable VisiblePositionRange.
     
    28122812// specified by the given range. This is the bounding rectangle a sighted user would see
    28132813// on the display screen, in pixels.
    2814 LayoutRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const
     2814IntRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const
    28152815{
    28162816    if (allowsTextRanges())
    28172817        return boundsForVisiblePositionRange(visiblePositionRangeForRange(range));
    2818     return LayoutRect();
    2819 }
    2820 
    2821 AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTMLAreaElement* area, const IntPoint& point) const
     2818    return IntRect();
     2819}
     2820
     2821AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTMLAreaElement* area, const LayoutPoint& point) const
    28222822{
    28232823    if (!area)
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h

    r105295 r106884  
    155155   
    156156    // 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;
    158158
    159159    virtual Element* actionElement() const;
     
    167167    virtual LayoutRect elementRect() const;
    168168    virtual LayoutSize size() const;
    169     virtual LayoutPoint clickPoint();
     169    virtual IntPoint clickPoint();
    170170   
    171171    void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
     
    229229    virtual VisiblePositionRange visiblePositionRange() const;
    230230    virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const;
    231     virtual LayoutRect boundsForVisiblePositionRange(const VisiblePositionRange&) const;
     231    virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const;
    232232    virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const;
    233233    virtual bool supportsARIAFlowTo() const;
     
    251251   
    252252    virtual String doAXStringForRange(const PlainTextRange&) const;
    253     virtual LayoutRect doAXBoundsForRange(const PlainTextRange&) const;
     253    virtual IntRect doAXBoundsForRange(const PlainTextRange&) const;
    254254   
    255255    virtual String stringValueForMSAA() const;
  • trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp

    r97629 r106884  
    102102}
    103103   
    104 AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const IntPoint& point) const
     104AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const LayoutPoint& point) const
    105105{
    106106    if (m_children.size()) {
  • trunk/Source/WebCore/accessibility/AccessibilitySlider.h

    r98421 r106884  
    4949    HTMLInputElement* element() const;
    5050    virtual bool accessibilityIsIgnored() const;
    51     virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const;
     51    virtual AccessibilityObject* elementAccessibilityHitTest(const LayoutPoint&) const;
    5252
    5353    virtual AccessibilityRole roleValue() const { return SliderRole; }   
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm

    r103552 r106884  
    26062606
    26072607    // Simulate a click in the middle of the object.
    2608     LayoutPoint clickPoint = m_object->clickPoint();
     2608    IntPoint clickPoint = m_object->clickPoint();
    26092609   
    26102610    PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime());
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r106695 r106884  
    669669        return cssValuePool->createIdentifierValue(CSSValueNone);
    670670
    671     IntRect box = sizingBox(renderer);
     671    LayoutRect box = sizingBox(renderer);
    672672
    673673    TransformationMatrix transform;
     
    21142114            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    21152115            if (renderer) {
    2116                 IntRect box = sizingBox(renderer);
     2116                LayoutRect box = sizingBox(renderer);
    21172117                list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), cssValuePool));
    21182118                list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), cssValuePool));
  • trunk/Source/WebCore/dom/Clipboard.h

    r98821 r106884  
    7070        virtual PassRefPtr<FileList> files() const = 0;
    7171
    72         LayoutPoint dragLocation() const { return m_dragLoc; }
     72        IntPoint dragLocation() const { return m_dragLoc; }
    7373        CachedImage* dragImage() const { return m_dragImage.get(); }
    74         virtual void setDragImage(CachedImage*, const LayoutPoint&) = 0;
     74        virtual void setDragImage(CachedImage*, const IntPoint&) = 0;
    7575        Node* dragImageElement() const { return m_dragImageElement.get(); }
    76         virtual void setDragImageElement(Node*, const LayoutPoint&) = 0;
     76        virtual void setDragImageElement(Node*, const IntPoint&) = 0;
    7777       
    78         virtual DragImageRef createDragImage(LayoutPoint& dragLocation) const = 0;
     78        virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
    7979#if ENABLE(DRAG_SUPPORT)
    8080        virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
     
    118118       
    119119    protected:
    120         LayoutPoint m_dragLoc;
     120        IntPoint m_dragLoc;
    121121        CachedResourceHandle<CachedImage> m_dragImage;
    122122        RefPtr<Node> m_dragImageElement;
  • trunk/Source/WebCore/dom/DocumentMarkerController.cpp

    r99814 r106884  
    378378}
    379379
    380 Vector<LayoutRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)
    381 {
    382     Vector<LayoutRect> result;
     380Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)
     381{
     382    Vector<IntRect> result;
    383383
    384384    if (!possiblyHasMarkers(markerType))
  • trunk/Source/WebCore/dom/DocumentMarkerController.h

    r99814 r106884  
    7373    Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes);
    7474    Vector<DocumentMarker> markersForNode(Node*);
    75     Vector<LayoutRect> renderedRectsForMarkers(DocumentMarker::MarkerType);
     75    Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType);
    7676    void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes);
    7777
  • trunk/Source/WebCore/dom/Element.cpp

    r106757 r106884  
    567567}
    568568   
    569 LayoutRect Element::screenRect() const
     569IntRect Element::screenRect() const
    570570{
    571571    if (!renderer())
    572         return LayoutRect();
     572        return IntRect();
    573573    // FIXME: this should probably respect transforms
    574574    return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRectIgnoringTransforms());
  • trunk/Source/WebCore/dom/Element.h

    r106833 r106884  
    188188   
    189189    // Returns the absolute bounding box translated into screen coordinates:
    190     LayoutRect screenRect() const;
     190    IntRect screenRect() const;
    191191
    192192    void removeAttribute(const String& name);
  • trunk/Source/WebCore/editing/Editor.cpp

    r106695 r106884  
    23192319}
    23202320
    2321 PassRefPtr<Range> Editor::rangeForPoint(const LayoutPoint& windowPoint)
     2321PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
    23222322{
    23232323    Document* document = m_frame->documentAtPoint(windowPoint);
     
    26342634IntRect Editor::firstRectForRange(Range* range) const
    26352635{
    2636     int extraWidthToEndOfLine = 0;
     2636    LayoutUnit extraWidthToEndOfLine = 0;
    26372637    ASSERT(range->startContainer());
    26382638    ASSERT(range->endContainer());
  • trunk/Source/WebCore/editing/RenderedPosition.cpp

    r101561 r106884  
    225225}
    226226
    227 LayoutRect RenderedPosition::absoluteRect(int* extraWidthToEndOfLine) const
     227LayoutRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const
    228228{
    229229    if (isNull())
  • trunk/Source/WebCore/editing/RenderedPosition.h

    r95964 r106884  
    6969
    7070    LayoutRect absoluteRect() const { return absoluteRect(0); }
    71     LayoutRect absoluteRect(int& extraWidthToEndOfLine) const { return absoluteRect(&extraWidthToEndOfLine); }
     71    LayoutRect absoluteRect(LayoutUnit& extraWidthToEndOfLine) const { return absoluteRect(&extraWidthToEndOfLine); }
    7272
    7373private:
     
    8282    bool atRightBoundaryOfBidiRun(ShouldMatchBidiLevel, unsigned char bidiLevelOfRun) const;
    8383
    84     LayoutRect absoluteRect(int* extraWidthToEndOfLine) const;
     84    LayoutRect absoluteRect(LayoutUnit* extraWidthToEndOfLine) const;
    8585
    8686    RenderObject* m_renderer;
  • trunk/Source/WebCore/editing/VisiblePosition.h

    r93443 r106884  
    9494
    9595    // Rect is local to the returned renderer
    96     IntRect localCaretRect(RenderObject*&) const;
     96    LayoutRect localCaretRect(RenderObject*&) const;
    9797    // Bounds of (possibly transformed) caret in absolute coords
    9898    IntRect absoluteCaretBounds() const;
  • trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp

    r103992 r106884  
    289289
    290290    // 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;
    293293
    294294    // 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  
    192192#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    193193
    194 PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
     194PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const LayoutSize& size, HTMLAppletElement* element, const HashMap<String, String>& args)
    195195{
    196196    String baseURLString;
  • trunk/Source/WebCore/loader/SubframeLoader.h

    r95901 r106884  
    3333
    3434#include "FrameLoaderTypes.h"
     35#include "LayoutTypes.h"
    3536#include "PlatformString.h"
    3637#include <wtf/Forward.h>
     
    7273#endif
    7374
    74     PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args);
     75    PassRefPtr<Widget> createJavaAppletWidget(const LayoutSize&, HTMLAppletElement*, const HashMap<String, String>& args);
    7576
    7677    bool allowPlugins(ReasonForCallingAllowPlugins);
  • trunk/Source/WebCore/page/EventHandler.cpp

    r106649 r106884  
    14821482    // Save the document point we generate in case the window coordinate is invalidated by what happens
    14831483    // when we dispatch the event.
    1484     IntPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position());
     1484    LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position());
    14851485    MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
    14861486
  • trunk/Source/WebCore/page/Frame.cpp

    r106695 r106884  
    10721072    m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode.
    10731073
    1074     IntRect topLevelRect;
     1074    LayoutRect topLevelRect;
    10751075    IntRect paintingRect = renderer->paintingRootRect(topLevelRect);
    10761076
  • trunk/Source/WebCore/page/win/FrameCGWin.cpp

    r86451 r106884  
    9898        return 0;
    9999
    100     IntRect topLevelRect;
     100    LayoutRect topLevelRect;
    101101    IntRect paintingRect = renderer->paintingRootRect(topLevelRect);
    102102
Note: See TracChangeset for help on using the changeset viewer.