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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 break; | 842 break; |
843 } | 843 } |
844 x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth(), 0)); | 844 x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth(), 0)); |
845 | 845 |
846 LayoutUnit height = style()->fontMetrics().height(); | 846 LayoutUnit height = style()->fontMetrics().height(); |
847 LayoutUnit verticalSpace = lineHeight(true, currentStyle.isHorizontalWriting
Mode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height; | 847 LayoutUnit verticalSpace = lineHeight(true, currentStyle.isHorizontalWriting
Mode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height; |
848 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); | 848 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); |
849 return currentStyle.isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth(
), height) : LayoutRect(y, x, height, caretWidth()); | 849 return currentStyle.isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth(
), height) : LayoutRect(y, x, height, caretWidth()); |
850 } | 850 } |
851 | 851 |
| 852 LayoutSize LayoutBoxModelObject::offsetFromContainer(const LayoutObject* o) cons
t |
| 853 { |
| 854 LayoutSize offset; |
| 855 if (isRelPositioned()) |
| 856 offset += offsetForInFlowPosition(); |
| 857 return offset + LayoutObject::offsetFromContainer(o); |
| 858 } |
| 859 |
852 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra
nsformState& transformState) const | 860 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra
nsformState& transformState) const |
853 { | 861 { |
854 LayoutObject* o = container(); | 862 LayoutObject* o = container(); |
855 if (!o) | 863 if (!o) |
856 return; | 864 return; |
857 | 865 |
858 o->mapAbsoluteToLocalPoint(mode, transformState); | 866 o->mapAbsoluteToLocalPoint(mode, transformState); |
859 | 867 |
860 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); | 868 LayoutSize containerOffset = offsetFromContainer(o); |
861 | |
862 if (o->isLayoutFlowThread()) { | |
863 // Descending into a flow thread. Convert to the local coordinate space,
i.e. flow thread coordinates. | |
864 const LayoutFlowThread* flowThread = toLayoutFlowThread(o); | |
865 LayoutPoint visualPoint = LayoutPoint(transformState.mappedPoint()); | |
866 transformState.move(visualPoint - flowThread->visualPointToFlowThreadPoi
nt(visualPoint)); | |
867 // |containerOffset| is also in visual coordinates. Convert to flow thre
ad coordinates. | |
868 // TODO(mstensho): Wouldn't it be better add a parameter to instruct off
setFromContainer() | |
869 // to return flowthread coordinates in the first place? We're effectivel
y performing two | |
870 // conversions here, when in fact none is needed. | |
871 containerOffset = toLayoutSize(flowThread->visualPointToFlowThreadPoint(
toLayoutPoint(containerOffset))); | |
872 } | |
873 | |
874 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); | 869 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); |
875 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | 870 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
876 TransformationMatrix t; | 871 TransformationMatrix t; |
877 getTransformFromContainer(o, containerOffset, t); | 872 getTransformFromContainer(o, containerOffset, t); |
878 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | 873 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); |
879 } else { | 874 } else { |
880 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | 875 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); |
881 } | 876 } |
882 } | 877 } |
883 | 878 |
(...skipping 10 matching lines...) Expand all Loading... |
894 bool isFixedPos = !isInline && style()->position() == FixedPosition; | 889 bool isFixedPos = !isInline && style()->position() == FixedPosition; |
895 bool hasTransform = !isInline && hasLayer() && layer()->transform(); | 890 bool hasTransform = !isInline && hasLayer() && layer()->transform(); |
896 | 891 |
897 LayoutSize adjustmentForSkippedAncestor; | 892 LayoutSize adjustmentForSkippedAncestor; |
898 if (ancestorSkipped) { | 893 if (ancestorSkipped) { |
899 // There can't be a transform between paintInvalidationContainer and anc
estorToStopAt, because transforms create containers, so it should be safe | 894 // There can't be a transform between paintInvalidationContainer and anc
estorToStopAt, because transforms create containers, so it should be safe |
900 // to just subtract the delta between the ancestor and ancestorToStopAt. | 895 // to just subtract the delta between the ancestor and ancestorToStopAt. |
901 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont
ainer(container); | 896 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont
ainer(container); |
902 } | 897 } |
903 | 898 |
904 bool offsetDependsOnPoint = false; | 899 bool offsetDependsOnPoint = container->isBox() && (container->style()->isFli
ppedBlocksWritingMode() || container->isLayoutFlowThread()); |
905 LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), &
offsetDependsOnPoint); | 900 LayoutSize containerOffset = offsetFromContainer(container); |
| 901 containerOffset += container->columnOffset(toLayoutPoint(containerOffset)); |
906 | 902 |
907 bool preserve3D = container->style()->preserves3D() || style()->preserves3D(
); | 903 bool preserve3D = container->style()->preserves3D() || style()->preserves3D(
); |
908 if (shouldUseTransformFromContainer(container)) { | 904 if (shouldUseTransformFromContainer(container)) { |
909 TransformationMatrix t; | 905 TransformationMatrix t; |
910 getTransformFromContainer(container, containerOffset, t); | 906 getTransformFromContainer(container, containerOffset, t); |
911 t.translateRight(adjustmentForSkippedAncestor.width().toFloat(), adjustm
entForSkippedAncestor.height().toFloat()); | 907 t.translateRight(adjustmentForSkippedAncestor.width().toFloat(), adjustm
entForSkippedAncestor.height().toFloat()); |
912 geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, isFixedPos,
hasTransform); | 908 geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, isFixedPos,
hasTransform); |
913 } else { | 909 } else { |
914 containerOffset += adjustmentForSkippedAncestor; | 910 containerOffset += adjustmentForSkippedAncestor; |
915 geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint
, isFixedPos, hasTransform); | 911 geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint
, isFixedPos, hasTransform); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 if (rootElementStyle->hasBackground()) | 969 if (rootElementStyle->hasBackground()) |
974 return false; | 970 return false; |
975 | 971 |
976 if (node() != document().firstBodyElement()) | 972 if (node() != document().firstBodyElement()) |
977 return false; | 973 return false; |
978 | 974 |
979 return true; | 975 return true; |
980 } | 976 } |
981 | 977 |
982 } // namespace blink | 978 } // namespace blink |
OLD | NEW |