Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 1813383002: Move all fast-path paint invalidation mapping into PaintInvalidationState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable fast-path/slow-path comparison because of saturated operations of LayoutUnit Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 LayoutRect rect = visualOverflowRect(); 1025 LayoutRect rect = visualOverflowRect();
1026 mapToVisibleRectInAncestorSpace(view(), rect, nullptr); 1026 mapToVisibleRectInAncestorSpace(view(), rect);
1027 return rect; 1027 return rect;
1028 } 1028 }
1029 1029
1030 FloatRect floatResult; 1030 FloatRect floatResult;
1031 LinesBoundingBoxGeneratorContext context(floatResult); 1031 LinesBoundingBoxGeneratorContext context(floatResult);
1032 1032
1033 LayoutInline* endContinuation = inlineElementContinuation(); 1033 LayoutInline* endContinuation = inlineElementContinuation();
1034 while (LayoutInline* nextContinuation = endContinuation->inlineElementContin uation()) 1034 while (LayoutInline* nextContinuation = endContinuation->inlineElementContin uation())
1035 endContinuation = nextContinuation; 1035 endContinuation = nextContinuation;
1036 1036
1037 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())) {
1038 for (LayoutObject* curr = currBlock->firstChild(); curr; curr = curr->ne xtSibling()) { 1038 for (LayoutObject* curr = currBlock->firstChild(); curr; curr = curr->ne xtSibling()) {
1039 LayoutRect rect(curr->localOverflowRectForPaintInvalidation()); 1039 LayoutRect rect(curr->localOverflowRectForPaintInvalidation());
1040 context(FloatRect(rect)); 1040 context(FloatRect(rect));
1041 if (curr == endContinuation) { 1041 if (curr == endContinuation) {
1042 LayoutRect rect(enclosingIntRect(floatResult)); 1042 LayoutRect rect(enclosingIntRect(floatResult));
1043 mapToVisibleRectInAncestorSpace(view(), rect, nullptr); 1043 mapToVisibleRectInAncestorSpace(view(), rect);
1044 return rect; 1044 return rect;
1045 } 1045 }
1046 } 1046 }
1047 } 1047 }
1048 return LayoutRect(); 1048 return LayoutRect();
1049 } 1049 }
1050 1050
1051 LayoutRect LayoutInline::localOverflowRectForPaintInvalidation() const 1051 LayoutRect LayoutInline::localOverflowRectForPaintInvalidation() const
1052 { 1052 {
1053 // 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.
(...skipping 17 matching lines...) Expand all
1071 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline RectsShouldIncludeBlockVisualOverflow()); 1071 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline RectsShouldIncludeBlockVisualOverflow());
1072 if (!rects.isEmpty()) { 1072 if (!rects.isEmpty()) {
1073 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); 1073 LayoutRect outlineRect = unionRectEvenIfEmpty(rects);
1074 outlineRect.inflate(outlineOutset); 1074 outlineRect.inflate(outlineOutset);
1075 overflowRect.unite(outlineRect); 1075 overflowRect.unite(outlineRect);
1076 } 1076 }
1077 } 1077 }
1078 return overflowRect; 1078 return overflowRect;
1079 } 1079 }
1080 1080
1081 bool LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState, VisibleRectFlags visibleRectFlags) const 1081 bool LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, VisibleRectFlags visibleRectFlags) const
1082 { 1082 {
1083 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances tor))
1084 return paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect, visibleRectFlags);
1085
1086 if (ancestor == this) 1083 if (ancestor == this)
1087 return true; 1084 return true;
1088 1085
1089 bool ancestorSkipped; 1086 bool ancestorSkipped;
1090 LayoutObject* container = this->container(ancestor, &ancestorSkipped); 1087 LayoutObject* container = this->container(ancestor, &ancestorSkipped);
1091 if (!container) 1088 if (!container)
1092 return true; 1089 return true;
1093 1090
1094 LayoutPoint topLeft = rect.location(); 1091 LayoutPoint topLeft = rect.location();
1095 1092
(...skipping 15 matching lines...) Expand all
1111 return false; 1108 return false;
1112 } 1109 }
1113 1110
1114 if (ancestorSkipped) { 1111 if (ancestorSkipped) {
1115 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. 1112 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates.
1116 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta iner); 1113 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta iner);
1117 rect.move(-containerOffset); 1114 rect.move(-containerOffset);
1118 return true; 1115 return true;
1119 } 1116 }
1120 1117
1121 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullptr, v isibleRectFlags); 1118 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, visibleRec tFlags);
1122 } 1119 }
1123 1120
1124 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons t 1121 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons t
1125 { 1122 {
1126 ASSERT(container == this->container()); 1123 ASSERT(container == this->container());
1127 1124
1128 LayoutSize offset; 1125 LayoutSize offset;
1129 if (isInFlowPositioned()) 1126 if (isInFlowPositioned())
1130 offset += offsetForInFlowPosition(); 1127 offset += offsetForInFlowPosition();
1131 1128
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1369
1373 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1370 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1374 { 1371 {
1375 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1372 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1376 1373
1377 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1374 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1378 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1375 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1379 } 1376 }
1380 1377
1381 } // namespace blink 1378 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698