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 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; | 1014 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; |
1015 | 1015 |
1016 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 1016 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
1017 if (!style()->isHorizontalWritingMode()) | 1017 if (!style()->isHorizontalWritingMode()) |
1018 rect = rect.transposedRect(); | 1018 rect = rect.transposedRect(); |
1019 return rect; | 1019 return rect; |
1020 } | 1020 } |
1021 | 1021 |
1022 LayoutRect LayoutInline::absoluteClippedOverflowRect() const | 1022 LayoutRect LayoutInline::absoluteClippedOverflowRect() const |
1023 { | 1023 { |
1024 if (!continuation()) | 1024 if (!continuation()) { |
1025 return clippedOverflowRect(view()); | 1025 LayoutRect rect = visualOverflowRect(); |
| 1026 mapToVisibleRectInAncestorSpace(view(), rect); |
| 1027 return rect; |
| 1028 } |
1026 | 1029 |
1027 FloatRect floatResult; | 1030 FloatRect floatResult; |
1028 LinesBoundingBoxGeneratorContext context(floatResult); | 1031 LinesBoundingBoxGeneratorContext context(floatResult); |
1029 | 1032 |
1030 LayoutInline* endContinuation = inlineElementContinuation(); | 1033 LayoutInline* endContinuation = inlineElementContinuation(); |
1031 while (LayoutInline* nextContinuation = endContinuation->inlineElementContin
uation()) | 1034 while (LayoutInline* nextContinuation = endContinuation->inlineElementContin
uation()) |
1032 endContinuation = nextContinuation; | 1035 endContinuation = nextContinuation; |
1033 | 1036 |
1034 for (LayoutBlock* currBlock = containingBlock(); currBlock && currBlock->isA
nonymousBlock(); currBlock = toLayoutBlock(currBlock->nextSibling())) { | 1037 for (LayoutBlock* currBlock = containingBlock(); currBlock && currBlock->isA
nonymousBlock(); currBlock = toLayoutBlock(currBlock->nextSibling())) { |
1035 for (LayoutObject* curr = currBlock->firstChild(); curr; curr = curr->ne
xtSibling()) { | 1038 for (LayoutObject* curr = currBlock->firstChild(); curr; curr = curr->ne
xtSibling()) { |
1036 LayoutRect rect(curr->clippedOverflowRectForPaintInvalidation(view()
)); | 1039 LayoutRect rect(curr->localOverflowRectForPaintInvalidation()); |
1037 context(FloatRect(rect)); | 1040 context(FloatRect(rect)); |
1038 if (curr == endContinuation) | 1041 if (curr == endContinuation) { |
1039 return LayoutRect(enclosingIntRect(floatResult)); | 1042 LayoutRect rect(enclosingIntRect(floatResult)); |
| 1043 mapToVisibleRectInAncestorSpace(view(), rect); |
| 1044 return rect; |
| 1045 } |
1040 } | 1046 } |
1041 } | 1047 } |
1042 return LayoutRect(); | 1048 return LayoutRect(); |
1043 } | 1049 } |
1044 | 1050 |
1045 LayoutRect LayoutInline::clippedOverflowRectForPaintInvalidation(const LayoutBox
ModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInva
lidationState) const | 1051 LayoutRect LayoutInline::localOverflowRectForPaintInvalidation() const |
1046 { | 1052 { |
1047 // If we don't create line boxes, we don't have any invalidations to do. | 1053 // If we don't create line boxes, we don't have any invalidations to do. |
1048 if (!alwaysCreateLineBoxes()) | 1054 if (!alwaysCreateLineBoxes()) |
1049 return LayoutRect(); | 1055 return LayoutRect(); |
1050 return clippedOverflowRect(paintInvalidationContainer); | |
1051 } | |
1052 | 1056 |
1053 LayoutRect LayoutInline::clippedOverflowRect(const LayoutBoxModelObject* paintIn
validationContainer, const PaintInvalidationState* paintInvalidationState) const | |
1054 { | |
1055 if (style()->visibility() != VISIBLE) | 1057 if (style()->visibility() != VISIBLE) |
1056 return LayoutRect(); | 1058 return LayoutRect(); |
1057 | 1059 |
1058 LayoutRect overflowRect(visualOverflowRect()); | 1060 return visualOverflowRect(); |
1059 if (overflowRect.isEmpty()) | |
1060 return overflowRect; | |
1061 | |
1062 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, overflowRect, pa
intInvalidationState); | |
1063 return overflowRect; | |
1064 } | 1061 } |
1065 | 1062 |
1066 LayoutRect LayoutInline::visualOverflowRect() const | 1063 LayoutRect LayoutInline::visualOverflowRect() const |
1067 { | 1064 { |
1068 LayoutRect overflowRect = linesVisualOverflowBoundingBox(); | 1065 LayoutRect overflowRect = linesVisualOverflowBoundingBox(); |
1069 LayoutUnit outlineOutset(style()->outlineOutsetExtent()); | 1066 LayoutUnit outlineOutset(style()->outlineOutsetExtent()); |
1070 if (outlineOutset) { | 1067 if (outlineOutset) { |
1071 Vector<LayoutRect> rects; | 1068 Vector<LayoutRect> rects; |
1072 // We have already included outline extents of line boxes in linesVisual
OverflowBoundingBox(), | 1069 // We have already included outline extents of line boxes in linesVisual
OverflowBoundingBox(), |
1073 // so the following just add outline rects for children and continuation
s. | 1070 // so the following just add outline rects for children and continuation
s. |
1074 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline
RectsShouldIncludeBlockVisualOverflow()); | 1071 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline
RectsShouldIncludeBlockVisualOverflow()); |
1075 if (!rects.isEmpty()) { | 1072 if (!rects.isEmpty()) { |
1076 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); | 1073 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); |
1077 outlineRect.inflate(outlineOutset); | 1074 outlineRect.inflate(outlineOutset); |
1078 overflowRect.unite(outlineRect); | 1075 overflowRect.unite(outlineRect); |
1079 } | 1076 } |
1080 } | 1077 } |
1081 return overflowRect; | 1078 return overflowRect; |
1082 } | 1079 } |
1083 | 1080 |
1084 void LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a
ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState)
const | 1081 void LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a
ncestor, LayoutRect& rect) const |
1085 { | 1082 { |
1086 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances
tor)) { | |
1087 paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect); | |
1088 return; | |
1089 } | |
1090 | |
1091 if (ancestor == this) | 1083 if (ancestor == this) |
1092 return; | 1084 return; |
1093 | 1085 |
1094 bool ancestorSkipped; | 1086 bool ancestorSkipped; |
1095 LayoutObject* container = this->container(ancestor, &ancestorSkipped); | 1087 LayoutObject* container = this->container(ancestor, &ancestorSkipped); |
1096 if (!container) | 1088 if (!container) |
1097 return; | 1089 return; |
1098 | 1090 |
1099 LayoutPoint topLeft = rect.location(); | 1091 LayoutPoint topLeft = rect.location(); |
1100 | 1092 |
(...skipping 17 matching lines...) Expand all Loading... |
1118 return; | 1110 return; |
1119 } | 1111 } |
1120 | 1112 |
1121 if (ancestorSkipped) { | 1113 if (ancestorSkipped) { |
1122 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 1114 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
1123 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); | 1115 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); |
1124 rect.move(-containerOffset); | 1116 rect.move(-containerOffset); |
1125 return; | 1117 return; |
1126 } | 1118 } |
1127 | 1119 |
1128 container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullptr); | 1120 container->mapToVisibleRectInAncestorSpace(ancestor, rect); |
1129 } | 1121 } |
1130 | 1122 |
1131 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons
t | 1123 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons
t |
1132 { | 1124 { |
1133 ASSERT(container == this->container()); | 1125 ASSERT(container == this->container()); |
1134 | 1126 |
1135 LayoutSize offset; | 1127 LayoutSize offset; |
1136 if (isInFlowPositioned()) | 1128 if (isInFlowPositioned()) |
1137 offset += offsetForInFlowPosition(); | 1129 offset += offsetForInFlowPosition(); |
1138 | 1130 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 | 1371 |
1380 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const | 1372 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
1381 { | 1373 { |
1382 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine
r, invalidationReason); | 1374 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine
r, invalidationReason); |
1383 | 1375 |
1384 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1376 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
1385 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in
validationReason); | 1377 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in
validationReason); |
1386 } | 1378 } |
1387 | 1379 |
1388 } // namespace blink | 1380 } // namespace blink |
OLD | NEW |