Chromium Code Reviews| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 } | 934 } |
| 935 | 935 |
| 936 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const | 936 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const |
| 937 { | 937 { |
| 938 LayoutObject* o = container(); | 938 LayoutObject* o = container(); |
| 939 if (!o) | 939 if (!o) |
| 940 return; | 940 return; |
| 941 | 941 |
| 942 o->mapAbsoluteToLocalPoint(mode, transformState); | 942 o->mapAbsoluteToLocalPoint(mode, transformState); |
| 943 | 943 |
| 944 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); | 944 LayoutSize containerOffset; |
| 945 | 945 |
| 946 if (o->isLayoutFlowThread()) { | 946 if (isLayoutFlowThread()) { |
| 947 // Descending into a flow thread. Convert to the local coordinate space, i.e. flow thread coordinates. | 947 // Descending into a flow thread. Convert to the local coordinate space, i.e. flow thread coordinates. |
| 948 const LayoutFlowThread* flowThread = toLayoutFlowThread(o); | 948 const LayoutFlowThread* flowThread = toLayoutFlowThread(this); |
| 949 LayoutPoint visualPoint = LayoutPoint(transformState.mappedPoint()); | 949 LayoutPoint visualPoint = LayoutPoint(transformState.mappedPoint()); |
| 950 transformState.move(visualPoint - flowThread->visualPointToFlowThreadPoi nt(visualPoint)); | 950 transformState.move(visualPoint - flowThread->visualPointToFlowThreadPoi nt(visualPoint)); |
| 951 // |containerOffset| is also in visual coordinates. Convert to flow thre ad coordinates. | 951 // TODO(mstensho): Get rid of this special calculation of |containerOffs et|. We cannot use |
| 952 // TODO(mstensho): Wouldn't it be better add a parameter to instruct off setFromContainer() | 952 // offsetFromContainer() at the moment, because it converts from flow th read coordinates to |
| 953 // to return flowthread coordinates in the first place? We're effectivel y performing two | 953 // visual coordinates. That's a reasonable thing to do when walking *upw ards* in the tree, |
| 954 // conversions here, when in fact none is needed. | 954 // when leaving the flow thread coordinate space and the multicol contai ner on our way |
| 955 containerOffset = toLayoutSize(flowThread->visualPointToFlowThreadPoint( toLayoutPoint(containerOffset))); | 955 // up. But when walking downwards (like here), we don't want that. So th is isn't really a |
|
chrishtr
2015/12/14 21:39:51
Why is it generally not desired to adjust when wal
mstensho (USE GERRIT)
2016/01/05 08:55:25
When walking downwards into a multicol container,
| |
| 956 // conversion job best done in offsetFromContainer() (it's there just to avoid massive code | |
| 957 // duplication). It's possible to get rid of it cleanly, but it requires some refactoring | |
| 958 // of mapLocalToContainer() and its neighborhood, which is really the on ly place where we | |
| 959 // want the flowthread-to-visual conversion. | |
| 960 containerOffset = flowThread->topLeftLocationOffset(); | |
| 961 } else { | |
| 962 containerOffset = offsetFromContainer(o, LayoutPoint()); | |
| 956 } | 963 } |
| 957 | 964 |
| 958 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D()); | 965 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D()); |
| 959 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | 966 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
| 960 TransformationMatrix t; | 967 TransformationMatrix t; |
| 961 getTransformFromContainer(o, containerOffset, t); | 968 getTransformFromContainer(o, containerOffset, t); |
| 962 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); | 969 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); |
| 963 } else { | 970 } else { |
| 964 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); | 971 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); |
| 965 } | 972 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 if (rootElementStyle->hasBackground()) | 1078 if (rootElementStyle->hasBackground()) |
| 1072 return false; | 1079 return false; |
| 1073 | 1080 |
| 1074 if (node() != document().firstBodyElement()) | 1081 if (node() != document().firstBodyElement()) |
| 1075 return false; | 1082 return false; |
| 1076 | 1083 |
| 1077 return true; | 1084 return true; |
| 1078 } | 1085 } |
| 1079 | 1086 |
| 1080 } // namespace blink | 1087 } // namespace blink |
| OLD | NEW |