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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/rendering/RenderInline.h" | 24 #include "core/rendering/RenderInline.h" |
25 | 25 |
26 #include "core/dom/Fullscreen.h" | 26 #include "core/dom/Fullscreen.h" |
27 #include "core/dom/StyleEngine.h" | 27 #include "core/dom/StyleEngine.h" |
28 #include "core/layout/HitTestResult.h" | 28 #include "core/layout/HitTestResult.h" |
| 29 #include "core/layout/Layer.h" |
29 #include "core/layout/LayoutTheme.h" | 30 #include "core/layout/LayoutTheme.h" |
30 #include "core/page/Chrome.h" | 31 #include "core/page/Chrome.h" |
31 #include "core/page/Page.h" | 32 #include "core/page/Page.h" |
32 #include "core/paint/BoxPainter.h" | 33 #include "core/paint/BoxPainter.h" |
33 #include "core/paint/InlinePainter.h" | 34 #include "core/paint/InlinePainter.h" |
34 #include "core/paint/ObjectPainter.h" | 35 #include "core/paint/ObjectPainter.h" |
35 #include "core/rendering/InlineTextBox.h" | 36 #include "core/rendering/InlineTextBox.h" |
36 #include "core/rendering/RenderBlock.h" | 37 #include "core/rendering/RenderBlock.h" |
37 #include "core/rendering/RenderFlowThread.h" | 38 #include "core/rendering/RenderFlowThread.h" |
38 #include "core/rendering/RenderFullScreen.h" | 39 #include "core/rendering/RenderFullScreen.h" |
39 #include "core/rendering/RenderGeometryMap.h" | 40 #include "core/rendering/RenderGeometryMap.h" |
40 #include "core/rendering/RenderLayer.h" | |
41 #include "core/rendering/RenderView.h" | 41 #include "core/rendering/RenderView.h" |
42 #include "core/rendering/style/StyleInheritedData.h" | 42 #include "core/rendering/style/StyleInheritedData.h" |
43 #include "platform/geometry/FloatQuad.h" | 43 #include "platform/geometry/FloatQuad.h" |
44 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
45 #include "platform/graphics/paint/DisplayItemList.h" | 45 #include "platform/graphics/paint/DisplayItemList.h" |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 struct SameSizeAsRenderInline : public RenderBoxModelObject { | 49 struct SameSizeAsRenderInline : public RenderBoxModelObject { |
50 virtual ~SameSizeAsRenderInline() { } | 50 virtual ~SameSizeAsRenderInline() { } |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 for (RenderObject* curr = currBlock->firstChild(); curr; curr = curr->ne
xtSibling()) { | 1042 for (RenderObject* curr = currBlock->firstChild(); curr; curr = curr->ne
xtSibling()) { |
1043 LayoutRect rect = curr->clippedOverflowRectForPaintInvalidation(view
()); | 1043 LayoutRect rect = curr->clippedOverflowRectForPaintInvalidation(view
()); |
1044 context(rect); | 1044 context(rect); |
1045 if (curr == endContinuation) | 1045 if (curr == endContinuation) |
1046 return enclosingIntRect(floatResult); | 1046 return enclosingIntRect(floatResult); |
1047 } | 1047 } |
1048 } | 1048 } |
1049 return LayoutRect(); | 1049 return LayoutRect(); |
1050 } | 1050 } |
1051 | 1051 |
1052 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const RenderLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const | 1052 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const LayoutLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const |
1053 { | 1053 { |
1054 // If we don't create line boxes, we don't have any invalidations to do. | 1054 // If we don't create line boxes, we don't have any invalidations to do. |
1055 if (!alwaysCreateLineBoxes()) | 1055 if (!alwaysCreateLineBoxes()) |
1056 return LayoutRect(); | 1056 return LayoutRect(); |
1057 return clippedOverflowRect(paintInvalidationContainer); | 1057 return clippedOverflowRect(paintInvalidationContainer); |
1058 } | 1058 } |
1059 | 1059 |
1060 LayoutRect RenderInline::clippedOverflowRect(const RenderLayerModelObject* paint
InvalidationContainer, const PaintInvalidationState* paintInvalidationState) con
st | 1060 LayoutRect RenderInline::clippedOverflowRect(const LayoutLayerModelObject* paint
InvalidationContainer, const PaintInvalidationState* paintInvalidationState) con
st |
1061 { | 1061 { |
1062 if ((!firstLineBoxIncludingCulling() && !continuation()) || style()->visibil
ity() != VISIBLE) | 1062 if ((!firstLineBoxIncludingCulling() && !continuation()) || style()->visibil
ity() != VISIBLE) |
1063 return LayoutRect(); | 1063 return LayoutRect(); |
1064 | 1064 |
1065 LayoutRect overflowRect(linesVisualOverflowBoundingBox()); | 1065 LayoutRect overflowRect(linesVisualOverflowBoundingBox()); |
1066 | 1066 |
1067 LayoutUnit outlineSize = style()->outlineSize(); | 1067 LayoutUnit outlineSize = style()->outlineSize(); |
1068 overflowRect.inflate(outlineSize); | 1068 overflowRect.inflate(outlineSize); |
1069 | 1069 |
1070 mapRectToPaintInvalidationBacking(paintInvalidationContainer, overflowRect,
paintInvalidationState); | 1070 mapRectToPaintInvalidationBacking(paintInvalidationContainer, overflowRect,
paintInvalidationState); |
1071 | 1071 |
1072 if (outlineSize) { | 1072 if (outlineSize) { |
1073 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1073 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
1074 if (!curr->isText()) | 1074 if (!curr->isText()) |
1075 overflowRect.unite(curr->rectWithOutlineForPaintInvalidation(pai
ntInvalidationContainer, outlineSize)); | 1075 overflowRect.unite(curr->rectWithOutlineForPaintInvalidation(pai
ntInvalidationContainer, outlineSize)); |
1076 } | 1076 } |
1077 | 1077 |
1078 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) | 1078 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) |
1079 overflowRect.unite(continuation()->rectWithOutlineForPaintInvalidati
on(paintInvalidationContainer, outlineSize)); | 1079 overflowRect.unite(continuation()->rectWithOutlineForPaintInvalidati
on(paintInvalidationContainer, outlineSize)); |
1080 } | 1080 } |
1081 | 1081 |
1082 return overflowRect; | 1082 return overflowRect; |
1083 } | 1083 } |
1084 | 1084 |
1085 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const | 1085 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const LayoutLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const |
1086 { | 1086 { |
1087 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); | 1087 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); |
1088 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 1088 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
1089 if (!curr->isText()) | 1089 if (!curr->isText()) |
1090 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); | 1090 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); |
1091 } | 1091 } |
1092 return r; | 1092 return r; |
1093 } | 1093 } |
1094 | 1094 |
1095 void RenderInline::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p
aintInvalidationState) const | 1095 void RenderInline::mapRectToPaintInvalidationBacking(const LayoutLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p
aintInvalidationState) const |
1096 { | 1096 { |
1097 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1097 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
1098 if (style()->hasInFlowPosition() && layer()) | 1098 if (style()->hasInFlowPosition() && layer()) |
1099 rect.move(layer()->offsetForInFlowPosition()); | 1099 rect.move(layer()->offsetForInFlowPosition()); |
1100 rect.move(paintInvalidationState->paintOffset()); | 1100 rect.move(paintInvalidationState->paintOffset()); |
1101 if (paintInvalidationState->isClipped()) | 1101 if (paintInvalidationState->isClipped()) |
1102 rect.intersect(paintInvalidationState->clipRect()); | 1102 rect.intersect(paintInvalidationState->clipRect()); |
1103 return; | 1103 return; |
1104 } | 1104 } |
1105 | 1105 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 | 1166 |
1167 if (offsetDependsOnPoint) { | 1167 if (offsetDependsOnPoint) { |
1168 *offsetDependsOnPoint = container->hasColumns() | 1168 *offsetDependsOnPoint = container->hasColumns() |
1169 || (container->isBox() && container->style()->isFlippedBlocksWriting
Mode()) | 1169 || (container->isBox() && container->style()->isFlippedBlocksWriting
Mode()) |
1170 || container->isRenderFlowThread(); | 1170 || container->isRenderFlowThread(); |
1171 } | 1171 } |
1172 | 1172 |
1173 return offset; | 1173 return offset; |
1174 } | 1174 } |
1175 | 1175 |
1176 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvali
dationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool*
wasFixed, const PaintInvalidationState* paintInvalidationState) const | 1176 void RenderInline::mapLocalToContainer(const LayoutLayerModelObject* paintInvali
dationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool*
wasFixed, const PaintInvalidationState* paintInvalidationState) const |
1177 { | 1177 { |
1178 if (paintInvalidationContainer == this) | 1178 if (paintInvalidationContainer == this) |
1179 return; | 1179 return; |
1180 | 1180 |
1181 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1181 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
1182 LayoutSize offset = paintInvalidationState->paintOffset(); | 1182 LayoutSize offset = paintInvalidationState->paintOffset(); |
1183 if (style()->hasInFlowPosition() && layer()) | 1183 if (style()->hasInFlowPosition() && layer()) |
1184 offset += layer()->offsetForInFlowPosition(); | 1184 offset += layer()->offsetForInFlowPosition(); |
1185 transformState.move(offset); | 1185 transformState.move(offset); |
1186 return; | 1186 return; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 } | 1452 } |
1453 | 1453 |
1454 void RenderInline::invalidateDisplayItemClients(DisplayItemList* displayItemList
) const | 1454 void RenderInline::invalidateDisplayItemClients(DisplayItemList* displayItemList
) const |
1455 { | 1455 { |
1456 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); | 1456 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); |
1457 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1457 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
1458 displayItemList->invalidate(box->displayItemClient()); | 1458 displayItemList->invalidate(box->displayItemClient()); |
1459 } | 1459 } |
1460 | 1460 |
1461 } // namespace blink | 1461 } // namespace blink |
OLD | NEW |