Changeset 93071 in webkit
- Timestamp:
- Aug 15, 2011 4:51:21 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r93068 r93071 1 2011-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 1 35 2011-08-15 Alexey Proskuryakov <ap@apple.com> 2 36 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r88570 r93071 948 948 if (o->isText()) { 949 949 RenderText* text = toRenderText(o); 950 IntRect linesBox = text->linesBoundingBox();950 LayoutRect linesBox = text->linesBoundingBox(); 951 951 if (!linesBox.maxX() && !linesBox.maxY()) 952 952 continue; … … 963 963 } 964 964 965 IntRect ContainerNode::getRect() const965 LayoutRect ContainerNode::getRect() const 966 966 { 967 967 FloatPoint upperLeft, lowerRight; … … 978 978 } 979 979 980 return enclosing IntRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));980 return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft)); 981 981 } 982 982 -
trunk/Source/WebCore/dom/ContainerNode.h
r88570 r93071 61 61 virtual void detach(); 62 62 virtual void willRemove(); 63 virtual IntRect getRect() const;63 virtual LayoutRect getRect() const; 64 64 virtual void setFocus(bool = true); 65 65 virtual void setActive(bool active = true, bool pause = false); -
trunk/Source/WebCore/dom/Element.cpp
r91895 r93071 282 282 return; 283 283 284 IntRect bounds = getRect();284 LayoutRect bounds = getRect(); 285 285 // Align to the top / bottom and to the closest edge. 286 286 if (alignToTop) … … 297 297 return; 298 298 299 IntRect bounds = getRect();299 LayoutRect bounds = getRect(); 300 300 if (centerIfNeeded) 301 301 renderer()->enclosingLayer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded); … … 355 355 } 356 356 357 static int adjustForLocalZoom(int value, RenderObject* renderer)357 static LayoutUnit adjustForLocalZoom(LayoutUnit value, RenderObject* renderer) 358 358 { 359 359 float zoomFactor = localZoomForRenderer(renderer); … … 363 363 if (zoomFactor > 1) 364 364 value++; 365 return static_cast< int>(value / zoomFactor);365 return static_cast<LayoutUnit>(value / zoomFactor); 366 366 } 367 367 … … 512 512 } 513 513 514 IntRect Element::boundsInWindowSpace()514 LayoutRect Element::boundsInWindowSpace() 515 515 { 516 516 document()->updateLayoutIgnorePendingStylesheets(); … … 518 518 FrameView* view = document()->view(); 519 519 if (!view) 520 return IntRect();520 return LayoutRect(); 521 521 522 522 Vector<FloatQuad> quads; … … 537 537 538 538 if (quads.isEmpty()) 539 return IntRect();540 541 IntRect result = quads[0].enclosingBoundingBox();539 return LayoutRect(); 540 541 LayoutRect result = quads[0].enclosingBoundingBox(); 542 542 for (size_t i = 1; i < quads.size(); ++i) 543 543 result.unite(quads[i].enclosingBoundingBox()); … … 568 568 569 569 if (FrameView* view = document()->view()) { 570 IntRect visibleContentRect = view->visibleContentRect();570 LayoutRect visibleContentRect = view->visibleContentRect(); 571 571 for (size_t i = 0; i < quads.size(); ++i) { 572 572 quads[i].move(-visibleContentRect.x(), -visibleContentRect.y()); … … 608 608 609 609 if (FrameView* view = document()->view()) { 610 IntRect visibleContentRect = view->visibleContentRect();610 LayoutRect visibleContentRect = view->visibleContentRect(); 611 611 result.move(-visibleContentRect.x(), -visibleContentRect.y()); 612 612 } … … 621 621 } 622 622 623 IntRect Element::screenRect() const623 LayoutRect Element::screenRect() const 624 624 { 625 625 if (!renderer()) 626 return IntRect();626 return LayoutRect(); 627 627 return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect()); 628 628 } … … 1723 1723 } 1724 1724 1725 IntSize Element::minimumSizeForResizing() const1725 LayoutSize Element::minimumSizeForResizing() const 1726 1726 { 1727 1727 return hasRareData() ? rareData()->m_minimumSizeForResizing : defaultMinimumSizeForResizing(); 1728 1728 } 1729 1729 1730 void Element::setMinimumSizeForResizing(const IntSize& size)1730 void Element::setMinimumSizeForResizing(const LayoutSize& size) 1731 1731 { 1732 1732 if (size == defaultMinimumSizeForResizing() && !hasRareData()) -
trunk/Source/WebCore/dom/Element.h
r91982 r93071 169 169 virtual int scrollHeight(); 170 170 171 IntRect boundsInWindowSpace();171 LayoutRect boundsInWindowSpace(); 172 172 173 173 PassRefPtr<ClientRectList> getClientRects(); … … 175 175 176 176 // Returns the absolute bounding box translated into screen coordinates: 177 IntRect screenRect() const;177 LayoutRect screenRect() const; 178 178 179 179 void removeAttribute(const String& name, ExceptionCode&); … … 273 273 void updateId(const AtomicString& oldId, const AtomicString& newId); 274 274 275 IntSize minimumSizeForResizing() const;276 void setMinimumSizeForResizing(const IntSize&);275 LayoutSize minimumSizeForResizing() const; 276 void setMinimumSizeForResizing(const LayoutSize&); 277 277 278 278 // Use Document::registerForDocumentActivationCallbacks() to subscribe to these -
trunk/Source/WebCore/dom/ElementRareData.h
r90691 r93071 43 43 using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach; 44 44 45 IntSize m_minimumSizeForResizing;45 LayoutSize m_minimumSizeForResizing; 46 46 RefPtr<RenderStyle> m_computedStyle; 47 47 ShadowRoot* m_shadowRoot; -
trunk/Source/WebCore/dom/Node.cpp
r93038 r93071 820 820 } 821 821 822 IntRect Node::getRect() const822 LayoutRect Node::getRect() const 823 823 { 824 824 if (renderer()) 825 825 return renderer()->absoluteBoundingBoxRect(true); 826 return IntRect();827 } 828 829 IntRect Node::renderRect(bool* isReplaced)826 return LayoutRect(); 827 } 828 829 LayoutRect Node::renderRect(bool* isReplaced) 830 830 { 831 831 RenderObject* hitRenderer = this->renderer(); … … 839 839 renderer = renderer->parent(); 840 840 } 841 return IntRect();841 return LayoutRect(); 842 842 } 843 843 … … 852 852 return true; 853 853 854 Vector< IntRect> rects;854 Vector<LayoutRect> rects; 855 855 FloatPoint absPos = renderer()->localToAbsolute(); 856 renderer()->absoluteRects(rects, floored IntPoint(absPos));856 renderer()->absoluteRects(rects, flooredLayoutPoint(absPos)); 857 857 size_t n = rects.size(); 858 858 for (size_t i = 0; i < n; ++i) -
trunk/Source/WebCore/dom/Node.h
r93038 r93071 28 28 #include "EventTarget.h" 29 29 #include "KURLHash.h" 30 #include "LayoutTypes.h" 30 31 #include "RenderStyleConstants.h" 31 32 #include "ScriptWrappable.h" … … 344 345 bool rendererIsRichlyEditable() const { return rendererIsEditable(RichlyEditable); } 345 346 virtual bool shouldUseInputMethod(); 346 virtual IntRect getRect() const;347 IntRect renderRect(bool* isReplaced);347 virtual LayoutRect getRect() const; 348 LayoutRect renderRect(bool* isReplaced); 348 349 349 350 // Returns true if the node has a non-empty bounding box in layout.
Note: See TracChangeset
for help on using the changeset viewer.