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 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const L
ayoutPoint& startPoint) const | 271 LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const L
ayoutPoint& startPoint) const |
272 { | 272 { |
273 // If the element is the HTML body element or doesn't have a parent | 273 // If the element is the HTML body element or doesn't have a parent |
274 // return 0 and stop this algorithm. | 274 // return 0 and stop this algorithm. |
275 if (isBody() || !parent()) | 275 if (isBody() || !parent()) |
276 return LayoutPoint(); | 276 return LayoutPoint(); |
277 | 277 |
278 LayoutPoint referencePoint = startPoint; | 278 LayoutPoint referencePoint = startPoint; |
279 referencePoint.move(parent()->offsetForColumns(referencePoint)); | |
280 | 279 |
281 // If the offsetParent of the element is null, or is the HTML body element, | 280 // If the offsetParent of the element is null, or is the HTML body element, |
282 // return the distance between the canvas origin and the left border edge | 281 // return the distance between the canvas origin and the left border edge |
283 // of the element and stop this algorithm. | 282 // of the element and stop this algorithm. |
284 Element* element = offsetParent(); | 283 Element* element = offsetParent(); |
285 if (!element) | 284 if (!element) |
286 return referencePoint; | 285 return referencePoint; |
287 | 286 |
288 if (const RenderBoxModelObject* offsetParent = element->renderBoxModelObject
()) { | 287 if (const RenderBoxModelObject* offsetParent = element->renderBoxModelObject
()) { |
289 if (offsetParent->isBox() && !offsetParent->isBody()) | 288 if (offsetParent->isBox() && !offsetParent->isBody()) |
290 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen
derBox(offsetParent)->borderTop()); | 289 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen
derBox(offsetParent)->borderTop()); |
291 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { | 290 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { |
292 if (isRelPositioned()) | 291 if (isRelPositioned()) |
293 referencePoint.move(relativePositionOffset()); | 292 referencePoint.move(relativePositionOffset()); |
294 else if (isStickyPositioned()) | 293 else if (isStickyPositioned()) |
295 referencePoint.move(stickyPositionOffset()); | 294 referencePoint.move(stickyPositionOffset()); |
296 | 295 |
297 // CSS regions specification says that region flows should return th
e body element as their offsetParent. | 296 // CSS regions specification says that region flows should return th
e body element as their offsetParent. |
298 // Since we will bypass the body’s renderer anyway, just end the loo
p if we encounter a region flow (named flow thread). | 297 // Since we will bypass the body’s renderer anyway, just end the loo
p if we encounter a region flow (named flow thread). |
299 // See http://dev.w3.org/csswg/css-regions/#cssomview-offset-attribu
tes | 298 // See http://dev.w3.org/csswg/css-regions/#cssomview-offset-attribu
tes |
300 RenderObject* current; | 299 RenderObject* current; |
301 for (current = parent(); current != offsetParent && !current->isRend
erNamedFlowThread() && current->parent(); current = current->parent()) { | 300 for (current = parent(); current != offsetParent && !current->isRend
erNamedFlowThread() && current->parent(); current = current->parent()) { |
302 // FIXME: What are we supposed to do inside SVG content? | 301 // FIXME: What are we supposed to do inside SVG content? |
303 if (!isOutOfFlowPositioned()) { | 302 if (!isOutOfFlowPositioned()) { |
304 if (current->isBox() && !current->isTableRow()) | 303 if (current->isBox() && !current->isTableRow()) |
305 referencePoint.moveBy(toRenderBox(current)->topLeftLocat
ion()); | 304 referencePoint.moveBy(toRenderBox(current)->topLeftLocat
ion()); |
306 referencePoint.move(current->parent()->offsetForColumns(refe
rencePoint)); | |
307 } | 305 } |
308 } | 306 } |
309 | 307 |
310 // Compute the offset position for elements inside named flow thread
s for which the offsetParent was the body. | 308 // Compute the offset position for elements inside named flow thread
s for which the offsetParent was the body. |
311 // See https://code.google.com/p/chromium/issues/detail?id=242168 | 309 // See https://code.google.com/p/chromium/issues/detail?id=242168 |
312 if (current->isRenderNamedFlowThread()) | 310 if (current->isRenderNamedFlowThread()) |
313 referencePoint = toRenderNamedFlowThread(current)->adjustedPosit
ionRelativeToOffsetParent(*this, referencePoint); | 311 referencePoint = toRenderNamedFlowThread(current)->adjustedPosit
ionRelativeToOffsetParent(*this, referencePoint); |
314 else if (offsetParent->isBox() && offsetParent->isBody() && !offsetP
arent->isPositioned()) | 312 else if (offsetParent->isBox() && offsetParent->isBody() && !offsetP
arent->isPositioned()) |
315 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation
()); | 313 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation
()); |
316 } | 314 } |
(...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 // If there is no region to use the FlowThread, then there's no region r
ange for the content in that FlowThread. | 2745 // If there is no region to use the FlowThread, then there's no region r
ange for the content in that FlowThread. |
2748 // An API like elementFromPoint might crash without this check. | 2746 // An API like elementFromPoint might crash without this check. |
2749 if (startRegion) | 2747 if (startRegion) |
2750 o = startRegion; | 2748 o = startRegion; |
2751 } | 2749 } |
2752 | 2750 |
2753 o->mapAbsoluteToLocalPoint(mode, transformState); | 2751 o->mapAbsoluteToLocalPoint(mode, transformState); |
2754 | 2752 |
2755 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); | 2753 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); |
2756 | 2754 |
2757 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { | |
2758 RenderBlock* block = toRenderBlock(o); | |
2759 LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint())); | |
2760 point -= containerOffset; | |
2761 block->adjustForColumnRect(containerOffset, point); | |
2762 } | |
2763 | |
2764 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); | 2755 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); |
2765 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | 2756 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
2766 TransformationMatrix t; | 2757 TransformationMatrix t; |
2767 getTransformFromContainer(o, containerOffset, t); | 2758 getTransformFromContainer(o, containerOffset, t); |
2768 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | 2759 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); |
2769 } else | 2760 } else |
2770 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | 2761 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); |
2771 } | 2762 } |
2772 | 2763 |
2773 const RenderObject* RenderBoxModelObject::pushMappingToContainer(const RenderLay
erModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 2764 const RenderObject* RenderBoxModelObject::pushMappingToContainer(const RenderLay
erModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2838 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2829 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2839 for (RenderObject* child = startChild; child && child != endChild; ) { | 2830 for (RenderObject* child = startChild; child && child != endChild; ) { |
2840 // Save our next sibling as moveChildTo will clear it. | 2831 // Save our next sibling as moveChildTo will clear it. |
2841 RenderObject* nextSibling = child->nextSibling(); | 2832 RenderObject* nextSibling = child->nextSibling(); |
2842 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2833 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2843 child = nextSibling; | 2834 child = nextSibling; |
2844 } | 2835 } |
2845 } | 2836 } |
2846 | 2837 |
2847 } // namespace WebCore | 2838 } // namespace WebCore |
OLD | NEW |