Changeset 93071 in webkit


Ignore:
Timestamp:
Aug 15, 2011 4:51:21 PM (13 years ago)
Author:
eae@chromium.org
Message:

Switch Element/Node to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=66260

Reviewed by Eric Seidel.

Convert Element, Node, ElementRareData and ContainerNode to new layout
abstraction as a part of the ongoing conversion work.

No new tests, no new functionality.

  • dom/ContainerNode.cpp:

(WebCore::ContainerNode::getLowerRightCorner):
(WebCore::ContainerNode::getRect):

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

(WebCore::Element::scrollIntoView):
(WebCore::Element::scrollIntoViewIfNeeded):
(WebCore::adjustForLocalZoom):
(WebCore::Element::boundsInWindowSpace):
(WebCore::Element::getClientRects):
(WebCore::Element::getBoundingClientRect):
(WebCore::Element::screenRect):
(WebCore::Element::minimumSizeForResizing):
(WebCore::Element::setMinimumSizeForResizing):

  • dom/Element.h:
  • dom/ElementRareData.h:
  • dom/Node.cpp:

(WebCore::Node::getRect):
(WebCore::Node::renderRect):
(WebCore::Node::hasNonEmptyBoundingBox):

  • dom/Node.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93068 r93071  
     12011-08-15  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch Element/Node to to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=66260
     5
     6        Reviewed by Eric Seidel.
     7
     8        Convert Element, Node, ElementRareData and ContainerNode to new layout
     9        abstraction as a part of the ongoing conversion work.
     10
     11        No new tests, no new functionality.
     12
     13        * dom/ContainerNode.cpp:
     14        (WebCore::ContainerNode::getLowerRightCorner):
     15        (WebCore::ContainerNode::getRect):
     16        * dom/ContainerNode.h:
     17        * dom/Element.cpp:
     18        (WebCore::Element::scrollIntoView):
     19        (WebCore::Element::scrollIntoViewIfNeeded):
     20        (WebCore::adjustForLocalZoom):
     21        (WebCore::Element::boundsInWindowSpace):
     22        (WebCore::Element::getClientRects):
     23        (WebCore::Element::getBoundingClientRect):
     24        (WebCore::Element::screenRect):
     25        (WebCore::Element::minimumSizeForResizing):
     26        (WebCore::Element::setMinimumSizeForResizing):
     27        * dom/Element.h:
     28        * dom/ElementRareData.h:
     29        * dom/Node.cpp:
     30        (WebCore::Node::getRect):
     31        (WebCore::Node::renderRect):
     32        (WebCore::Node::hasNonEmptyBoundingBox):
     33        * dom/Node.h:
     34
    1352011-08-15  Alexey Proskuryakov  <ap@apple.com>
    236
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r88570 r93071  
    948948            if (o->isText()) {
    949949                RenderText* text = toRenderText(o);
    950                 IntRect linesBox = text->linesBoundingBox();
     950                LayoutRect linesBox = text->linesBoundingBox();
    951951                if (!linesBox.maxX() && !linesBox.maxY())
    952952                    continue;
     
    963963}
    964964
    965 IntRect ContainerNode::getRect() const
     965LayoutRect ContainerNode::getRect() const
    966966{
    967967    FloatPoint  upperLeft, lowerRight;
     
    978978    }
    979979
    980     return enclosingIntRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
     980    return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
    981981}
    982982
  • trunk/Source/WebCore/dom/ContainerNode.h

    r88570 r93071  
    6161    virtual void detach();
    6262    virtual void willRemove();
    63     virtual IntRect getRect() const;
     63    virtual LayoutRect getRect() const;
    6464    virtual void setFocus(bool = true);
    6565    virtual void setActive(bool active = true, bool pause = false);
  • trunk/Source/WebCore/dom/Element.cpp

    r91895 r93071  
    282282        return;
    283283
    284     IntRect bounds = getRect();   
     284    LayoutRect bounds = getRect();
    285285    // Align to the top / bottom and to the closest edge.
    286286    if (alignToTop)
     
    297297        return;
    298298
    299     IntRect bounds = getRect();   
     299    LayoutRect bounds = getRect();
    300300    if (centerIfNeeded)
    301301        renderer()->enclosingLayer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
     
    355355}
    356356
    357 static int adjustForLocalZoom(int value, RenderObject* renderer)
     357static LayoutUnit adjustForLocalZoom(LayoutUnit value, RenderObject* renderer)
    358358{
    359359    float zoomFactor = localZoomForRenderer(renderer);
     
    363363    if (zoomFactor > 1)
    364364        value++;
    365     return static_cast<int>(value / zoomFactor);
     365    return static_cast<LayoutUnit>(value / zoomFactor);
    366366}
    367367
     
    512512}
    513513
    514 IntRect Element::boundsInWindowSpace()
     514LayoutRect Element::boundsInWindowSpace()
    515515{
    516516    document()->updateLayoutIgnorePendingStylesheets();
     
    518518    FrameView* view = document()->view();
    519519    if (!view)
    520         return IntRect();
     520        return LayoutRect();
    521521
    522522    Vector<FloatQuad> quads;
     
    537537
    538538    if (quads.isEmpty())
    539         return IntRect();
    540 
    541     IntRect result = quads[0].enclosingBoundingBox();
     539        return LayoutRect();
     540
     541    LayoutRect result = quads[0].enclosingBoundingBox();
    542542    for (size_t i = 1; i < quads.size(); ++i)
    543543        result.unite(quads[i].enclosingBoundingBox());
     
    568568
    569569    if (FrameView* view = document()->view()) {
    570         IntRect visibleContentRect = view->visibleContentRect();
     570        LayoutRect visibleContentRect = view->visibleContentRect();
    571571        for (size_t i = 0; i < quads.size(); ++i) {
    572572            quads[i].move(-visibleContentRect.x(), -visibleContentRect.y());
     
    608608
    609609    if (FrameView* view = document()->view()) {
    610         IntRect visibleContentRect = view->visibleContentRect();
     610        LayoutRect visibleContentRect = view->visibleContentRect();
    611611        result.move(-visibleContentRect.x(), -visibleContentRect.y());
    612612    }
     
    621621}
    622622   
    623 IntRect Element::screenRect() const
     623LayoutRect Element::screenRect() const
    624624{
    625625    if (!renderer())
    626         return IntRect();
     626        return LayoutRect();
    627627    return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect());
    628628}
     
    17231723}
    17241724
    1725 IntSize Element::minimumSizeForResizing() const
     1725LayoutSize Element::minimumSizeForResizing() const
    17261726{
    17271727    return hasRareData() ? rareData()->m_minimumSizeForResizing : defaultMinimumSizeForResizing();
    17281728}
    17291729
    1730 void Element::setMinimumSizeForResizing(const IntSize& size)
     1730void Element::setMinimumSizeForResizing(const LayoutSize& size)
    17311731{
    17321732    if (size == defaultMinimumSizeForResizing() && !hasRareData())
  • trunk/Source/WebCore/dom/Element.h

    r91982 r93071  
    169169    virtual int scrollHeight();
    170170
    171     IntRect boundsInWindowSpace();
     171    LayoutRect boundsInWindowSpace();
    172172
    173173    PassRefPtr<ClientRectList> getClientRects();
     
    175175   
    176176    // Returns the absolute bounding box translated into screen coordinates:
    177     IntRect screenRect() const;
     177    LayoutRect screenRect() const;
    178178
    179179    void removeAttribute(const String& name, ExceptionCode&);
     
    273273    void updateId(const AtomicString& oldId, const AtomicString& newId);
    274274
    275     IntSize minimumSizeForResizing() const;
    276     void setMinimumSizeForResizing(const IntSize&);
     275    LayoutSize minimumSizeForResizing() const;
     276    void setMinimumSizeForResizing(const LayoutSize&);
    277277
    278278    // Use Document::registerForDocumentActivationCallbacks() to subscribe to these
  • trunk/Source/WebCore/dom/ElementRareData.h

    r90691 r93071  
    4343    using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach;
    4444
    45     IntSize m_minimumSizeForResizing;
     45    LayoutSize m_minimumSizeForResizing;
    4646    RefPtr<RenderStyle> m_computedStyle;
    4747    ShadowRoot* m_shadowRoot;
  • trunk/Source/WebCore/dom/Node.cpp

    r93038 r93071  
    820820}
    821821
    822 IntRect Node::getRect() const
     822LayoutRect Node::getRect() const
    823823{
    824824    if (renderer())
    825825        return renderer()->absoluteBoundingBoxRect(true);
    826     return IntRect();
    827 }
    828    
    829 IntRect Node::renderRect(bool* isReplaced)
     826    return LayoutRect();
     827}
     828   
     829LayoutRect Node::renderRect(bool* isReplaced)
    830830{   
    831831    RenderObject* hitRenderer = this->renderer();
     
    839839        renderer = renderer->parent();
    840840    }
    841     return IntRect();   
     841    return LayoutRect();   
    842842}
    843843
     
    852852        return true;
    853853
    854     Vector<IntRect> rects;
     854    Vector<LayoutRect> rects;
    855855    FloatPoint absPos = renderer()->localToAbsolute();
    856     renderer()->absoluteRects(rects, flooredIntPoint(absPos));
     856    renderer()->absoluteRects(rects, flooredLayoutPoint(absPos));
    857857    size_t n = rects.size();
    858858    for (size_t i = 0; i < n; ++i)
  • trunk/Source/WebCore/dom/Node.h

    r93038 r93071  
    2828#include "EventTarget.h"
    2929#include "KURLHash.h"
     30#include "LayoutTypes.h"
    3031#include "RenderStyleConstants.h"
    3132#include "ScriptWrappable.h"
     
    344345    bool rendererIsRichlyEditable() const { return rendererIsEditable(RichlyEditable); }
    345346    virtual bool shouldUseInputMethod();
    346     virtual IntRect getRect() const;
    347     IntRect renderRect(bool* isReplaced);
     347    virtual LayoutRect getRect() const;
     348    LayoutRect renderRect(bool* isReplaced);
    348349
    349350    // Returns true if the node has a non-empty bounding box in layout.
Note: See TracChangeset for help on using the changeset viewer.