| 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 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 , m_parent(nullptr) | 250 , m_parent(nullptr) |
| 251 , m_previous(nullptr) | 251 , m_previous(nullptr) |
| 252 , m_next(nullptr) | 252 , m_next(nullptr) |
| 253 #if ENABLE(ASSERT) | 253 #if ENABLE(ASSERT) |
| 254 , m_hasAXObject(false) | 254 , m_hasAXObject(false) |
| 255 , m_setNeedsLayoutForbidden(false) | 255 , m_setNeedsLayoutForbidden(false) |
| 256 #endif | 256 #endif |
| 257 , m_bitfields(node) | 257 , m_bitfields(node) |
| 258 { | 258 { |
| 259 // TODO(wangxianzhu): Move this into initialization list when we enable the
feature by default. | 259 // TODO(wangxianzhu): Move this into initialization list when we enable the
feature by default. |
| 260 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()) | 260 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 261 m_previousPositionFromPaintInvalidationBacking = uninitializedPaintOffse
t(); | 261 m_previousPositionFromPaintInvalidationBacking = uninitializedPaintOffse
t(); |
| 262 | 262 |
| 263 #ifndef NDEBUG | 263 #ifndef NDEBUG |
| 264 layoutObjectCounter().increment(); | 264 layoutObjectCounter().increment(); |
| 265 #endif | 265 #endif |
| 266 InstanceCounters::incrementCounter(InstanceCounters::LayoutObjectCounter); | 266 InstanceCounters::incrementCounter(InstanceCounters::LayoutObjectCounter); |
| 267 } | 267 } |
| 268 | 268 |
| 269 LayoutObject::~LayoutObject() | 269 LayoutObject::~LayoutObject() |
| 270 { | 270 { |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t
his); | 1415 PaintLayer& layer = paintInvalidationState.enclosingSelfPaintingLayer(*t
his); |
| 1416 if (layer.layoutObject() != this) | 1416 if (layer.layoutObject() != this) |
| 1417 layer.setNeedsPaintPhaseDescendantOutlines(); | 1417 layer.setNeedsPaintPhaseDescendantOutlines(); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 LayoutView* v = view(); | 1420 LayoutView* v = view(); |
| 1421 if (v->document().printing()) | 1421 if (v->document().printing()) |
| 1422 return PaintInvalidationNone; // Don't invalidate paints if we're printi
ng. | 1422 return PaintInvalidationNone; // Don't invalidate paints if we're printi
ng. |
| 1423 | 1423 |
| 1424 const LayoutRect oldBounds = previousPaintInvalidationRect(); | 1424 const LayoutRect oldBounds = previousPaintInvalidationRect(); |
| 1425 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintOffsetC
achingEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking()
; | 1425 const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintInvalid
ationEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking(); |
| 1426 LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationConta
iner, &paintInvalidationState); | 1426 LayoutRect newBounds = boundsRectForPaintInvalidation(paintInvalidationConta
iner, &paintInvalidationState); |
| 1427 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintOffsetCaching
Enabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(thi
s, &paintInvalidationContainer, &paintInvalidationState); | 1427 LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintInvalidationE
nabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(this
, &paintInvalidationContainer, &paintInvalidationState); |
| 1428 | 1428 |
| 1429 // Composited scrolling should not be included in the bounds and position tr
acking, because the graphics layer backing the scroller | 1429 // Composited scrolling should not be included in the bounds and position tr
acking, because the graphics layer backing the scroller |
| 1430 // does not move on scroll. | 1430 // does not move on scroll. |
| 1431 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { | 1431 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati
onContainer != this) { |
| 1432 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); | 1432 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol
ledContentOffset()); |
| 1433 newLocation.move(inverseOffset); | 1433 newLocation.move(inverseOffset); |
| 1434 newBounds.move(inverseOffset); | 1434 newBounds.move(inverseOffset); |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 setPreviousPaintInvalidationRect(newBounds); | 1437 setPreviousPaintInvalidationRect(newBounds); |
| 1438 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()) | 1438 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 1439 setPreviousPositionFromPaintInvalidationBacking(newLocation); | 1439 setPreviousPositionFromPaintInvalidationBacking(newLocation); |
| 1440 | 1440 |
| 1441 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
!paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) { | 1441 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
!paintInvalidationState.forcedSubtreeInvalidationWithinContainer()) { |
| 1442 ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinC
ontainer()); | 1442 ASSERT(paintInvalidationState.forcedSubtreeInvalidationRectUpdateWithinC
ontainer()); |
| 1443 return PaintInvalidationNone; | 1443 return PaintInvalidationNone; |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn
validationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1446 PaintInvalidationReason invalidationReason = paintInvalidationReason(paintIn
validationContainer, oldBounds, oldLocation, newBounds, newLocation); |
| 1447 | 1447 |
| 1448 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. | 1448 // We need to invalidate the selection before checking for whether we are do
ing a full invalidation. |
| 1449 // This is because we need to update the old rect regardless. | 1449 // This is because we need to update the old rect regardless. |
| 1450 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta
te, invalidationReason); | 1450 invalidateSelectionIfNeeded(paintInvalidationContainer, paintInvalidationSta
te, invalidationReason); |
| 1451 | 1451 |
| 1452 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject:
:invalidatePaintIfNeeded()", | 1452 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject:
:invalidatePaintIfNeeded()", |
| 1453 "object", this->debugName().ascii(), | 1453 "object", this->debugName().ascii(), |
| 1454 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); | 1454 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); |
| 1455 | 1455 |
| 1456 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs
cured(); | 1456 bool boxDecorationBackgroundObscured = boxDecorationBackgroundIsKnownToBeObs
cured(); |
| 1457 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg
roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) | 1457 if (!isFullPaintInvalidationReason(invalidationReason) && boxDecorationBackg
roundObscured != m_bitfields.lastBoxDecorationBackgroundObscured()) |
| 1458 invalidationReason = PaintInvalidationBackgroundObscurationChange; | 1458 invalidationReason = PaintInvalidationBackgroundObscurationChange; |
| 1459 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); | 1459 m_bitfields.setLastBoxDecorationBackgroundObscured(boxDecorationBackgroundOb
scured); |
| 1460 | 1460 |
| 1461 if (invalidationReason == PaintInvalidationNone) { | 1461 if (invalidationReason == PaintInvalidationNone) { |
| 1462 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. | 1462 // TODO(trchen): Currently we don't keep track of paint offset of layout
objects. |
| 1463 // There are corner cases that the display items need to be invalidated
for paint offset | 1463 // There are corner cases that the display items need to be invalidated
for paint offset |
| 1464 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based | 1464 // mutation, but incurs no pixel difference (i.e. bounds stay the same)
so no rect-based |
| 1465 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. | 1465 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. |
| 1466 // This is a workaround to force display items to update paint offset. | 1466 // This is a workaround to force display items to update paint offset. |
| 1467 if (!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && pain
tInvalidationState.forcedSubtreeInvalidationWithinContainer()) | 1467 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint
InvalidationState.forcedSubtreeInvalidationWithinContainer()) |
| 1468 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); | 1468 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida
tionContainer, paintInvalidationState, invalidationReason); |
| 1469 | 1469 |
| 1470 return invalidationReason; | 1470 return invalidationReason; |
| 1471 } | 1471 } |
| 1472 | 1472 |
| 1473 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); | 1473 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont
ainer, paintInvalidationState, invalidationReason); |
| 1474 | 1474 |
| 1475 if (invalidationReason == PaintInvalidationIncremental) { | 1475 if (invalidationReason == PaintInvalidationIncremental) { |
| 1476 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1476 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
| 1477 return invalidationReason; | 1477 return invalidationReason; |
| (...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3714 const blink::LayoutObject* root = object1; | 3714 const blink::LayoutObject* root = object1; |
| 3715 while (root->parent()) | 3715 while (root->parent()) |
| 3716 root = root->parent(); | 3716 root = root->parent(); |
| 3717 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3717 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3718 } else { | 3718 } else { |
| 3719 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3719 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3720 } | 3720 } |
| 3721 } | 3721 } |
| 3722 | 3722 |
| 3723 #endif | 3723 #endif |
| OLD | NEW |