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. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 DCHECK_EQ(&paint_invalidation_state.CurrentObject(), this); | 1183 DCHECK_EQ(&paint_invalidation_state.CurrentObject(), this); |
1184 | 1184 |
1185 if (StyleRef().HasOutline()) { | 1185 if (StyleRef().HasOutline()) { |
1186 PaintLayer& layer = paint_invalidation_state.PaintingLayer(); | 1186 PaintLayer& layer = paint_invalidation_state.PaintingLayer(); |
1187 if (&layer.GetLayoutObject() != this) | 1187 if (&layer.GetLayoutObject() != this) |
1188 layer.SetNeedsPaintPhaseDescendantOutlines(); | 1188 layer.SetNeedsPaintPhaseDescendantOutlines(); |
1189 } | 1189 } |
1190 | 1190 |
1191 LayoutView* v = View(); | 1191 LayoutView* v = View(); |
1192 if (v->GetDocument().Printing()) | 1192 if (v->GetDocument().Printing()) |
1193 return kPaintInvalidationNone; // Don't invalidate paints if we're | 1193 return PaintInvalidationReason::kNone; // Don't invalidate paints if we're |
1194 // printing. | 1194 // printing. |
1195 | 1195 |
1196 PaintInvalidatorContextAdapter context(paint_invalidation_state); | 1196 PaintInvalidatorContextAdapter context(paint_invalidation_state); |
1197 | 1197 |
1198 const LayoutBoxModelObject& paint_invalidation_container = | 1198 const LayoutBoxModelObject& paint_invalidation_container = |
1199 paint_invalidation_state.PaintInvalidationContainer(); | 1199 paint_invalidation_state.PaintInvalidationContainer(); |
1200 DCHECK(paint_invalidation_container == ContainerForPaintInvalidation()); | 1200 DCHECK(paint_invalidation_container == ContainerForPaintInvalidation()); |
1201 | 1201 |
1202 ObjectPaintInvalidator paint_invalidator(*this); | 1202 ObjectPaintInvalidator paint_invalidator(*this); |
1203 context.old_visual_rect = VisualRect(); | 1203 context.old_visual_rect = VisualRect(); |
1204 context.old_location = paint_invalidator.LocationInBacking(); | 1204 context.old_location = paint_invalidator.LocationInBacking(); |
1205 LayoutRect new_visual_rect = | 1205 LayoutRect new_visual_rect = |
1206 paint_invalidation_state.ComputeVisualRectInBacking(); | 1206 paint_invalidation_state.ComputeVisualRectInBacking(); |
1207 context.new_location = paint_invalidation_state.ComputeLocationInBacking( | 1207 context.new_location = paint_invalidation_state.ComputeLocationInBacking( |
1208 new_visual_rect.Location()); | 1208 new_visual_rect.Location()); |
1209 | 1209 |
1210 SetVisualRect(new_visual_rect); | 1210 SetVisualRect(new_visual_rect); |
1211 paint_invalidator.SetLocationInBacking(context.new_location); | 1211 paint_invalidator.SetLocationInBacking(context.new_location); |
1212 | 1212 |
1213 if (!ShouldCheckForPaintInvalidation() && | 1213 if (!ShouldCheckForPaintInvalidation() && |
1214 paint_invalidation_state | 1214 paint_invalidation_state |
1215 .ForcedSubtreeInvalidationRectUpdateWithinContainerOnly()) { | 1215 .ForcedSubtreeInvalidationRectUpdateWithinContainerOnly()) { |
1216 // We are done updating the visual rect. No other paint invalidation work | 1216 // We are done updating the visual rect. No other paint invalidation work |
1217 // to do for this object. | 1217 // to do for this object. |
1218 return kPaintInvalidationNone; | 1218 return PaintInvalidationReason::kNone; |
1219 } | 1219 } |
1220 | 1220 |
1221 return InvalidatePaint(context); | 1221 return InvalidatePaint(context); |
1222 } | 1222 } |
1223 | 1223 |
1224 DISABLE_CFI_PERF | 1224 DISABLE_CFI_PERF |
1225 PaintInvalidationReason LayoutObject::InvalidatePaint( | 1225 PaintInvalidationReason LayoutObject::InvalidatePaint( |
1226 const PaintInvalidatorContext& context) const { | 1226 const PaintInvalidatorContext& context) const { |
1227 return ObjectPaintInvalidatorWithContext(*this, context).InvalidatePaint(); | 1227 return ObjectPaintInvalidatorWithContext(*this, context).InvalidatePaint(); |
1228 } | 1228 } |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 } | 3389 } |
3390 | 3390 |
3391 bool LayoutObject::IsRelayoutBoundaryForInspector() const { | 3391 bool LayoutObject::IsRelayoutBoundaryForInspector() const { |
3392 return ObjectIsRelayoutBoundary(this); | 3392 return ObjectIsRelayoutBoundary(this); |
3393 } | 3393 } |
3394 | 3394 |
3395 static PaintInvalidationReason DocumentLifecycleBasedPaintInvalidationReason( | 3395 static PaintInvalidationReason DocumentLifecycleBasedPaintInvalidationReason( |
3396 const DocumentLifecycle& document_lifecycle) { | 3396 const DocumentLifecycle& document_lifecycle) { |
3397 switch (document_lifecycle.GetState()) { | 3397 switch (document_lifecycle.GetState()) { |
3398 case DocumentLifecycle::kInStyleRecalc: | 3398 case DocumentLifecycle::kInStyleRecalc: |
3399 return kPaintInvalidationStyleChange; | 3399 return PaintInvalidationReason::kStyle; |
3400 case DocumentLifecycle::kInPreLayout: | 3400 case DocumentLifecycle::kInPreLayout: |
3401 case DocumentLifecycle::kInPerformLayout: | 3401 case DocumentLifecycle::kInPerformLayout: |
3402 case DocumentLifecycle::kAfterPerformLayout: | 3402 case DocumentLifecycle::kAfterPerformLayout: |
3403 return kPaintInvalidationForcedByLayout; | 3403 return PaintInvalidationReason::kGeometry; |
3404 case DocumentLifecycle::kInCompositingUpdate: | 3404 case DocumentLifecycle::kInCompositingUpdate: |
3405 return kPaintInvalidationCompositingUpdate; | 3405 return PaintInvalidationReason::kCompositing; |
3406 default: | 3406 default: |
3407 return kPaintInvalidationFull; | 3407 return PaintInvalidationReason::kFull; |
3408 } | 3408 } |
3409 } | 3409 } |
3410 | 3410 |
3411 inline void LayoutObject::MarkAncestorsForPaintInvalidation() { | 3411 inline void LayoutObject::MarkAncestorsForPaintInvalidation() { |
3412 for (LayoutObject* parent = this->ParentCrossingFrames(); | 3412 for (LayoutObject* parent = this->ParentCrossingFrames(); |
3413 parent && !parent->ShouldCheckForPaintInvalidation(); | 3413 parent && !parent->ShouldCheckForPaintInvalidation(); |
3414 parent = parent->ParentCrossingFrames()) | 3414 parent = parent->ParentCrossingFrames()) |
3415 parent->bitfields_.SetMayNeedPaintInvalidation(true); | 3415 parent->bitfields_.SetMayNeedPaintInvalidation(true); |
3416 } | 3416 } |
3417 | 3417 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3461 SetShouldDoFullPaintInvalidationWithoutGeometryChange(reason); | 3461 SetShouldDoFullPaintInvalidationWithoutGeometryChange(reason); |
3462 } | 3462 } |
3463 | 3463 |
3464 void LayoutObject::SetShouldDoFullPaintInvalidationWithoutGeometryChange( | 3464 void LayoutObject::SetShouldDoFullPaintInvalidationWithoutGeometryChange( |
3465 PaintInvalidationReason reason) { | 3465 PaintInvalidationReason reason) { |
3466 // Only full invalidation reasons are allowed. | 3466 // Only full invalidation reasons are allowed. |
3467 DCHECK(IsFullPaintInvalidationReason(reason)); | 3467 DCHECK(IsFullPaintInvalidationReason(reason)); |
3468 | 3468 |
3469 bool is_upgrading_delayed_full_to_full = | 3469 bool is_upgrading_delayed_full_to_full = |
3470 bitfields_.FullPaintInvalidationReason() == | 3470 bitfields_.FullPaintInvalidationReason() == |
3471 kPaintInvalidationDelayedFull && | 3471 PaintInvalidationReason::kDelayedFull && |
3472 reason != kPaintInvalidationDelayedFull; | 3472 reason != PaintInvalidationReason::kDelayedFull; |
3473 | 3473 |
3474 if (bitfields_.FullPaintInvalidationReason() == kPaintInvalidationNone || | 3474 if (bitfields_.FullPaintInvalidationReason() == |
| 3475 PaintInvalidationReason::kNone || |
3475 is_upgrading_delayed_full_to_full) { | 3476 is_upgrading_delayed_full_to_full) { |
3476 if (reason == kPaintInvalidationFull) | 3477 if (reason == PaintInvalidationReason::kFull) { |
3477 reason = DocumentLifecycleBasedPaintInvalidationReason( | 3478 reason = DocumentLifecycleBasedPaintInvalidationReason( |
3478 GetDocument().Lifecycle()); | 3479 GetDocument().Lifecycle()); |
| 3480 } |
3479 bitfields_.SetFullPaintInvalidationReason(reason); | 3481 bitfields_.SetFullPaintInvalidationReason(reason); |
3480 if (!is_upgrading_delayed_full_to_full) | 3482 if (!is_upgrading_delayed_full_to_full) |
3481 MarkAncestorsForPaintInvalidation(); | 3483 MarkAncestorsForPaintInvalidation(); |
3482 } | 3484 } |
3483 | 3485 |
3484 GetFrameView()->ScheduleVisualUpdateForPaintInvalidationIfNeeded(); | 3486 GetFrameView()->ScheduleVisualUpdateForPaintInvalidationIfNeeded(); |
3485 } | 3487 } |
3486 | 3488 |
3487 void LayoutObject::SetMayNeedPaintInvalidation() { | 3489 void LayoutObject::SetMayNeedPaintInvalidation() { |
3488 SetNeedsPaintOffsetAndVisualRectUpdate(); | 3490 SetNeedsPaintOffsetAndVisualRectUpdate(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3539 bool DeprecatedDisableModifyLayoutTreeStructureAsserts:: | 3541 bool DeprecatedDisableModifyLayoutTreeStructureAsserts:: |
3540 CanModifyLayoutTreeStateInAnyState() { | 3542 CanModifyLayoutTreeStateInAnyState() { |
3541 return g_modify_layout_tree_structure_any_state; | 3543 return g_modify_layout_tree_structure_any_state; |
3542 } | 3544 } |
3543 | 3545 |
3544 void LayoutObject:: | 3546 void LayoutObject:: |
3545 SetShouldDoFullPaintInvalidationIncludingNonCompositingDescendants() { | 3547 SetShouldDoFullPaintInvalidationIncludingNonCompositingDescendants() { |
3546 // Clear first because PaintInvalidationSubtree overrides other full paint | 3548 // Clear first because PaintInvalidationSubtree overrides other full paint |
3547 // invalidation reasons. | 3549 // invalidation reasons. |
3548 ClearShouldDoFullPaintInvalidation(); | 3550 ClearShouldDoFullPaintInvalidation(); |
3549 SetShouldDoFullPaintInvalidation(kPaintInvalidationSubtree); | 3551 SetShouldDoFullPaintInvalidation(PaintInvalidationReason::kSubtree); |
3550 } | 3552 } |
3551 | 3553 |
3552 void LayoutObject::SetIsBackgroundAttachmentFixedObject( | 3554 void LayoutObject::SetIsBackgroundAttachmentFixedObject( |
3553 bool is_background_attachment_fixed_object) { | 3555 bool is_background_attachment_fixed_object) { |
3554 DCHECK(GetFrameView()); | 3556 DCHECK(GetFrameView()); |
3555 if (bitfields_.IsBackgroundAttachmentFixedObject() == | 3557 if (bitfields_.IsBackgroundAttachmentFixedObject() == |
3556 is_background_attachment_fixed_object) | 3558 is_background_attachment_fixed_object) |
3557 return; | 3559 return; |
3558 bitfields_.SetIsBackgroundAttachmentFixedObject( | 3560 bitfields_.SetIsBackgroundAttachmentFixedObject( |
3559 is_background_attachment_fixed_object); | 3561 is_background_attachment_fixed_object); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3646 const blink::LayoutObject* root = object1; | 3648 const blink::LayoutObject* root = object1; |
3647 while (root->Parent()) | 3649 while (root->Parent()) |
3648 root = root->Parent(); | 3650 root = root->Parent(); |
3649 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3651 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3650 } else { | 3652 } else { |
3651 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3653 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3652 } | 3654 } |
3653 } | 3655 } |
3654 | 3656 |
3655 #endif | 3657 #endif |
OLD | NEW |