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

Side by Side Diff: sky/engine/core/rendering/RenderBox.cpp

Issue 847303003: Delete selection paint invalidation code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return style()->paddingStart().isPercent() || style()->paddingEnd().isPercen t(); 471 return style()->paddingStart().isPercent() || style()->paddingEnd().isPercen t();
472 } 472 }
473 473
474 IntSize RenderBox::scrolledContentOffset() const 474 IntSize RenderBox::scrolledContentOffset() const
475 { 475 {
476 ASSERT(hasOverflowClip()); 476 ASSERT(hasOverflowClip());
477 ASSERT(hasLayer()); 477 ASSERT(hasLayer());
478 return layer()->scrollableArea()->scrollOffset(); 478 return layer()->scrollableArea()->scrollOffset();
479 } 479 }
480 480
481 void RenderBox::applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& p aintRect) const
482 {
483 ASSERT(hasLayer());
484 ASSERT(hasOverflowClip());
485
486 paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden .
487
488 // height() is inaccurate if we're in the middle of a layout of this RenderB ox, so use the
489 // layer's size instead. Even if the layer's size is wrong, the layer itself will issue paint invalidations
490 // anyway if its size does change.
491 LayoutRect clipRect(LayoutPoint(), layer()->size());
492 paintRect = intersection(paintRect, clipRect);
493 }
494
495 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const 481 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const
496 { 482 {
497 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); 483 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( );
498 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); 484 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( );
499 } 485 }
500 486
501 LayoutUnit RenderBox::minPreferredLogicalWidth() const 487 LayoutUnit RenderBox::minPreferredLogicalWidth() const
502 { 488 {
503 if (preferredLogicalWidthsDirty()) { 489 if (preferredLogicalWidthsDirty()) {
504 #if ENABLE(ASSERT) 490 #if ENABLE(ASSERT)
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 { 1165 {
1180 if (inlineBoxWrapper()) { 1166 if (inlineBoxWrapper()) {
1181 if (!documentBeingDestroyed()) 1167 if (!documentBeingDestroyed())
1182 inlineBoxWrapper()->remove(); 1168 inlineBoxWrapper()->remove();
1183 inlineBoxWrapper()->destroy(); 1169 inlineBoxWrapper()->destroy();
1184 ASSERT(m_rareData); 1170 ASSERT(m_rareData);
1185 m_rareData->m_inlineBoxWrapper = 0; 1171 m_rareData->m_inlineBoxWrapper = 0;
1186 } 1172 }
1187 } 1173 }
1188 1174
1189 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pain tInvalidationState) const
1190 {
1191 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space.
1192 //
1193 // RenderView::computeRectForPaintInvalidation then converts the rect to phy sical coordinates. We also convert to
1194 // physical when we hit a paintInvalidationContainer boundary. Therefore the final rect returned is always in the
1195 // physical coordinate space of the paintInvalidationContainer.
1196 RenderStyle* styleToUse = style();
1197
1198 EPosition position = styleToUse->position();
1199
1200 // We need to inflate the paint invalidation rect before we use paintInvalid ationState,
1201 // else we would forget to inflate it for the current renderer. FIXME: If th ese were
1202 // included into the visual overflow for repaint, we wouldn't have this issu e.
1203 inflatePaintInvalidationRectForReflectionAndFilter(rect);
1204
1205 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) {
1206 if (layer() && layer()->transform())
1207 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
1208
1209 // We can't trust the bits on RenderObject, because this might be called while re-resolving style.
1210 if (styleToUse->hasInFlowPosition() && layer())
1211 rect.move(layer()->offsetForInFlowPosition());
1212
1213 rect.moveBy(location());
1214 rect.move(paintInvalidationState->paintOffset());
1215 if (paintInvalidationState->isClipped())
1216 rect.intersect(paintInvalidationState->clipRect());
1217 return;
1218 }
1219
1220 if (paintInvalidationContainer == this) {
1221 return;
1222 }
1223
1224 bool containerSkipped;
1225 RenderObject* o = container(paintInvalidationContainer, &containerSkipped);
1226 if (!o)
1227 return;
1228
1229 LayoutPoint topLeft = rect.location();
1230 topLeft.move(locationOffset());
1231
1232 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box
1233 // in the parent's coordinate space that encloses us.
1234 if (hasLayer() && layer()->transform()) {
1235 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
1236 topLeft = rect.location();
1237 topLeft.move(locationOffset());
1238 }
1239
1240 if (position == AbsolutePosition && o->isRelPositioned() && o->isRenderInlin e()) {
1241 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(*this);
1242 } else if (styleToUse->hasInFlowPosition() && layer()) {
1243 // Apply the relative position offset when invalidating a rectangle. Th e layer
1244 // is translated, but the render box isn't, so we need to do this to get the
1245 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position
1246 // flag on the RenderObject has been cleared, so use the one on the styl e().
1247 topLeft += layer()->offsetForInFlowPosition();
1248 }
1249
1250 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout,
1251 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer.
1252 rect.setLocation(topLeft);
1253 if (o->hasOverflowClip()) {
1254 RenderBox* containerBox = toRenderBox(o);
1255 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rect);
1256 if (rect.isEmpty())
1257 return;
1258 }
1259
1260 if (containerSkipped) {
1261 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates.
1262 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o);
1263 rect.move(-containerOffset);
1264 return;
1265 }
1266
1267 if (o->isRenderView())
1268 toRenderView(o)->mapRectToPaintInvalidationBacking(paintInvalidationCont ainer, rect, paintInvalidationState);
1269 else
1270 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, p aintInvalidationState);
1271 }
1272
1273 void RenderBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p aintInvalidationRect) const
1274 {
1275 if (style()->hasFilter())
1276 style()->filterOutsets().expandRect(paintInvalidationRect);
1277 }
1278
1279 void RenderBox::updateLogicalWidth() 1175 void RenderBox::updateLogicalWidth()
1280 { 1176 {
1281 LogicalExtentComputedValues computedValues; 1177 LogicalExtentComputedValues computedValues;
1282 computeLogicalWidth(computedValues); 1178 computeLogicalWidth(computedValues);
1283 1179
1284 setLogicalWidth(computedValues.m_extent); 1180 setLogicalWidth(computedValues.m_extent);
1285 setLogicalLeft(computedValues.m_position); 1181 setLogicalLeft(computedValues.m_position);
1286 setMarginStart(computedValues.m_margins.m_start); 1182 setMarginStart(computedValues.m_margins.m_start);
1287 setMarginEnd(computedValues.m_margins.m_end); 1183 setMarginEnd(computedValues.m_margins.m_end);
1288 } 1184 }
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
3239 3135
3240 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3136 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3241 { 3137 {
3242 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3138 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3243 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3139 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3244 ASSERT(hasBackground == style.hasBackground()); 3140 ASSERT(hasBackground == style.hasBackground());
3245 hasBorder = style.hasBorder(); 3141 hasBorder = style.hasBorder();
3246 } 3142 }
3247 3143
3248 } // namespace blink 3144 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698