| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode); | 1965 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode); |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const { | 1968 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const { |
| 1969 ASSERT(o == container()); | 1969 ASSERT(o == container()); |
| 1970 | 1970 |
| 1971 LayoutSize offset; | 1971 LayoutSize offset; |
| 1972 if (isInFlowPositioned()) | 1972 if (isInFlowPositioned()) |
| 1973 offset += offsetForInFlowPosition(); | 1973 offset += offsetForInFlowPosition(); |
| 1974 | 1974 |
| 1975 offset += topLeftLocationOffset(); | 1975 offset += physicalLocationOffset(); |
| 1976 | 1976 |
| 1977 if (o->hasOverflowClip()) | 1977 if (o->hasOverflowClip()) |
| 1978 offset -= toLayoutBox(o)->scrolledContentOffset(); | 1978 offset -= toLayoutBox(o)->scrolledContentOffset(); |
| 1979 | 1979 |
| 1980 if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && | 1980 if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && |
| 1981 o->isLayoutInline()) | 1981 o->isLayoutInline()) |
| 1982 offset += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); | 1982 offset += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); |
| 1983 | 1983 |
| 1984 return offset; | 1984 return offset; |
| 1985 } | 1985 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 layer()->setStaticBlockPosition(box->logicalTop()); | 2018 layer()->setStaticBlockPosition(box->logicalTop()); |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 if (container()->isLayoutInline()) | 2021 if (container()->isLayoutInline()) |
| 2022 moveWithEdgeOfInlineContainerIfNecessary(box->isHorizontal()); | 2022 moveWithEdgeOfInlineContainerIfNecessary(box->isHorizontal()); |
| 2023 | 2023 |
| 2024 // Nuke the box. | 2024 // Nuke the box. |
| 2025 box->remove(DontMarkLineBoxes); | 2025 box->remove(DontMarkLineBoxes); |
| 2026 box->destroy(); | 2026 box->destroy(); |
| 2027 } else if (isAtomicInlineLevel()) { | 2027 } else if (isAtomicInlineLevel()) { |
| 2028 setLocationAndUpdateOverflowControlsIfNeeded(box->topLeft()); | 2028 setLocationAndUpdateOverflowControlsIfNeeded(box->location()); |
| 2029 setInlineBoxWrapper(box); | 2029 setInlineBoxWrapper(box); |
| 2030 } | 2030 } |
| 2031 } | 2031 } |
| 2032 | 2032 |
| 2033 void LayoutBox::moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal) { | 2033 void LayoutBox::moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal) { |
| 2034 ASSERT(isOutOfFlowPositioned() && container()->isLayoutInline() && | 2034 ASSERT(isOutOfFlowPositioned() && container()->isLayoutInline() && |
| 2035 container()->isInFlowPositioned()); | 2035 container()->isInFlowPositioned()); |
| 2036 // If this object is inside a relative positioned inline and its inline | 2036 // If this object is inside a relative positioned inline and its inline |
| 2037 // position is an explicit offset from the edge of its container then it will | 2037 // position is an explicit offset from the edge of its container then it will |
| 2038 // need to move if its inline container has changed width. We do not track if | 2038 // need to move if its inline container has changed width. We do not track if |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 // Use enclosingIntRect because we cannot properly compute pixel snapping | 2312 // Use enclosingIntRect because we cannot properly compute pixel snapping |
| 2313 // for painted elements within the transform since we don't know the desired | 2313 // for painted elements within the transform since we don't know the desired |
| 2314 // subpixel accumulation at this point, and the transform may include a | 2314 // subpixel accumulation at this point, and the transform may include a |
| 2315 // scale. | 2315 // scale. |
| 2316 FloatRect floatRect = | 2316 FloatRect floatRect = |
| 2317 rect.isEmpty() ? FloatRect(rect) : FloatRect(enclosingIntRect(rect)); | 2317 rect.isEmpty() ? FloatRect(rect) : FloatRect(enclosingIntRect(rect)); |
| 2318 rect = LayoutRect(layer()->transform()->mapRect(floatRect)); | 2318 rect = LayoutRect(layer()->transform()->mapRect(floatRect)); |
| 2319 } | 2319 } |
| 2320 LayoutPoint topLeft = rect.location(); | 2320 LayoutPoint topLeft = rect.location(); |
| 2321 if (container->isBox()) { | 2321 if (container->isBox()) { |
| 2322 topLeft.moveBy(topLeftLocation(toLayoutBox(container))); | 2322 topLeft.moveBy(physicalLocation(toLayoutBox(container))); |
| 2323 // If the row is the ancestor, however, add its offset back in. In effect, | 2323 // If the row is the ancestor, however, add its offset back in. In effect, |
| 2324 // this passes from the joint <td> / <tr> coordinate space to the parent | 2324 // this passes from the joint <td> / <tr> coordinate space to the parent |
| 2325 // space, then back to <tr> / <td>. | 2325 // space, then back to <tr> / <td>. |
| 2326 if (tableRowContainer) | 2326 if (tableRowContainer) { |
| 2327 topLeft.moveBy( | 2327 topLeft.moveBy( |
| 2328 -tableRowContainer->topLeftLocation(toLayoutBox(container))); | 2328 -tableRowContainer->physicalLocation(toLayoutBox(container))); |
| 2329 } |
| 2329 } else if (container->isRuby()) { | 2330 } else if (container->isRuby()) { |
| 2330 // TODO(wkorman): Generalize Ruby specialization and/or document more | 2331 // TODO(wkorman): Generalize Ruby specialization and/or document more |
| 2331 // clearly. See the accompanying specialization in | 2332 // clearly. See the accompanying specialization in |
| 2332 // LayoutInline::mapToVisualRectInAncestorSpace. | 2333 // LayoutInline::mapToVisualRectInAncestorSpace. |
| 2333 topLeft.moveBy(topLeftLocation()); | 2334 topLeft.moveBy(physicalLocation()); |
| 2334 } else { | 2335 } else { |
| 2335 topLeft.moveBy(location()); | 2336 topLeft.moveBy(location()); |
| 2336 } | 2337 } |
| 2337 | 2338 |
| 2338 const ComputedStyle& styleToUse = styleRef(); | 2339 const ComputedStyle& styleToUse = styleRef(); |
| 2339 EPosition position = styleToUse.position(); | 2340 EPosition position = styleToUse.position(); |
| 2340 if (position == AbsolutePosition && container->isInFlowPositioned() && | 2341 if (position == AbsolutePosition && container->isInFlowPositioned() && |
| 2341 container->isLayoutInline()) { | 2342 container->isLayoutInline()) { |
| 2342 topLeft += | 2343 topLeft += |
| 2343 toLayoutInline(container)->offsetForInFlowPositionedInline(*this); | 2344 toLayoutInline(container)->offsetForInFlowPositionedInline(*this); |
| (...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5149 LayoutRect LayoutBox::visualOverflowRect() const { | 5150 LayoutRect LayoutBox::visualOverflowRect() const { |
| 5150 if (!m_overflow) | 5151 if (!m_overflow) |
| 5151 return borderBoxRect(); | 5152 return borderBoxRect(); |
| 5152 if (hasOverflowClip()) | 5153 if (hasOverflowClip()) |
| 5153 return m_overflow->selfVisualOverflowRect(); | 5154 return m_overflow->selfVisualOverflowRect(); |
| 5154 return unionRect(m_overflow->selfVisualOverflowRect(), | 5155 return unionRect(m_overflow->selfVisualOverflowRect(), |
| 5155 m_overflow->contentsVisualOverflowRect()); | 5156 m_overflow->contentsVisualOverflowRect()); |
| 5156 } | 5157 } |
| 5157 | 5158 |
| 5158 LayoutUnit LayoutBox::offsetLeft(const Element* parent) const { | 5159 LayoutUnit LayoutBox::offsetLeft(const Element* parent) const { |
| 5159 return adjustedPositionRelativeTo(topLeftLocation(), parent).x(); | 5160 return adjustedPositionRelativeTo(physicalLocation(), parent).x(); |
| 5160 } | 5161 } |
| 5161 | 5162 |
| 5162 LayoutUnit LayoutBox::offsetTop(const Element* parent) const { | 5163 LayoutUnit LayoutBox::offsetTop(const Element* parent) const { |
| 5163 return adjustedPositionRelativeTo(topLeftLocation(), parent).y(); | 5164 return adjustedPositionRelativeTo(physicalLocation(), parent).y(); |
| 5164 } | 5165 } |
| 5165 | 5166 |
| 5166 LayoutPoint LayoutBox::flipForWritingModeForChild( | 5167 LayoutPoint LayoutBox::flipForWritingModeForChild( |
| 5167 const LayoutBox* child, | 5168 const LayoutBox* child, |
| 5168 const LayoutPoint& point) const { | 5169 const LayoutPoint& point) const { |
| 5169 if (!style()->isFlippedBlocksWritingMode()) | 5170 if (!style()->isFlippedBlocksWritingMode()) |
| 5170 return point; | 5171 return point; |
| 5171 | 5172 |
| 5172 // The child is going to add in its x(), so we have to make sure it ends up in | 5173 // The child is going to add in its x(), so we have to make sure it ends up in |
| 5173 // the right place. | 5174 // the right place. |
| 5174 return LayoutPoint(point.x() + size().width() - child->size().width() - | 5175 return LayoutPoint(point.x() + size().width() - child->size().width() - |
| 5175 (2 * child->location().x()), | 5176 (2 * child->location().x()), |
| 5176 point.y()); | 5177 point.y()); |
| 5177 } | 5178 } |
| 5178 | 5179 |
| 5179 LayoutBox* LayoutBox::locationContainer() const { | 5180 LayoutBox* LayoutBox::locationContainer() const { |
| 5180 // Location of a non-root SVG object derived from LayoutBox should not be | 5181 // Location of a non-root SVG object derived from LayoutBox should not be |
| 5181 // affected by writing-mode of the containing box (SVGRoot). | 5182 // affected by writing-mode of the containing box (SVGRoot). |
| 5182 if (isSVG() && !isSVGRoot()) | 5183 if (isSVG() && !isSVGRoot()) |
| 5183 return nullptr; | 5184 return nullptr; |
| 5184 | 5185 |
| 5185 // Normally the box's location is relative to its containing box. | 5186 // Normally the box's location is relative to its containing box. |
| 5186 LayoutObject* container = this->container(); | 5187 LayoutObject* container = this->container(); |
| 5187 while (container && !container->isBox()) | 5188 while (container && !container->isBox()) |
| 5188 container = container->container(); | 5189 container = container->container(); |
| 5189 return toLayoutBox(container); | 5190 return toLayoutBox(container); |
| 5190 } | 5191 } |
| 5191 | 5192 |
| 5192 LayoutPoint LayoutBox::topLeftLocation( | 5193 LayoutPoint LayoutBox::physicalLocation( |
| 5193 const LayoutBox* flippedBlocksContainer) const { | 5194 const LayoutBox* flippedBlocksContainer) const { |
| 5194 const LayoutBox* containerBox; | 5195 const LayoutBox* containerBox; |
| 5195 if (flippedBlocksContainer) { | 5196 if (flippedBlocksContainer) { |
| 5196 DCHECK(flippedBlocksContainer == locationContainer()); | 5197 DCHECK(flippedBlocksContainer == locationContainer()); |
| 5197 containerBox = flippedBlocksContainer; | 5198 containerBox = flippedBlocksContainer; |
| 5198 } else { | 5199 } else { |
| 5199 containerBox = locationContainer(); | 5200 containerBox = locationContainer(); |
| 5200 } | 5201 } |
| 5201 if (!containerBox) | 5202 if (!containerBox) |
| 5202 return location(); | 5203 return location(); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5624 LayoutRect rect = frameRect(); | 5625 LayoutRect rect = frameRect(); |
| 5625 | 5626 |
| 5626 LayoutBlock* block = containingBlock(); | 5627 LayoutBlock* block = containingBlock(); |
| 5627 if (block) | 5628 if (block) |
| 5628 block->adjustChildDebugRect(rect); | 5629 block->adjustChildDebugRect(rect); |
| 5629 | 5630 |
| 5630 return rect; | 5631 return rect; |
| 5631 } | 5632 } |
| 5632 | 5633 |
| 5633 } // namespace blink | 5634 } // namespace blink |
| OLD | NEW |