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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); | 982 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); |
983 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 983 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
984 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; | 984 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; |
985 | 985 |
986 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 986 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
987 if (!style()->isHorizontalWritingMode()) | 987 if (!style()->isHorizontalWritingMode()) |
988 rect = rect.transposedRect(); | 988 rect = rect.transposedRect(); |
989 return rect; | 989 return rect; |
990 } | 990 } |
991 | 991 |
992 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const | 992 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay
erModelObject* paintInvalidationContainer) const |
993 { | 993 { |
| 994 ASSERT(!view() || !view()->layoutStateCachedOffsetsEnabled()); |
| 995 |
994 if (!firstLineBoxIncludingCulling() && !continuation()) | 996 if (!firstLineBoxIncludingCulling() && !continuation()) |
995 return LayoutRect(); | 997 return LayoutRect(); |
996 | 998 |
997 LayoutRect repaintRect(linesVisualOverflowBoundingBox()); | 999 LayoutRect repaintRect(linesVisualOverflowBoundingBox()); |
998 bool hitRepaintContainer = false; | 1000 bool hitRepaintContainer = false; |
999 | 1001 |
1000 // We need to add in the in-flow position offsets of any inlines (including
us) up to our | 1002 // We need to add in the in-flow position offsets of any inlines (including
us) up to our |
1001 // containing block. | 1003 // containing block. |
1002 RenderBlock* cb = containingBlock(); | 1004 RenderBlock* cb = containingBlock(); |
1003 for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRend
erInline() && inlineFlow != cb; | 1005 for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRend
erInline() && inlineFlow != cb; |
(...skipping 11 matching lines...) Expand all Loading... |
1015 | 1017 |
1016 if (hitRepaintContainer || !cb) | 1018 if (hitRepaintContainer || !cb) |
1017 return repaintRect; | 1019 return repaintRect; |
1018 | 1020 |
1019 if (cb->hasColumns()) | 1021 if (cb->hasColumns()) |
1020 cb->adjustRectForColumns(repaintRect); | 1022 cb->adjustRectForColumns(repaintRect); |
1021 | 1023 |
1022 if (cb->hasOverflowClip()) | 1024 if (cb->hasOverflowClip()) |
1023 cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect); | 1025 cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect); |
1024 | 1026 |
1025 cb->mapRectToPaintInvalidationBacking(paintInvalidationContainer, repaintRec
t, paintInvalidationState); | 1027 cb->mapRectToPaintInvalidationBacking(paintInvalidationContainer, repaintRec
t); |
1026 | 1028 |
1027 if (outlineSize) { | 1029 if (outlineSize) { |
1028 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1030 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
1029 if (!curr->isText()) | 1031 if (!curr->isText()) |
1030 repaintRect.unite(curr->rectWithOutlineForPaintInvalidation(pain
tInvalidationContainer, outlineSize)); | 1032 repaintRect.unite(curr->rectWithOutlineForPaintInvalidation(pain
tInvalidationContainer, outlineSize)); |
1031 } | 1033 } |
1032 | 1034 |
1033 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) | 1035 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) |
1034 repaintRect.unite(continuation()->rectWithOutlineForPaintInvalidatio
n(paintInvalidationContainer, outlineSize)); | 1036 repaintRect.unite(continuation()->rectWithOutlineForPaintInvalidatio
n(paintInvalidationContainer, outlineSize)); |
1035 } | 1037 } |
1036 | 1038 |
1037 return repaintRect; | 1039 return repaintRect; |
1038 } | 1040 } |
1039 | 1041 |
1040 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const | 1042 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth) const |
1041 { | 1043 { |
1042 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); | 1044 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth)); |
1043 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 1045 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
1044 if (!curr->isText()) | 1046 if (!curr->isText()) |
1045 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); | 1047 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth)); |
1046 } | 1048 } |
1047 return r; | 1049 return r; |
1048 } | 1050 } |
1049 | 1051 |
1050 void RenderInline::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalida
tionState* paintInvalidationState) const | 1052 void RenderInline::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, bool fixed) const |
1051 { | 1053 { |
1052 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1054 if (RenderView* v = view()) { |
1053 if (style()->hasInFlowPosition() && layer()) | 1055 // LayoutState is only valid for root-relative repainting |
1054 rect.move(layer()->offsetForInFlowPosition()); | 1056 if (v->canMapUsingLayoutStateForContainer(paintInvalidationContainer)) { |
1055 rect.move(paintInvalidationState->paintOffset()); | 1057 LayoutState* layoutState = v->layoutState(); |
1056 if (paintInvalidationState->isClipped()) | 1058 if (style()->hasInFlowPosition() && layer()) |
1057 rect.intersect(paintInvalidationState->clipRect()); | 1059 rect.move(layer()->offsetForInFlowPosition()); |
1058 return; | 1060 rect.move(layoutState->paintOffset()); |
| 1061 if (layoutState->isClipped()) |
| 1062 rect.intersect(layoutState->clipRect()); |
| 1063 return; |
| 1064 } |
1059 } | 1065 } |
1060 | 1066 |
1061 if (paintInvalidationContainer == this) | 1067 if (paintInvalidationContainer == this) |
1062 return; | 1068 return; |
1063 | 1069 |
1064 bool containerSkipped; | 1070 bool containerSkipped; |
1065 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1071 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); |
1066 if (!o) | 1072 if (!o) |
1067 return; | 1073 return; |
1068 | 1074 |
(...skipping 27 matching lines...) Expand all Loading... |
1096 return; | 1102 return; |
1097 } | 1103 } |
1098 | 1104 |
1099 if (containerSkipped) { | 1105 if (containerSkipped) { |
1100 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 1106 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
1101 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 1107 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); |
1102 rect.move(-containerOffset); | 1108 rect.move(-containerOffset); |
1103 return; | 1109 return; |
1104 } | 1110 } |
1105 | 1111 |
1106 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed
, paintInvalidationState); | 1112 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed
); |
1107 } | 1113 } |
1108 | 1114 |
1109 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons
t LayoutPoint& point, bool* offsetDependsOnPoint) const | 1115 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons
t LayoutPoint& point, bool* offsetDependsOnPoint) const |
1110 { | 1116 { |
1111 ASSERT(container == this->container()); | 1117 ASSERT(container == this->container()); |
1112 | 1118 |
1113 LayoutSize offset; | 1119 LayoutSize offset; |
1114 if (isRelPositioned()) | 1120 if (isRelPositioned()) |
1115 offset += offsetForInFlowPosition(); | 1121 offset += offsetForInFlowPosition(); |
1116 | 1122 |
1117 offset += container->columnOffset(point); | 1123 offset += container->columnOffset(point); |
1118 | 1124 |
1119 if (container->hasOverflowClip()) | 1125 if (container->hasOverflowClip()) |
1120 offset -= toRenderBox(container)->scrolledContentOffset(); | 1126 offset -= toRenderBox(container)->scrolledContentOffset(); |
1121 | 1127 |
1122 if (offsetDependsOnPoint) { | 1128 if (offsetDependsOnPoint) { |
1123 *offsetDependsOnPoint = container->hasColumns() | 1129 *offsetDependsOnPoint = container->hasColumns() |
1124 || (container->isBox() && container->style()->isFlippedBlocksWriting
Mode()) | 1130 || (container->isBox() && container->style()->isFlippedBlocksWriting
Mode()) |
1125 || container->isRenderFlowThread(); | 1131 || container->isRenderFlowThread(); |
1126 } | 1132 } |
1127 | 1133 |
1128 return offset; | 1134 return offset; |
1129 } | 1135 } |
1130 | 1136 |
1131 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* repaintCont
ainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed,
const PaintInvalidationState* paintInvalidationState) const | 1137 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* repaintCont
ainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed)
const |
1132 { | 1138 { |
1133 if (repaintContainer == this) | 1139 if (repaintContainer == this) |
1134 return; | 1140 return; |
1135 | 1141 |
1136 if (paintInvalidationState && paintInvalidationState->canMapToContainer(repa
intContainer)) { | 1142 if (RenderView *v = view()) { |
1137 LayoutSize offset = paintInvalidationState->paintOffset(); | 1143 if (v->canMapUsingLayoutStateForContainer(repaintContainer)) { |
1138 if (style()->hasInFlowPosition() && layer()) | 1144 LayoutState* layoutState = v->layoutState(); |
1139 offset += layer()->offsetForInFlowPosition(); | 1145 LayoutSize offset = layoutState->paintOffset(); |
1140 transformState.move(offset); | 1146 if (style()->hasInFlowPosition() && layer()) |
1141 return; | 1147 offset += layer()->offsetForInFlowPosition(); |
| 1148 transformState.move(offset); |
| 1149 return; |
| 1150 } |
1142 } | 1151 } |
1143 | 1152 |
1144 bool containerSkipped; | 1153 bool containerSkipped; |
1145 RenderObject* o = container(repaintContainer, &containerSkipped); | 1154 RenderObject* o = container(repaintContainer, &containerSkipped); |
1146 if (!o) | 1155 if (!o) |
1147 return; | 1156 return; |
1148 | 1157 |
1149 if (mode & ApplyContainerFlip && o->isBox()) { | 1158 if (mode & ApplyContainerFlip && o->isBox()) { |
1150 if (o->style()->isFlippedBlocksWritingMode()) { | 1159 if (o->style()->isFlippedBlocksWritingMode()) { |
1151 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; | 1160 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; |
(...skipping 13 matching lines...) Expand all Loading... |
1165 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | 1174 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); |
1166 | 1175 |
1167 if (containerSkipped) { | 1176 if (containerSkipped) { |
1168 // There can't be a transform between repaintContainer and o, because tr
ansforms create containers, so it should be safe | 1177 // There can't be a transform between repaintContainer and o, because tr
ansforms create containers, so it should be safe |
1169 // to just subtract the delta between the repaintContainer and o. | 1178 // to just subtract the delta between the repaintContainer and o. |
1170 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(o); | 1179 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(o); |
1171 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); | 1180 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); |
1172 return; | 1181 return; |
1173 } | 1182 } |
1174 | 1183 |
1175 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed, pai
ntInvalidationState); | 1184 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); |
1176 } | 1185 } |
1177 | 1186 |
1178 void RenderInline::updateDragState(bool dragOn) | 1187 void RenderInline::updateDragState(bool dragOn) |
1179 { | 1188 { |
1180 RenderBoxModelObject::updateDragState(dragOn); | 1189 RenderBoxModelObject::updateDragState(dragOn); |
1181 if (continuation()) | 1190 if (continuation()) |
1182 continuation()->updateDragState(dragOn); | 1191 continuation()->updateDragState(dragOn); |
1183 } | 1192 } |
1184 | 1193 |
1185 void RenderInline::childBecameNonInline(RenderObject* child) | 1194 void RenderInline::childBecameNonInline(RenderObject* child) |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 if (!container) | 1562 if (!container) |
1554 container = this; | 1563 container = this; |
1555 | 1564 |
1556 FloatPoint absPos = container->localToAbsolute(); | 1565 FloatPoint absPos = container->localToAbsolute(); |
1557 region.bounds.setX(absPos.x() + region.bounds.x()); | 1566 region.bounds.setX(absPos.x() + region.bounds.x()); |
1558 region.bounds.setY(absPos.y() + region.bounds.y()); | 1567 region.bounds.setY(absPos.y() + region.bounds.y()); |
1559 | 1568 |
1560 regions.append(region); | 1569 regions.append(region); |
1561 } | 1570 } |
1562 | 1571 |
1563 void RenderInline::invalidateTreeAfterLayout(const PaintInvalidationState& paint
InvalidationState) | 1572 void RenderInline::invalidateTreeAfterLayout(const RenderLayerModelObject& paint
InvalidationContainer) |
1564 { | 1573 { |
1565 bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer
(); | 1574 LayoutState state(*this); |
1566 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustComposi
tedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this
: &paintInvalidationState.paintInvalidationContainer()); | 1575 RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer); |
1567 PaintInvalidationState childPaintInvalidationState(paintInvalidationState, *
this, newPaintInvalidationContainer); | |
1568 RenderObject::invalidateTreeAfterLayout(paintInvalidationState); | |
1569 } | 1576 } |
1570 | 1577 |
1571 } // namespace WebCore | 1578 } // namespace WebCore |
OLD | NEW |