Chromium Code Reviews| 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); | 1056 return visualOverflowRect(); |
| 1051 } | |
| 1052 | |
| 1053 LayoutRect LayoutInline::clippedOverflowRect(const LayoutBoxModelObject* paintIn validationContainer, const PaintInvalidationState* paintInvalidationState) const | |
| 1054 { | |
| 1055 if (style()->visibility() != VISIBLE) | |
|
chrishtr
2016/03/24 01:05:42
Did you lose this optimization?
Xianzhu
2016/03/25 16:35:54
Done.
| |
| 1056 return LayoutRect(); | |
| 1057 | |
| 1058 LayoutRect overflowRect(visualOverflowRect()); | |
| 1059 if (overflowRect.isEmpty()) | |
| 1060 return overflowRect; | |
| 1061 | |
| 1062 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, overflowRect, pa intInvalidationState); | |
| 1063 return overflowRect; | |
| 1064 } | 1057 } |
| 1065 | 1058 |
| 1066 LayoutRect LayoutInline::visualOverflowRect() const | 1059 LayoutRect LayoutInline::visualOverflowRect() const |
| 1067 { | 1060 { |
| 1068 LayoutRect overflowRect = linesVisualOverflowBoundingBox(); | 1061 LayoutRect overflowRect = linesVisualOverflowBoundingBox(); |
| 1069 LayoutUnit outlineOutset(style()->outlineOutsetExtent()); | 1062 LayoutUnit outlineOutset(style()->outlineOutsetExtent()); |
| 1070 if (outlineOutset) { | 1063 if (outlineOutset) { |
| 1071 Vector<LayoutRect> rects; | 1064 Vector<LayoutRect> rects; |
| 1072 // We have already included outline extents of line boxes in linesVisual OverflowBoundingBox(), | 1065 // 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. | 1066 // so the following just add outline rects for children and continuation s. |
| 1074 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline RectsShouldIncludeBlockVisualOverflow()); | 1067 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline RectsShouldIncludeBlockVisualOverflow()); |
| 1075 if (!rects.isEmpty()) { | 1068 if (!rects.isEmpty()) { |
| 1076 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); | 1069 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); |
| 1077 outlineRect.inflate(outlineOutset); | 1070 outlineRect.inflate(outlineOutset); |
| 1078 overflowRect.unite(outlineRect); | 1071 overflowRect.unite(outlineRect); |
| 1079 } | 1072 } |
| 1080 } | 1073 } |
| 1081 return overflowRect; | 1074 return overflowRect; |
| 1082 } | 1075 } |
| 1083 | 1076 |
| 1084 void LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) const | 1077 void LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect) const |
| 1085 { | 1078 { |
| 1086 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances tor)) { | |
| 1087 paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect); | |
| 1088 return; | |
| 1089 } | |
| 1090 | |
| 1091 if (ancestor == this) | 1079 if (ancestor == this) |
| 1092 return; | 1080 return; |
| 1093 | 1081 |
| 1094 bool ancestorSkipped; | 1082 bool ancestorSkipped; |
| 1095 LayoutObject* container = this->container(ancestor, &ancestorSkipped); | 1083 LayoutObject* container = this->container(ancestor, &ancestorSkipped); |
| 1096 if (!container) | 1084 if (!container) |
| 1097 return; | 1085 return; |
| 1098 | 1086 |
| 1099 LayoutPoint topLeft = rect.location(); | 1087 LayoutPoint topLeft = rect.location(); |
| 1100 | 1088 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1118 return; | 1106 return; |
| 1119 } | 1107 } |
| 1120 | 1108 |
| 1121 if (ancestorSkipped) { | 1109 if (ancestorSkipped) { |
| 1122 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. | 1110 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. |
| 1123 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta iner); | 1111 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta iner); |
| 1124 rect.move(-containerOffset); | 1112 rect.move(-containerOffset); |
| 1125 return; | 1113 return; |
| 1126 } | 1114 } |
| 1127 | 1115 |
| 1128 container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullptr); | 1116 container->mapToVisibleRectInAncestorSpace(ancestor, rect); |
| 1129 } | 1117 } |
| 1130 | 1118 |
| 1131 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons t | 1119 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons t |
| 1132 { | 1120 { |
| 1133 ASSERT(container == this->container()); | 1121 ASSERT(container == this->container()); |
| 1134 | 1122 |
| 1135 LayoutSize offset; | 1123 LayoutSize offset; |
| 1136 if (isInFlowPositioned()) | 1124 if (isInFlowPositioned()) |
| 1137 offset += offsetForInFlowPosition(); | 1125 offset += offsetForInFlowPosition(); |
| 1138 | 1126 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1379 | 1367 |
| 1380 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const | 1368 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
| 1381 { | 1369 { |
| 1382 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); | 1370 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); |
| 1383 | 1371 |
| 1384 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1372 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
| 1385 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); | 1373 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); |
| 1386 } | 1374 } |
| 1387 | 1375 |
| 1388 } // namespace blink | 1376 } // namespace blink |
| OLD | NEW |