Title: [93071] trunk/Source/WebCore
Revision
93071
Author
[email protected]
Date
2011-08-15 16:51:21 -0700 (Mon, 15 Aug 2011)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93070 => 93071)


--- trunk/Source/WebCore/ChangeLog	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/ChangeLog	2011-08-15 23:51:21 UTC (rev 93071)
@@ -1,3 +1,37 @@
+2011-08-15  Emil A Eklund  <[email protected]>
+
+        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:
+
 2011-08-15  Alexey Proskuryakov  <[email protected]>
 
         Regional indicator symbols that are combined should behave as a single character when editing

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (93070 => 93071)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2011-08-15 23:51:21 UTC (rev 93071)
@@ -947,7 +947,7 @@
             point = FloatPoint();
             if (o->isText()) {
                 RenderText* text = toRenderText(o);
-                IntRect linesBox = text->linesBoundingBox();
+                LayoutRect linesBox = text->linesBoundingBox();
                 if (!linesBox.maxX() && !linesBox.maxY())
                     continue;
                 point.moveBy(linesBox.maxXMaxYCorner());
@@ -962,7 +962,7 @@
     return true;
 }
 
-IntRect ContainerNode::getRect() const
+LayoutRect ContainerNode::getRect() const
 {
     FloatPoint  upperLeft, lowerRight;
     bool foundUpperLeft = getUpperLeftCorner(upperLeft);
@@ -977,7 +977,7 @@
             upperLeft = lowerRight;
     } 
 
-    return enclosingIntRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
+    return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
 }
 
 void ContainerNode::setFocus(bool received)

Modified: trunk/Source/WebCore/dom/ContainerNode.h (93070 => 93071)


--- trunk/Source/WebCore/dom/ContainerNode.h	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2011-08-15 23:51:21 UTC (rev 93071)
@@ -60,7 +60,7 @@
     virtual void attach();
     virtual void detach();
     virtual void willRemove();
-    virtual IntRect getRect() const;
+    virtual LayoutRect getRect() const;
     virtual void setFocus(bool = true);
     virtual void setActive(bool active = true, bool pause = false);
     virtual void setHovered(bool = true);

Modified: trunk/Source/WebCore/dom/Element.cpp (93070 => 93071)


--- trunk/Source/WebCore/dom/Element.cpp	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/Element.cpp	2011-08-15 23:51:21 UTC (rev 93071)
@@ -281,7 +281,7 @@
     if (!renderer())
         return;
 
-    IntRect bounds = getRect();    
+    LayoutRect bounds = getRect();
     // Align to the top / bottom and to the closest edge.
     if (alignToTop)
         renderer()->enclosingLayer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
@@ -296,7 +296,7 @@
     if (!renderer())
         return;
 
-    IntRect bounds = getRect();    
+    LayoutRect bounds = getRect();
     if (centerIfNeeded)
         renderer()->enclosingLayer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
     else
@@ -354,7 +354,7 @@
     return zoomFactor;
 }
 
-static int adjustForLocalZoom(int value, RenderObject* renderer)
+static LayoutUnit adjustForLocalZoom(LayoutUnit value, RenderObject* renderer)
 {
     float zoomFactor = localZoomForRenderer(renderer);
     if (zoomFactor == 1)
@@ -362,7 +362,7 @@
     // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
     if (zoomFactor > 1)
         value++;
-    return static_cast<int>(value / zoomFactor);
+    return static_cast<LayoutUnit>(value / zoomFactor);
 }
 
 int Element::offsetLeft()
@@ -511,13 +511,13 @@
     return 0;
 }
 
-IntRect Element::boundsInWindowSpace()
+LayoutRect Element::boundsInWindowSpace()
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     FrameView* view = document()->view();
     if (!view)
-        return IntRect();
+        return LayoutRect();
 
     Vector<FloatQuad> quads;
 #if ENABLE(SVG)
@@ -536,9 +536,9 @@
     }
 
     if (quads.isEmpty())
-        return IntRect();
+        return LayoutRect();
 
-    IntRect result = quads[0].enclosingBoundingBox();
+    LayoutRect result = quads[0].enclosingBoundingBox();
     for (size_t i = 1; i < quads.size(); ++i)
         result.unite(quads[i].enclosingBoundingBox());
 
@@ -567,7 +567,7 @@
     }
 
     if (FrameView* view = document()->view()) {
-        IntRect visibleContentRect = view->visibleContentRect();
+        LayoutRect visibleContentRect = view->visibleContentRect();
         for (size_t i = 0; i < quads.size(); ++i) {
             quads[i].move(-visibleContentRect.x(), -visibleContentRect.y());
             adjustFloatQuadForAbsoluteZoom(quads[i], renderBoxModelObject);
@@ -607,7 +607,7 @@
         result.unite(quads[i].boundingBox());
 
     if (FrameView* view = document()->view()) {
-        IntRect visibleContentRect = view->visibleContentRect();
+        LayoutRect visibleContentRect = view->visibleContentRect();
         result.move(-visibleContentRect.x(), -visibleContentRect.y());
     }
 
@@ -620,10 +620,10 @@
     return ClientRect::create(result);
 }
     
-IntRect Element::screenRect() const
+LayoutRect Element::screenRect() const
 {
     if (!renderer())
-        return IntRect();
+        return LayoutRect();
     return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect());
 }
 
@@ -1722,12 +1722,12 @@
     return String();
 }
 
-IntSize Element::minimumSizeForResizing() const
+LayoutSize Element::minimumSizeForResizing() const
 {
     return hasRareData() ? rareData()->m_minimumSizeForResizing : defaultMinimumSizeForResizing();
 }
 
-void Element::setMinimumSizeForResizing(const IntSize& size)
+void Element::setMinimumSizeForResizing(const LayoutSize& size)
 {
     if (size == defaultMinimumSizeForResizing() && !hasRareData())
         return;

Modified: trunk/Source/WebCore/dom/Element.h (93070 => 93071)


--- trunk/Source/WebCore/dom/Element.h	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/Element.h	2011-08-15 23:51:21 UTC (rev 93071)
@@ -168,13 +168,13 @@
     virtual int scrollWidth();
     virtual int scrollHeight();
 
-    IntRect boundsInWindowSpace();
+    LayoutRect boundsInWindowSpace();
 
     PassRefPtr<ClientRectList> getClientRects();
     PassRefPtr<ClientRect> getBoundingClientRect();
     
     // Returns the absolute bounding box translated into screen coordinates:
-    IntRect screenRect() const;
+    LayoutRect screenRect() const;
 
     void removeAttribute(const String& name, ExceptionCode&);
     void removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode&);
@@ -272,8 +272,8 @@
 
     void updateId(const AtomicString& oldId, const AtomicString& newId);
 
-    IntSize minimumSizeForResizing() const;
-    void setMinimumSizeForResizing(const IntSize&);
+    LayoutSize minimumSizeForResizing() const;
+    void setMinimumSizeForResizing(const LayoutSize&);
 
     // Use Document::registerForDocumentActivationCallbacks() to subscribe to these
     virtual void documentWillBecomeInactive() { }

Modified: trunk/Source/WebCore/dom/ElementRareData.h (93070 => 93071)


--- trunk/Source/WebCore/dom/ElementRareData.h	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/ElementRareData.h	2011-08-15 23:51:21 UTC (rev 93071)
@@ -42,7 +42,7 @@
     using NodeRareData::needsFocusAppearanceUpdateSoonAfterAttach;
     using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach;
 
-    IntSize m_minimumSizeForResizing;
+    LayoutSize m_minimumSizeForResizing;
     RefPtr<RenderStyle> m_computedStyle;
     ShadowRoot* m_shadowRoot;
     AtomicString m_shadowPseudoId;

Modified: trunk/Source/WebCore/dom/Node.cpp (93070 => 93071)


--- trunk/Source/WebCore/dom/Node.cpp	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-08-15 23:51:21 UTC (rev 93071)
@@ -819,14 +819,14 @@
     return m_renderer && m_renderer->isBoxModelObject() ? toRenderBoxModelObject(m_renderer) : 0;
 }
 
-IntRect Node::getRect() const
+LayoutRect Node::getRect() const
 {
     if (renderer())
         return renderer()->absoluteBoundingBoxRect(true);
-    return IntRect();
+    return LayoutRect();
 }
     
-IntRect Node::renderRect(bool* isReplaced)
+LayoutRect Node::renderRect(bool* isReplaced)
 {    
     RenderObject* hitRenderer = this->renderer();
     ASSERT(hitRenderer);
@@ -838,7 +838,7 @@
         }
         renderer = renderer->parent();
     }
-    return IntRect();    
+    return LayoutRect();    
 }
 
 bool Node::hasNonEmptyBoundingBox() const
@@ -851,9 +851,9 @@
     if (!box->borderBoundingBox().isEmpty())
         return true;
 
-    Vector<IntRect> rects;
+    Vector<LayoutRect> rects;
     FloatPoint absPos = renderer()->localToAbsolute();
-    renderer()->absoluteRects(rects, flooredIntPoint(absPos));
+    renderer()->absoluteRects(rects, flooredLayoutPoint(absPos));
     size_t n = rects.size();
     for (size_t i = 0; i < n; ++i)
         if (!rects[i].isEmpty())

Modified: trunk/Source/WebCore/dom/Node.h (93070 => 93071)


--- trunk/Source/WebCore/dom/Node.h	2011-08-15 23:44:41 UTC (rev 93070)
+++ trunk/Source/WebCore/dom/Node.h	2011-08-15 23:51:21 UTC (rev 93071)
@@ -27,6 +27,7 @@
 
 #include "EventTarget.h"
 #include "KURLHash.h"
+#include "LayoutTypes.h"
 #include "RenderStyleConstants.h"
 #include "ScriptWrappable.h"
 #include "TreeShared.h"
@@ -343,8 +344,8 @@
     bool rendererIsEditable() const { return rendererIsEditable(Editable); }
     bool rendererIsRichlyEditable() const { return rendererIsEditable(RichlyEditable); }
     virtual bool shouldUseInputMethod();
-    virtual IntRect getRect() const;
-    IntRect renderRect(bool* isReplaced);
+    virtual LayoutRect getRect() const;
+    LayoutRect renderRect(bool* isReplaced);
 
     // Returns true if the node has a non-empty bounding box in layout.
     // This does not 100% guarantee the user can see it, but is pretty close.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to