OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 if (topLevel && continuation()) { | 1697 if (topLevel && continuation()) { |
1698 rects.append(IntRect(tx, ty - collapsedMarginTop(), | 1698 rects.append(IntRect(tx, ty - collapsedMarginTop(), |
1699 width(), height() + collapsedMarginTop() + collapse
dMarginBottom())); | 1699 width(), height() + collapsedMarginTop() + collapse
dMarginBottom())); |
1700 continuation()->absoluteRects(rects, | 1700 continuation()->absoluteRects(rects, |
1701 tx - xPos() + continuation()->containingBl
ock()->xPos(), | 1701 tx - xPos() + continuation()->containingBl
ock()->xPos(), |
1702 ty - yPos() + continuation()->containingBl
ock()->yPos(), topLevel); | 1702 ty - yPos() + continuation()->containingBl
ock()->yPos(), topLevel); |
1703 } else | 1703 } else |
1704 rects.append(IntRect(tx, ty, width(), height() + borderTopExtra() + bord
erBottomExtra())); | 1704 rects.append(IntRect(tx, ty, width(), height() + borderTopExtra() + bord
erBottomExtra())); |
1705 } | 1705 } |
1706 | 1706 |
1707 IntRect RenderObject::absoluteBoundingBoxRect() | 1707 IntRect RenderObject::absoluteBoundingBoxRect(bool useTransforms) |
1708 { | 1708 { |
1709 // FIXME: This doesn't work correctly with transforms. | 1709 if (useTransforms) { |
| 1710 Vector<FloatQuad> quads; |
| 1711 absoluteQuads(quads); |
| 1712 |
| 1713 size_t n = quads.size(); |
| 1714 if (!n) |
| 1715 return IntRect(); |
| 1716 |
| 1717 IntRect result = quads[0].enclosingBoundingBox(); |
| 1718 for (size_t i = 1; i < n; ++i) |
| 1719 result.unite(quads[i].enclosingBoundingBox()); |
| 1720 return result; |
| 1721 } |
| 1722 |
1710 FloatPoint absPos = localToAbsolute(); | 1723 FloatPoint absPos = localToAbsolute(); |
1711 Vector<IntRect> rects; | 1724 Vector<IntRect> rects; |
1712 absoluteRects(rects, absPos.x(), absPos.y()); | 1725 absoluteRects(rects, absPos.x(), absPos.y()); |
1713 | 1726 |
1714 size_t n = rects.size(); | 1727 size_t n = rects.size(); |
1715 if (!n) | 1728 if (!n) |
1716 return IntRect(); | 1729 return IntRect(); |
1717 | 1730 |
1718 IntRect result = rects[0]; | 1731 IntRect result = rects[0]; |
1719 for (size_t i = 1; i < n; ++i) | 1732 for (size_t i = 1; i < n; ++i) |
1720 result.unite(rects[i]); | 1733 result.unite(rects[i]); |
1721 return result; | 1734 return result; |
1722 } | 1735 } |
1723 | 1736 |
| 1737 void RenderObject::collectAbsoluteLineBoxQuads(Vector<FloatQuad>& quads, unsigne
d startOffset, unsigned endOffset, bool useSelectionHeight) |
| 1738 { |
| 1739 } |
| 1740 |
| 1741 void RenderObject::absoluteQuads(Vector<FloatQuad>& quads, bool topLevel) |
| 1742 { |
| 1743 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the |
| 1744 // inline boxes above and below us (thus getting merged with them to form a
single irregular |
| 1745 // shape). |
| 1746 if (topLevel && continuation()) { |
| 1747 FloatRect localRect(0, -collapsedMarginTop(), |
| 1748 width(), height() + collapsedMarginTop() + collapsed
MarginBottom()); |
| 1749 quads.append(localToAbsoluteQuad(localRect)); |
| 1750 continuation()->absoluteQuads(quads, topLevel); |
| 1751 } else |
| 1752 quads.append(localToAbsoluteQuad(FloatRect(0, 0, width(), height() + bor
derTopExtra() + borderBottomExtra()))); |
| 1753 } |
| 1754 |
1724 void RenderObject::addAbsoluteRectForLayer(IntRect& result) | 1755 void RenderObject::addAbsoluteRectForLayer(IntRect& result) |
1725 { | 1756 { |
1726 if (hasLayer()) | 1757 if (hasLayer()) |
1727 result.unite(absoluteBoundingBoxRect()); | 1758 result.unite(absoluteBoundingBoxRect()); |
1728 for (RenderObject* current = firstChild(); current; current = current->nextS
ibling()) | 1759 for (RenderObject* current = firstChild(); current; current = current->nextS
ibling()) |
1729 current->addAbsoluteRectForLayer(result); | 1760 current->addAbsoluteRectForLayer(result); |
1730 } | 1761 } |
1731 | 1762 |
1732 IntRect RenderObject::paintingRootRect(IntRect& topLevelRect) | 1763 IntRect RenderObject::paintingRootRect(IntRect& topLevelRect) |
1733 { | 1764 { |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 if (o) { | 2422 if (o) { |
2392 FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTra
nsforms); | 2423 FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTra
nsforms); |
2393 localPoint.move(0.0f, -static_cast<float>(o->borderTopExtra())); | 2424 localPoint.move(0.0f, -static_cast<float>(o->borderTopExtra())); |
2394 if (o->hasOverflowClip()) | 2425 if (o->hasOverflowClip()) |
2395 localPoint += o->layer()->scrolledContentOffset(); | 2426 localPoint += o->layer()->scrolledContentOffset(); |
2396 return localPoint; | 2427 return localPoint; |
2397 } | 2428 } |
2398 return FloatPoint(); | 2429 return FloatPoint(); |
2399 } | 2430 } |
2400 | 2431 |
| 2432 FloatQuad RenderObject::localToAbsoluteQuad(const FloatQuad& localQuad, bool fix
ed) const |
| 2433 { |
| 2434 RenderObject* o = parent(); |
| 2435 if (o) { |
| 2436 FloatQuad quad = localQuad; |
| 2437 quad.move(0.0f, static_cast<float>(o->borderTopExtra())); |
| 2438 if (o->hasOverflowClip()) |
| 2439 quad -= o->layer()->scrolledContentOffset(); |
| 2440 return o->localToAbsoluteQuad(quad, fixed); |
| 2441 } |
| 2442 |
| 2443 return FloatQuad(); |
| 2444 } |
| 2445 |
2401 IntRect RenderObject::caretRect(InlineBox* inlineBox, int caretOffset, int* extr
aWidthToEndOfLine) | 2446 IntRect RenderObject::caretRect(InlineBox* inlineBox, int caretOffset, int* extr
aWidthToEndOfLine) |
2402 { | 2447 { |
2403 if (extraWidthToEndOfLine) | 2448 if (extraWidthToEndOfLine) |
2404 *extraWidthToEndOfLine = 0; | 2449 *extraWidthToEndOfLine = 0; |
2405 | 2450 |
2406 return IntRect(); | 2451 return IntRect(); |
2407 } | 2452 } |
2408 | 2453 |
2409 int RenderObject::paddingTop() const | 2454 int RenderObject::paddingTop() const |
2410 { | 2455 { |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3063 } | 3108 } |
3064 | 3109 |
3065 IntRect RenderObject::absoluteContentBox() const | 3110 IntRect RenderObject::absoluteContentBox() const |
3066 { | 3111 { |
3067 IntRect rect = contentBox(); | 3112 IntRect rect = contentBox(); |
3068 FloatPoint absPos = localToAbsoluteForContent(FloatPoint()); | 3113 FloatPoint absPos = localToAbsoluteForContent(FloatPoint()); |
3069 rect.move(absPos.x(), absPos.y()); | 3114 rect.move(absPos.x(), absPos.y()); |
3070 return rect; | 3115 return rect; |
3071 } | 3116 } |
3072 | 3117 |
| 3118 FloatQuad RenderObject::absoluteContentQuad() const |
| 3119 { |
| 3120 IntRect rect = contentBox(); |
| 3121 return localToAbsoluteQuad(FloatRect(rect)); |
| 3122 } |
| 3123 |
3073 void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const | 3124 void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const |
3074 { | 3125 { |
3075 int outlineSize = !isInline() && continuation() ? continuation()->style()->o
utlineSize() : style()->outlineSize(); | 3126 int outlineSize = !isInline() && continuation() ? continuation()->style()->o
utlineSize() : style()->outlineSize(); |
3076 if (ShadowData* boxShadow = style()->boxShadow()) { | 3127 if (ShadowData* boxShadow = style()->boxShadow()) { |
3077 int shadowLeft = 0; | 3128 int shadowLeft = 0; |
3078 int shadowRight = 0; | 3129 int shadowRight = 0; |
3079 int shadowTop = 0; | 3130 int shadowTop = 0; |
3080 int shadowBottom = 0; | 3131 int shadowBottom = 0; |
3081 | 3132 |
3082 do { | 3133 do { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3179 | 3230 |
3180 #ifndef NDEBUG | 3231 #ifndef NDEBUG |
3181 | 3232 |
3182 void showTree(const WebCore::RenderObject* ro) | 3233 void showTree(const WebCore::RenderObject* ro) |
3183 { | 3234 { |
3184 if (ro) | 3235 if (ro) |
3185 ro->showTreeForThis(); | 3236 ro->showTreeForThis(); |
3186 } | 3237 } |
3187 | 3238 |
3188 #endif | 3239 #endif |
OLD | NEW |