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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 if (!style()->isHorizontalWritingMode()) | 1014 if (!style()->isHorizontalWritingMode()) |
1015 rect = rect.transposedRect(); | 1015 rect = rect.transposedRect(); |
1016 return rect; | 1016 return rect; |
1017 } | 1017 } |
1018 | 1018 |
1019 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const | 1019 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const |
1020 { | 1020 { |
1021 if ((!firstLineBoxIncludingCulling() && !continuation()) || style()->visibil
ity() != VISIBLE) | 1021 if ((!firstLineBoxIncludingCulling() && !continuation()) || style()->visibil
ity() != VISIBLE) |
1022 return LayoutRect(); | 1022 return LayoutRect(); |
1023 | 1023 |
1024 LayoutRect repaintRect(linesVisualOverflowBoundingBox()); | 1024 LayoutRect paintInvalidationRect(linesVisualOverflowBoundingBox()); |
1025 bool hitRepaintContainer = false; | 1025 bool hitPaintInvalidationContainer = false; |
1026 | 1026 |
1027 // We need to add in the in-flow position offsets of any inlines (including
us) up to our | 1027 // We need to add in the in-flow position offsets of any inlines (including
us) up to our |
1028 // containing block. | 1028 // containing block. |
1029 RenderBlock* cb = containingBlock(); | 1029 RenderBlock* cb = containingBlock(); |
1030 for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRend
erInline() && inlineFlow != cb; | 1030 for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRend
erInline() && inlineFlow != cb; |
1031 inlineFlow = inlineFlow->parent()) { | 1031 inlineFlow = inlineFlow->parent()) { |
1032 if (inlineFlow == paintInvalidationContainer) { | 1032 if (inlineFlow == paintInvalidationContainer) { |
1033 hitRepaintContainer = true; | 1033 hitPaintInvalidationContainer = true; |
1034 break; | 1034 break; |
1035 } | 1035 } |
1036 if (inlineFlow->style()->hasInFlowPosition() && inlineFlow->hasLayer()) | 1036 if (inlineFlow->style()->hasInFlowPosition() && inlineFlow->hasLayer()) |
1037 repaintRect.move(toRenderInline(inlineFlow)->layer()->offsetForInFlo
wPosition()); | 1037 paintInvalidationRect.move(toRenderInline(inlineFlow)->layer()->offs
etForInFlowPosition()); |
1038 } | 1038 } |
1039 | 1039 |
1040 LayoutUnit outlineSize = style()->outlineSize(); | 1040 LayoutUnit outlineSize = style()->outlineSize(); |
1041 repaintRect.inflate(outlineSize); | 1041 paintInvalidationRect.inflate(outlineSize); |
1042 | 1042 |
1043 if (hitRepaintContainer || !cb) | 1043 if (hitPaintInvalidationContainer || !cb) |
1044 return repaintRect; | 1044 return paintInvalidationRect; |
1045 | 1045 |
1046 if (cb->hasColumns()) | 1046 if (cb->hasColumns()) |
1047 cb->adjustRectForColumns(repaintRect); | 1047 cb->adjustRectForColumns(paintInvalidationRect); |
1048 | 1048 |
1049 if (cb->hasOverflowClip()) | 1049 if (cb->hasOverflowClip()) |
1050 cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect); | 1050 cb->applyCachedClipAndScrollOffsetForPaintInvalidation(paintInvalidation
Rect); |
1051 | 1051 |
1052 cb->mapRectToPaintInvalidationBacking(paintInvalidationContainer, repaintRec
t, paintInvalidationState); | 1052 cb->mapRectToPaintInvalidationBacking(paintInvalidationContainer, paintInval
idationRect, paintInvalidationState); |
1053 | 1053 |
1054 if (outlineSize) { | 1054 if (outlineSize) { |
1055 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1055 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
1056 if (!curr->isText()) | 1056 if (!curr->isText()) |
1057 repaintRect.unite(curr->rectWithOutlineForPaintInvalidation(pain
tInvalidationContainer, outlineSize)); | 1057 paintInvalidationRect.unite(curr->rectWithOutlineForPaintInvalid
ation(paintInvalidationContainer, outlineSize)); |
1058 } | 1058 } |
1059 | 1059 |
1060 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) | 1060 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) |
1061 repaintRect.unite(continuation()->rectWithOutlineForPaintInvalidatio
n(paintInvalidationContainer, outlineSize)); | 1061 paintInvalidationRect.unite(continuation()->rectWithOutlineForPaintI
nvalidation(paintInvalidationContainer, outlineSize)); |
1062 } | 1062 } |
1063 | 1063 |
1064 return repaintRect; | 1064 return paintInvalidationRect; |
1065 } | 1065 } |
1066 | 1066 |
1067 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const | 1067 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const |
1068 { | 1068 { |
1069 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); | 1069 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); |
1070 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 1070 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
1071 if (!curr->isText()) | 1071 if (!curr->isText()) |
1072 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); | 1072 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); |
1073 } | 1073 } |
1074 return r; | 1074 return r; |
(...skipping 16 matching lines...) Expand all Loading... |
1091 bool containerSkipped; | 1091 bool containerSkipped; |
1092 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1092 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); |
1093 if (!o) | 1093 if (!o) |
1094 return; | 1094 return; |
1095 | 1095 |
1096 LayoutPoint topLeft = rect.location(); | 1096 LayoutPoint topLeft = rect.location(); |
1097 | 1097 |
1098 if (o->isRenderBlockFlow() && !style()->hasOutOfFlowPosition()) { | 1098 if (o->isRenderBlockFlow() && !style()->hasOutOfFlowPosition()) { |
1099 RenderBlock* cb = toRenderBlock(o); | 1099 RenderBlock* cb = toRenderBlock(o); |
1100 if (cb->hasColumns()) { | 1100 if (cb->hasColumns()) { |
1101 LayoutRect repaintRect(topLeft, rect.size()); | 1101 LayoutRect paintInvalidationRect(topLeft, rect.size()); |
1102 cb->adjustRectForColumns(repaintRect); | 1102 cb->adjustRectForColumns(paintInvalidationRect); |
1103 topLeft = repaintRect.location(); | 1103 topLeft = paintInvalidationRect.location(); |
1104 rect = repaintRect; | 1104 rect = paintInvalidationRect; |
1105 } | 1105 } |
1106 } | 1106 } |
1107 | 1107 |
1108 if (style()->hasInFlowPosition() && layer()) { | 1108 if (style()->hasInFlowPosition() && layer()) { |
1109 // Apply the in-flow position offset when invalidating a rectangle. The
layer | 1109 // Apply the in-flow position offset when invalidating a rectangle. The
layer |
1110 // is translated, but the render box isn't, so we need to do this to get
the | 1110 // is translated, but the render box isn't, so we need to do this to get
the |
1111 // right dirty rect. Since this is called from RenderObject::setStyle, t
he relative position | 1111 // right dirty rect. Since this is called from RenderObject::setStyle, t
he relative position |
1112 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 1112 // flag on the RenderObject has been cleared, so use the one on the styl
e(). |
1113 topLeft += layer()->offsetForInFlowPosition(); | 1113 topLeft += layer()->offsetForInFlowPosition(); |
1114 } | 1114 } |
1115 | 1115 |
1116 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 1116 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
1117 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 1117 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
1118 rect.setLocation(topLeft); | 1118 rect.setLocation(topLeft); |
1119 if (o->hasOverflowClip()) { | 1119 if (o->hasOverflowClip()) { |
1120 RenderBox* containerBox = toRenderBox(o); | 1120 RenderBox* containerBox = toRenderBox(o); |
1121 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect); | 1121 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rect); |
1122 if (rect.isEmpty()) | 1122 if (rect.isEmpty()) |
1123 return; | 1123 return; |
1124 } | 1124 } |
1125 | 1125 |
1126 if (containerSkipped) { | 1126 if (containerSkipped) { |
1127 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 1127 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
1128 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 1128 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); |
1129 rect.move(-containerOffset); | 1129 rect.move(-containerOffset); |
1130 return; | 1130 return; |
1131 } | 1131 } |
(...skipping 16 matching lines...) Expand all Loading... |
1148 | 1148 |
1149 if (offsetDependsOnPoint) { | 1149 if (offsetDependsOnPoint) { |
1150 *offsetDependsOnPoint = container->hasColumns() | 1150 *offsetDependsOnPoint = container->hasColumns() |
1151 || (container->isBox() && container->style()->isFlippedBlocksWriting
Mode()) | 1151 || (container->isBox() && container->style()->isFlippedBlocksWriting
Mode()) |
1152 || container->isRenderFlowThread(); | 1152 || container->isRenderFlowThread(); |
1153 } | 1153 } |
1154 | 1154 |
1155 return offset; | 1155 return offset; |
1156 } | 1156 } |
1157 | 1157 |
1158 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* repaintCont
ainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed,
const PaintInvalidationState* paintInvalidationState) const | 1158 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvali
dationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool*
wasFixed, const PaintInvalidationState* paintInvalidationState) const |
1159 { | 1159 { |
1160 if (repaintContainer == this) | 1160 if (paintInvalidationContainer == this) |
1161 return; | 1161 return; |
1162 | 1162 |
1163 if (paintInvalidationState && paintInvalidationState->canMapToContainer(repa
intContainer)) { | 1163 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
1164 LayoutSize offset = paintInvalidationState->paintOffset(); | 1164 LayoutSize offset = paintInvalidationState->paintOffset(); |
1165 if (style()->hasInFlowPosition() && layer()) | 1165 if (style()->hasInFlowPosition() && layer()) |
1166 offset += layer()->offsetForInFlowPosition(); | 1166 offset += layer()->offsetForInFlowPosition(); |
1167 transformState.move(offset); | 1167 transformState.move(offset); |
1168 return; | 1168 return; |
1169 } | 1169 } |
1170 | 1170 |
1171 bool containerSkipped; | 1171 bool containerSkipped; |
1172 RenderObject* o = container(repaintContainer, &containerSkipped); | 1172 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); |
1173 if (!o) | 1173 if (!o) |
1174 return; | 1174 return; |
1175 | 1175 |
1176 if (mode & ApplyContainerFlip && o->isBox()) { | 1176 if (mode & ApplyContainerFlip && o->isBox()) { |
1177 if (o->style()->isFlippedBlocksWritingMode()) { | 1177 if (o->style()->isFlippedBlocksWritingMode()) { |
1178 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; | 1178 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; |
1179 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum
ns(centerPoint) - centerPoint); | 1179 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum
ns(centerPoint) - centerPoint); |
1180 } | 1180 } |
1181 mode &= ~ApplyContainerFlip; | 1181 mode &= ~ApplyContainerFlip; |
1182 } | 1182 } |
1183 | 1183 |
1184 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); | 1184 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); |
1185 | 1185 |
1186 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); | 1186 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); |
1187 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | 1187 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
1188 TransformationMatrix t; | 1188 TransformationMatrix t; |
1189 getTransformFromContainer(o, containerOffset, t); | 1189 getTransformFromContainer(o, containerOffset, t); |
1190 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | 1190 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); |
1191 } else | 1191 } else |
1192 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | 1192 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); |
1193 | 1193 |
1194 if (containerSkipped) { | 1194 if (containerSkipped) { |
1195 // There can't be a transform between repaintContainer and o, because tr
ansforms create containers, so it should be safe | 1195 // There can't be a transform between paintInvalidationContainer and o,
because transforms create containers, so it should be safe |
1196 // to just subtract the delta between the repaintContainer and o. | 1196 // to just subtract the delta between the paintInvalidationContainer and
o. |
1197 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(o); | 1197 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); |
1198 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); | 1198 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); |
1199 return; | 1199 return; |
1200 } | 1200 } |
1201 | 1201 |
1202 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed, pai
ntInvalidationState); | 1202 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed, paintInvalidationState); |
1203 } | 1203 } |
1204 | 1204 |
1205 void RenderInline::updateDragState(bool dragOn) | 1205 void RenderInline::updateDragState(bool dragOn) |
1206 { | 1206 { |
1207 RenderBoxModelObject::updateDragState(dragOn); | 1207 RenderBoxModelObject::updateDragState(dragOn); |
1208 if (continuation()) | 1208 if (continuation()) |
1209 continuation()->updateDragState(dragOn); | 1209 continuation()->updateDragState(dragOn); |
1210 } | 1210 } |
1211 | 1211 |
1212 void RenderInline::childBecameNonInline(RenderObject* child) | 1212 void RenderInline::childBecameNonInline(RenderObject* child) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 } | 1363 } |
1364 | 1364 |
1365 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
additionalOffset, const RenderLayerModelObject* paintContainer) const | 1365 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
additionalOffset, const RenderLayerModelObject* paintContainer) const |
1366 { | 1366 { |
1367 AbsoluteRectsGeneratorContext context(rects, additionalOffset); | 1367 AbsoluteRectsGeneratorContext context(rects, additionalOffset); |
1368 generateLineBoxRects(context); | 1368 generateLineBoxRects(context); |
1369 | 1369 |
1370 addChildFocusRingRects(rects, additionalOffset, paintContainer); | 1370 addChildFocusRingRects(rects, additionalOffset, paintContainer); |
1371 | 1371 |
1372 if (continuation()) { | 1372 if (continuation()) { |
1373 // If the continuation doesn't paint into the same container, let its re
paint container handle it. | 1373 // If the continuation doesn't paint into the same container, let its pa
int invalidation container handle it. |
1374 if (paintContainer != continuation()->containerForPaintInvalidation()) | 1374 if (paintContainer != continuation()->containerForPaintInvalidation()) |
1375 return; | 1375 return; |
1376 if (continuation()->isInline()) | 1376 if (continuation()->isInline()) |
1377 continuation()->addFocusRingRects(rects, flooredLayoutPoint(addition
alOffset + continuation()->containingBlock()->location() - containingBlock()->lo
cation()), paintContainer); | 1377 continuation()->addFocusRingRects(rects, flooredLayoutPoint(addition
alOffset + continuation()->containingBlock()->location() - containingBlock()->lo
cation()), paintContainer); |
1378 else | 1378 else |
1379 continuation()->addFocusRingRects(rects, flooredLayoutPoint(addition
alOffset + toRenderBox(continuation())->location() - containingBlock()->location
()), paintContainer); | 1379 continuation()->addFocusRingRects(rects, flooredLayoutPoint(addition
alOffset + toRenderBox(continuation())->location() - containingBlock()->location
()), paintContainer); |
1380 } | 1380 } |
1381 } | 1381 } |
1382 | 1382 |
1383 namespace { | 1383 namespace { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 container = this; | 1579 container = this; |
1580 | 1580 |
1581 FloatPoint absPos = container->localToAbsolute(); | 1581 FloatPoint absPos = container->localToAbsolute(); |
1582 region.bounds.setX(absPos.x() + region.bounds.x()); | 1582 region.bounds.setX(absPos.x() + region.bounds.x()); |
1583 region.bounds.setY(absPos.y() + region.bounds.y()); | 1583 region.bounds.setY(absPos.y() + region.bounds.y()); |
1584 | 1584 |
1585 regions.append(region); | 1585 regions.append(region); |
1586 } | 1586 } |
1587 | 1587 |
1588 } // namespace blink | 1588 } // namespace blink |
OLD | NEW |