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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 if (LayoutFlowThread* flowThread = layoutState->flowThread()) | 668 if (LayoutFlowThread* flowThread = layoutState->flowThread()) |
669 return flowThread; | 669 return flowThread; |
670 } | 670 } |
671 | 671 |
672 // Not in the middle of layout so have to find the thread the slow way. | 672 // Not in the middle of layout so have to find the thread the slow way. |
673 return LayoutFlowThread::locateFlowThreadContainingBlockOf(*this); | 673 return LayoutFlowThread::locateFlowThreadContainingBlockOf(*this); |
674 } | 674 } |
675 | 675 |
676 bool LayoutObject::skipInvalidationWhenLaidOutChildren() const | 676 bool LayoutObject::skipInvalidationWhenLaidOutChildren() const |
677 { | 677 { |
678 if (!neededLayoutBecauseOfChildren()) | 678 if (!m_bitfields.neededLayoutBecauseOfChildren()) |
679 return false; | 679 return false; |
680 | 680 |
681 // SVG layoutObjects need to be invalidated when their children are laid out
. | 681 // SVG layoutObjects need to be invalidated when their children are laid out
. |
682 // LayoutBlocks with line boxes are responsible to invalidate them so we can
't ignore them. | 682 // LayoutBlocks with line boxes are responsible to invalidate them so we can
't ignore them. |
683 if (isSVG() || (isLayoutBlockFlow() && toLayoutBlockFlow(this)->firstLineBox
())) | 683 if (isSVG() || (isLayoutBlockFlow() && toLayoutBlockFlow(this)->firstLineBox
())) |
684 return false; | 684 return false; |
685 | 685 |
686 // In case scrollbars got repositioned (which will typically happen if the l
ayout object got | 686 // In case scrollbars got repositioned (which will typically happen if the l
ayout object got |
687 // resized), we cannot skip invalidation. | 687 // resized), we cannot skip invalidation. |
688 if (hasNonCompositedScrollbars()) | 688 if (hasNonCompositedScrollbars()) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 return; | 1274 return; |
1275 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap(); | 1275 selectionPaintInvalidationMap = new SelectionPaintInvalidationMap(); |
1276 } | 1276 } |
1277 | 1277 |
1278 if (selectionRect.isEmpty()) | 1278 if (selectionRect.isEmpty()) |
1279 selectionPaintInvalidationMap->remove(this); | 1279 selectionPaintInvalidationMap->remove(this); |
1280 else | 1280 else |
1281 selectionPaintInvalidationMap->set(this, selectionRect); | 1281 selectionPaintInvalidationMap->set(this, selectionRect); |
1282 } | 1282 } |
1283 | 1283 |
| 1284 // TODO(wangxianzhu): Remove this for slimming paint v2 because we won't care ab
out paint invalidation rects. |
1284 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject
& paintInvalidationContainer, PaintInvalidationReason invalidationReason) | 1285 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject
& paintInvalidationContainer, PaintInvalidationReason invalidationReason) |
1285 { | 1286 { |
1286 // Update selection rect when we are doing full invalidation (in case that t
he object is moved, composite status changed, etc.) | 1287 // Update selection rect when we are doing full invalidation (in case that t
he object is moved, composite status changed, etc.) |
1287 // or shouldInvalidationSelection is set (in case that the selection itself
changed). | 1288 // or shouldInvalidationSelection is set (in case that the selection itself
changed). |
1288 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI
nvalidationReason(invalidationReason); | 1289 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI
nvalidationReason(invalidationReason); |
1289 if (!fullInvalidation && !shouldInvalidateSelection()) | 1290 if (!fullInvalidation && !shouldInvalidateSelection()) |
1290 return; | 1291 return; |
1291 | 1292 |
1292 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); | 1293 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); |
1293 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali
dationContainer); | 1294 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali
dationContainer); |
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3126 case DocumentLifecycle::InCompositingUpdate: | 3127 case DocumentLifecycle::InCompositingUpdate: |
3127 return PaintInvalidationCompositingUpdate; | 3128 return PaintInvalidationCompositingUpdate; |
3128 default: | 3129 default: |
3129 return PaintInvalidationFull; | 3130 return PaintInvalidationFull; |
3130 } | 3131 } |
3131 } | 3132 } |
3132 | 3133 |
3133 inline void LayoutObject::markContainerChainForPaintInvalidation() | 3134 inline void LayoutObject::markContainerChainForPaintInvalidation() |
3134 { | 3135 { |
3135 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con
tainer && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidati
onState(); container = container->containerCrossingFrameBoundaries()) | 3136 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con
tainer && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidati
onState(); container = container->containerCrossingFrameBoundaries()) |
3136 container->setSelfMayNeedPaintInvalidation(); | 3137 container->m_bitfields.setChildShouldCheckForPaintInvalidation(true); |
3137 } | |
3138 | |
3139 void LayoutObject::setLayoutDidGetCalledSinceLastFrame() | |
3140 { | |
3141 m_bitfields.setLayoutDidGetCalledSinceLastFrame(true); | |
3142 | |
3143 // Make sure our parent is marked as needing invalidation. | |
3144 // This would be unneeded if we allowed sub-tree invalidation (akin to sub-t
ree layouts). | |
3145 markContainerChainForPaintInvalidation(); | |
3146 } | 3138 } |
3147 | 3139 |
3148 void LayoutObject::setShouldInvalidateSelection() | 3140 void LayoutObject::setShouldInvalidateSelection() |
3149 { | 3141 { |
3150 if (!canUpdateSelectionOnRootLineBoxes()) | 3142 if (!canUpdateSelectionOnRootLineBoxes()) |
3151 return; | 3143 return; |
3152 | 3144 |
3153 m_bitfields.setShouldInvalidateSelection(true); | 3145 m_bitfields.setShouldInvalidateSelection(true); |
3154 markContainerChainForPaintInvalidation(); | 3146 markContainerChainForPaintInvalidation(); |
3155 } | 3147 } |
(...skipping 16 matching lines...) Expand all Loading... |
3172 frame()->page()->animator().scheduleVisualUpdate(); // In case that this
is called outside of FrameView::updateLayoutAndStyleForPainting(). | 3164 frame()->page()->animator().scheduleVisualUpdate(); // In case that this
is called outside of FrameView::updateLayoutAndStyleForPainting(). |
3173 markContainerChainForPaintInvalidation(); | 3165 markContainerChainForPaintInvalidation(); |
3174 } | 3166 } |
3175 } | 3167 } |
3176 | 3168 |
3177 void LayoutObject::setMayNeedPaintInvalidation() | 3169 void LayoutObject::setMayNeedPaintInvalidation() |
3178 { | 3170 { |
3179 if (mayNeedPaintInvalidation()) | 3171 if (mayNeedPaintInvalidation()) |
3180 return; | 3172 return; |
3181 m_bitfields.setMayNeedPaintInvalidation(true); | 3173 m_bitfields.setMayNeedPaintInvalidation(true); |
3182 // Make sure our parent is marked as needing invalidation. | |
3183 markContainerChainForPaintInvalidation(); | 3174 markContainerChainForPaintInvalidation(); |
3184 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is
called outside of FrameView::updateLayoutAndStyleForPainting(). | 3175 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is
called outside of FrameView::updateLayoutAndStyleForPainting(). |
3185 } | 3176 } |
3186 | 3177 |
3187 void LayoutObject::clearMayNeedPaintInvalidation() | |
3188 { | |
3189 m_bitfields.setMayNeedPaintInvalidation(false); | |
3190 } | |
3191 | |
3192 void LayoutObject::setSelfMayNeedPaintInvalidation() | |
3193 { | |
3194 m_bitfields.setMayNeedPaintInvalidation(true); | |
3195 } | |
3196 | |
3197 void LayoutObject::clearPaintInvalidationState(const PaintInvalidationState& pai
ntInvalidationState) | 3178 void LayoutObject::clearPaintInvalidationState(const PaintInvalidationState& pai
ntInvalidationState) |
3198 { | 3179 { |
3199 // paintInvalidationStateIsDirty should be kept in sync with the | 3180 // paintInvalidationStateIsDirty should be kept in sync with the |
3200 // booleans that are cleared below. | 3181 // booleans that are cleared below. |
3201 ASSERT(paintInvalidationState.ancestorHadPaintInvalidationForLocationChange(
) || paintInvalidationStateIsDirty()); | 3182 ASSERT(paintInvalidationState.ancestorHadPaintInvalidationForLocationChange(
) || paintInvalidationStateIsDirty()); |
3202 clearShouldDoFullPaintInvalidation(); | 3183 clearShouldDoFullPaintInvalidation(); |
3203 setNeededLayoutBecauseOfChildren(false); | 3184 m_bitfields.setChildShouldCheckForPaintInvalidation(false); |
3204 setShouldInvalidateOverflowForPaint(false); | 3185 m_bitfields.setNeededLayoutBecauseOfChildren(false); |
3205 clearLayoutDidGetCalledSinceLastFrame(); | 3186 m_bitfields.setShouldInvalidateOverflowForPaint(false); |
3206 clearMayNeedPaintInvalidation(); | 3187 m_bitfields.setMayNeedPaintInvalidation(false); |
3207 clearShouldInvalidateSelection(); | 3188 m_bitfields.setShouldInvalidateSelection(false); |
3208 } | 3189 } |
3209 | 3190 |
3210 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) | 3191 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) |
3211 { | 3192 { |
3212 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre
eStateInAnyState() | 3193 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre
eStateInAnyState() |
3213 || document.lifecycle().stateAllowsLayoutTreeMutations(); | 3194 || document.lifecycle().stateAllowsLayoutTreeMutations(); |
3214 } | 3195 } |
3215 | 3196 |
3216 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout
TreeStructureAsserts() | 3197 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout
TreeStructureAsserts() |
3217 : m_disabler(gModifyLayoutTreeStructureAnyState, true) | 3198 : m_disabler(gModifyLayoutTreeStructureAnyState, true) |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 const blink::LayoutObject* root = object1; | 3384 const blink::LayoutObject* root = object1; |
3404 while (root->parent()) | 3385 while (root->parent()) |
3405 root = root->parent(); | 3386 root = root->parent(); |
3406 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3387 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3407 } else { | 3388 } else { |
3408 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3389 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3409 } | 3390 } |
3410 } | 3391 } |
3411 | 3392 |
3412 #endif | 3393 #endif |
OLD | NEW |