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

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

Issue 1817693002: Support edge-inclusive intersections in mapToVisibleRectInAncestorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-idle-callback
Patch Set: compiler warning fix 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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 1052
1053 LayoutRect LayoutInline::clippedOverflowRect(const LayoutBoxModelObject* paintIn validationContainer, const PaintInvalidationState* paintInvalidationState) const 1053 LayoutRect LayoutInline::clippedOverflowRect(const LayoutBoxModelObject* paintIn validationContainer, const PaintInvalidationState* paintInvalidationState) const
1054 { 1054 {
1055 if (style()->visibility() != VISIBLE) 1055 if (style()->visibility() != VISIBLE)
1056 return LayoutRect(); 1056 return LayoutRect();
1057 1057
1058 LayoutRect overflowRect(visualOverflowRect()); 1058 LayoutRect overflowRect(visualOverflowRect());
1059 if (overflowRect.isEmpty()) 1059 if (overflowRect.isEmpty())
1060 return overflowRect; 1060 return overflowRect;
1061 1061
1062 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, overflowRect, pa intInvalidationState); 1062 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, overflowRect, pa intInvalidationState, false);
1063 return overflowRect; 1063 return overflowRect;
1064 } 1064 }
1065 1065
1066 LayoutRect LayoutInline::visualOverflowRect() const 1066 LayoutRect LayoutInline::visualOverflowRect() const
1067 { 1067 {
1068 LayoutRect overflowRect = linesVisualOverflowBoundingBox(); 1068 LayoutRect overflowRect = linesVisualOverflowBoundingBox();
1069 LayoutUnit outlineOutset(style()->outlineOutsetExtent()); 1069 LayoutUnit outlineOutset(style()->outlineOutsetExtent());
1070 if (outlineOutset) { 1070 if (outlineOutset) {
1071 Vector<LayoutRect> rects; 1071 Vector<LayoutRect> rects;
1072 // We have already included outline extents of line boxes in linesVisual OverflowBoundingBox(), 1072 // 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. 1073 // so the following just add outline rects for children and continuation s.
1074 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline RectsShouldIncludeBlockVisualOverflow()); 1074 addOutlineRectsForChildrenAndContinuations(rects, LayoutPoint(), outline RectsShouldIncludeBlockVisualOverflow());
1075 if (!rects.isEmpty()) { 1075 if (!rects.isEmpty()) {
1076 LayoutRect outlineRect = unionRectEvenIfEmpty(rects); 1076 LayoutRect outlineRect = unionRectEvenIfEmpty(rects);
1077 outlineRect.inflate(outlineOutset); 1077 outlineRect.inflate(outlineOutset);
1078 overflowRect.unite(outlineRect); 1078 overflowRect.unite(outlineRect);
1079 } 1079 }
1080 } 1080 }
1081 return overflowRect; 1081 return overflowRect;
1082 } 1082 }
1083 1083
1084 void LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) const 1084 bool LayoutInline::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState, bool edgeInclusive) const
eae 2016/03/22 00:13:50 It's unclear to me why these method would need to
szager1 2016/03/22 00:55:48 mapToVisibleRectInAncestorSpace is used by Interse
1085 { 1085 {
1086 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances tor)) { 1086 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances tor))
1087 paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect); 1087 return paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect, edgeInclusive);
1088 return;
1089 }
1090 1088
1091 if (ancestor == this) 1089 if (ancestor == this)
1092 return; 1090 return true;
1093 1091
1094 bool ancestorSkipped; 1092 bool ancestorSkipped;
1095 LayoutObject* container = this->container(ancestor, &ancestorSkipped); 1093 LayoutObject* container = this->container(ancestor, &ancestorSkipped);
1096 if (!container) 1094 if (!container)
1097 return; 1095 return true;
1098 1096
1099 LayoutPoint topLeft = rect.location(); 1097 LayoutPoint topLeft = rect.location();
1100 1098
1101 if (style()->hasInFlowPosition() && layer()) { 1099 if (style()->hasInFlowPosition() && layer()) {
1102 // Apply the in-flow position offset when invalidating a rectangle. The layer 1100 // Apply the in-flow position offset when invalidating a rectangle. The layer
1103 // is translated, but the layout box isn't, so we need to do this to get the 1101 // is translated, but the layout box isn't, so we need to do this to get the
1104 // right dirty rect. Since this is called from LayoutObject::setStyle, t he relative position 1102 // right dirty rect. Since this is called from LayoutObject::setStyle, t he relative position
1105 // flag on the LayoutObject has been cleared, so use the one on the styl e(). 1103 // flag on the LayoutObject has been cleared, so use the one on the styl e().
1106 topLeft += layer()->offsetForInFlowPosition(); 1104 topLeft += layer()->offsetForInFlowPosition();
1107 } 1105 }
1108 1106
1109 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout, 1107 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout,
1110 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer. 1108 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer.
1111 rect.setLocation(topLeft); 1109 rect.setLocation(topLeft);
1112 if (container->hasOverflowClip()) { 1110 if (container->hasOverflowClip()) {
1113 LayoutBox* containerBox = toLayoutBox(container); 1111 LayoutBox* containerBox = toLayoutBox(container);
1114 containerBox->mapScrollingContentsRectToBoxSpace(rect); 1112 containerBox->mapScrollingContentsRectToBoxSpace(rect);
1115 if (container != ancestor) 1113 if (container != ancestor && !containerBox->applyOverflowClip(rect, edge Inclusive))
1116 containerBox->applyOverflowClip(rect); 1114 return false;
1117 if (rect.isEmpty())
1118 return;
1119 } 1115 }
1120 1116
1121 if (ancestorSkipped) { 1117 if (ancestorSkipped) {
1122 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. 1118 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates.
1123 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta iner); 1119 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta iner);
1124 rect.move(-containerOffset); 1120 rect.move(-containerOffset);
1125 return; 1121 return true;
1126 } 1122 }
1127 1123
1128 container->mapToVisibleRectInAncestorSpace(ancestor, rect, paintInvalidation State); 1124 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, paintInval idationState, edgeInclusive);
1129 } 1125 }
1130 1126
1131 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons t 1127 LayoutSize LayoutInline::offsetFromContainer(const LayoutObject* container) cons t
1132 { 1128 {
1133 ASSERT(container == this->container()); 1129 ASSERT(container == this->container());
1134 1130
1135 LayoutSize offset; 1131 LayoutSize offset;
1136 if (isInFlowPositioned()) 1132 if (isInFlowPositioned())
1137 offset += offsetForInFlowPosition(); 1133 offset += offsetForInFlowPosition();
1138 1134
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 1375
1380 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1376 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1381 { 1377 {
1382 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1378 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1383 1379
1384 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1380 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1385 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1381 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1386 } 1382 }
1387 1383
1388 } // namespace blink 1384 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698