| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #include "wtf/StdLibExtras.h" | 90 #include "wtf/StdLibExtras.h" |
| 91 #include "wtf/text/CString.h" | 91 #include "wtf/text/CString.h" |
| 92 | 92 |
| 93 namespace blink { | 93 namespace blink { |
| 94 | 94 |
| 95 namespace { | 95 namespace { |
| 96 | 96 |
| 97 static CompositingQueryMode gCompositingQueryMode = | 97 static CompositingQueryMode gCompositingQueryMode = |
| 98 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; | 98 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; |
| 99 | 99 |
| 100 struct SameSizeAsPaintLayer : DisplayItemClient { |
| 101 int bitFields; |
| 102 void* pointers[8]; |
| 103 LayoutUnit layoutUnits[4]; |
| 104 IntSize size; |
| 105 OwnPtrWillBePersistent<PaintLayerScrollableArea> scrollableArea; |
| 106 struct { |
| 107 IntRect rect; |
| 108 void* pointers[2]; |
| 109 } ancestorCompositingInputs; |
| 110 struct { |
| 111 void* pointers[2]; |
| 112 } clipper; |
| 113 struct { |
| 114 IntSize size; |
| 115 void* pointer; |
| 116 LayoutRect rect; |
| 117 } previousPaintStatus; |
| 118 }; |
| 119 |
| 120 static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer), "PaintLayer sh
ould stay small"); |
| 121 |
| 100 } // namespace | 122 } // namespace |
| 101 | 123 |
| 102 using namespace HTMLNames; | 124 using namespace HTMLNames; |
| 103 | 125 |
| 126 PaintLayerRareData::PaintLayerRareData() |
| 127 : enclosingPaginationLayer(nullptr) |
| 128 , potentialCompositingReasonsFromStyle(CompositingReasonNone) |
| 129 , compositingReasons(CompositingReasonNone) |
| 130 , groupedMapping(nullptr) |
| 131 { |
| 132 } |
| 133 |
| 134 PaintLayerRareData::~PaintLayerRareData() |
| 135 { |
| 136 } |
| 137 |
| 104 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject, PaintLayerType type) | 138 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject, PaintLayerType type) |
| 105 : m_layerType(type) | 139 : m_layerType(type) |
| 106 , m_hasSelfPaintingLayerDescendant(false) | 140 , m_hasSelfPaintingLayerDescendant(false) |
| 107 , m_hasSelfPaintingLayerDescendantDirty(false) | 141 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 108 , m_isRootLayer(layoutObject->isLayoutView()) | 142 , m_isRootLayer(layoutObject->isLayoutView()) |
| 109 , m_visibleContentStatusDirty(true) | 143 , m_visibleContentStatusDirty(true) |
| 110 , m_hasVisibleContent(false) | 144 , m_hasVisibleContent(false) |
| 111 , m_visibleDescendantStatusDirty(false) | 145 , m_visibleDescendantStatusDirty(false) |
| 112 , m_hasVisibleDescendant(false) | 146 , m_hasVisibleDescendant(false) |
| 113 , m_hasVisibleNonLayerContent(false) | 147 , m_hasVisibleNonLayerContent(false) |
| 114 #if ENABLE(ASSERT) | 148 #if ENABLE(ASSERT) |
| 115 , m_needsPositionUpdate(true) | 149 , m_needsPositionUpdate(true) |
| 116 #endif | 150 #endif |
| 117 , m_3DTransformedDescendantStatusDirty(true) | 151 , m_3DTransformedDescendantStatusDirty(true) |
| 118 , m_has3DTransformedDescendant(false) | 152 , m_has3DTransformedDescendant(false) |
| 119 , m_containsDirtyOverlayScrollbars(false) | 153 , m_containsDirtyOverlayScrollbars(false) |
| 120 , m_hasFilterInfo(false) | 154 , m_hasFilterInfo(false) |
| 121 , m_needsAncestorDependentCompositingInputsUpdate(true) | 155 , m_needsAncestorDependentCompositingInputsUpdate(true) |
| 122 , m_needsDescendantDependentCompositingInputsUpdate(true) | 156 , m_needsDescendantDependentCompositingInputsUpdate(true) |
| 123 , m_childNeedsCompositingInputsUpdate(true) | 157 , m_childNeedsCompositingInputsUpdate(true) |
| 124 , m_hasCompositingDescendant(false) | 158 , m_hasCompositingDescendant(false) |
| 125 , m_hasNonCompositedChild(false) | 159 , m_hasNonCompositedChild(false) |
| 126 , m_shouldIsolateCompositedDescendants(false) | 160 , m_shouldIsolateCompositedDescendants(false) |
| 127 , m_lostGroupedMapping(false) | 161 , m_lostGroupedMapping(false) |
| 128 , m_needsRepaint(false) | 162 , m_needsRepaint(false) |
| 129 , m_previousPaintResult(PaintLayerPainter::FullyPainted) | 163 , m_previousPaintResult(PaintLayerPainter::FullyPainted) |
| 130 , m_needsPaintPhaseDescendantOutlines(false) | 164 , m_needsPaintPhaseDescendantOutlines(false) |
| 165 , m_hasDescendantWithClipPath(false) |
| 166 , m_hasNonIsolatedDescendantWithBlendMode(false) |
| 167 , m_hasAncestorWithClipPath(false) |
| 131 , m_layoutObject(layoutObject) | 168 , m_layoutObject(layoutObject) |
| 132 , m_parent(0) | 169 , m_parent(0) |
| 133 , m_previous(0) | 170 , m_previous(0) |
| 134 , m_next(0) | 171 , m_next(0) |
| 135 , m_first(0) | 172 , m_first(0) |
| 136 , m_last(0) | 173 , m_last(0) |
| 137 , m_staticInlinePosition(0) | 174 , m_staticInlinePosition(0) |
| 138 , m_staticBlockPosition(0) | 175 , m_staticBlockPosition(0) |
| 139 , m_enclosingPaginationLayer(0) | |
| 140 , m_potentialCompositingReasonsFromStyle(CompositingReasonNone) | |
| 141 , m_compositingReasons(CompositingReasonNone) | |
| 142 , m_groupedMapping(0) | |
| 143 , m_clipper(*layoutObject) | 176 , m_clipper(*layoutObject) |
| 144 { | 177 { |
| 145 updateStackingNode(); | 178 updateStackingNode(); |
| 146 | 179 |
| 147 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 180 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
| 148 | 181 |
| 149 if (!layoutObject->slowFirstChild() && layoutObject->style()) { | 182 if (!layoutObject->slowFirstChild() && layoutObject->style()) { |
| 150 m_visibleContentStatusDirty = false; | 183 m_visibleContentStatusDirty = false; |
| 151 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; | 184 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; |
| 152 } | 185 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 166 if (groupedMapping()) { | 199 if (groupedMapping()) { |
| 167 DisableCompositingQueryAsserts disabler; | 200 DisableCompositingQueryAsserts disabler; |
| 168 setGroupedMapping(0, InvalidateLayerAndRemoveFromMapping); | 201 setGroupedMapping(0, InvalidateLayerAndRemoveFromMapping); |
| 169 } | 202 } |
| 170 | 203 |
| 171 // Child layers will be deleted by their corresponding layout objects, so | 204 // Child layers will be deleted by their corresponding layout objects, so |
| 172 // we don't need to delete them ourselves. | 205 // we don't need to delete them ourselves. |
| 173 | 206 |
| 174 clearCompositedLayerMapping(true); | 207 clearCompositedLayerMapping(true); |
| 175 | 208 |
| 176 if (m_reflectionInfo) | 209 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) |
| 177 m_reflectionInfo->destroy(); | 210 reflectionInfo->destroy(); |
| 178 | 211 |
| 179 if (m_scrollableArea) | 212 if (m_scrollableArea) |
| 180 m_scrollableArea->dispose(); | 213 m_scrollableArea->dispose(); |
| 181 } | 214 } |
| 182 | 215 |
| 183 String PaintLayer::debugName() const | 216 String PaintLayer::debugName() const |
| 184 { | 217 { |
| 185 if (isReflection()) | 218 if (isReflection()) |
| 186 return layoutObject()->parent()->debugName() + " (reflection)"; | 219 return layoutObject()->parent()->debugName() + " (reflection)"; |
| 187 return layoutObject()->debugName(); | 220 return layoutObject()->debugName(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 212 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); | 245 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); |
| 213 | 246 |
| 214 // Although we're missing test coverage, we need to call | 247 // Although we're missing test coverage, we need to call |
| 215 // GraphicsLayer::setContentsToPlatformLayer with the new platform | 248 // GraphicsLayer::setContentsToPlatformLayer with the new platform |
| 216 // layer for this canvas. | 249 // layer for this canvas. |
| 217 // See http://crbug.com/349195 | 250 // See http://crbug.com/349195 |
| 218 if (hasCompositedLayerMapping()) | 251 if (hasCompositedLayerMapping()) |
| 219 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerU
pdateSubtree); | 252 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerU
pdateSubtree); |
| 220 } | 253 } |
| 221 | 254 |
| 222 if (m_compositedLayerMapping) | 255 if (CompositedLayerMapping* compositedLayerMapping = this->compositedLayerMa
pping()) |
| 223 m_compositedLayerMapping->contentChanged(changeType); | 256 compositedLayerMapping->contentChanged(changeType); |
| 224 } | 257 } |
| 225 | 258 |
| 226 bool PaintLayer::paintsWithFilters() const | 259 bool PaintLayer::paintsWithFilters() const |
| 227 { | 260 { |
| 228 if (!layoutObject()->hasFilter()) | 261 if (!layoutObject()->hasFilter()) |
| 229 return false; | 262 return false; |
| 230 | 263 |
| 231 // https://code.google.com/p/chromium/issues/detail?id=343759 | 264 // https://code.google.com/p/chromium/issues/detail?id=343759 |
| 232 DisableCompositingQueryAsserts disabler; | 265 DisableCompositingQueryAsserts disabler; |
| 233 return !m_compositedLayerMapping || compositingState() != PaintsIntoOwnBacki
ng; | 266 return !compositedLayerMapping() || compositingState() != PaintsIntoOwnBacki
ng; |
| 234 } | 267 } |
| 235 | 268 |
| 236 bool PaintLayer::paintsWithBackdropFilters() const | 269 bool PaintLayer::paintsWithBackdropFilters() const |
| 237 { | 270 { |
| 238 if (!layoutObject()->hasBackdropFilter()) | 271 if (!layoutObject()->hasBackdropFilter()) |
| 239 return false; | 272 return false; |
| 240 | 273 |
| 241 // https://code.google.com/p/chromium/issues/detail?id=343759 | 274 // https://code.google.com/p/chromium/issues/detail?id=343759 |
| 242 DisableCompositingQueryAsserts disabler; | 275 DisableCompositingQueryAsserts disabler; |
| 243 return !m_compositedLayerMapping || compositingState() != PaintsIntoOwnBacki
ng; | 276 return !compositedLayerMapping() || compositingState() != PaintsIntoOwnBacki
ng; |
| 244 } | 277 } |
| 245 | 278 |
| 246 LayoutSize PaintLayer::subpixelAccumulation() const | 279 LayoutSize PaintLayer::subpixelAccumulation() const |
| 247 { | 280 { |
| 248 return m_subpixelAccumulation; | 281 return m_rareData ? m_rareData->subpixelAccumulation : LayoutSize(); |
| 249 } | 282 } |
| 250 | 283 |
| 251 void PaintLayer::setSubpixelAccumulation(const LayoutSize& size) | 284 void PaintLayer::setSubpixelAccumulation(const LayoutSize& size) |
| 252 { | 285 { |
| 253 m_subpixelAccumulation = size; | 286 if (m_rareData || !size.isZero()) |
| 287 ensureRareData().subpixelAccumulation = size; |
| 254 } | 288 } |
| 255 | 289 |
| 256 void PaintLayer::updateLayerPositionsAfterLayout() | 290 void PaintLayer::updateLayerPositionsAfterLayout() |
| 257 { | 291 { |
| 258 TRACE_EVENT0("blink,benchmark", "PaintLayer::updateLayerPositionsAfterLayout
"); | 292 TRACE_EVENT0("blink,benchmark", "PaintLayer::updateLayerPositionsAfterLayout
"); |
| 259 | 293 |
| 260 m_clipper.clearClipRectsIncludingDescendants(); | 294 m_clipper.clearClipRectsIncludingDescendants(); |
| 261 updateLayerPositionRecursive(); | 295 updateLayerPositionRecursive(); |
| 262 | 296 |
| 263 { | 297 { |
| 264 // FIXME: Remove incremental compositing updates after fixing the chicke
n/egg issues | 298 // FIXME: Remove incremental compositing updates after fixing the chicke
n/egg issues |
| 265 // https://code.google.com/p/chromium/issues/detail?id=343756 | 299 // https://code.google.com/p/chromium/issues/detail?id=343756 |
| 266 DisableCompositingQueryAsserts disabler; | 300 DisableCompositingQueryAsserts disabler; |
| 267 updatePaginationRecursive(enclosingPaginationLayer()); | 301 updatePaginationRecursive(enclosingPaginationLayer()); |
| 268 } | 302 } |
| 269 } | 303 } |
| 270 | 304 |
| 271 void PaintLayer::updateLayerPositionRecursive() | 305 void PaintLayer::updateLayerPositionRecursive() |
| 272 { | 306 { |
| 273 updateLayerPosition(); | 307 updateLayerPosition(); |
| 274 | 308 |
| 275 if (m_reflectionInfo) | 309 if (m_rareData && m_rareData->reflectionInfo) |
| 276 m_reflectionInfo->reflection()->layout(); | 310 m_rareData->reflectionInfo->reflection()->layout(); |
| 277 | 311 |
| 278 // FIXME(400589): We would like to do this in PaintLayerScrollableArea::upda
teAfterLayout, | 312 // FIXME(400589): We would like to do this in PaintLayerScrollableArea::upda
teAfterLayout, |
| 279 // but it depends on the size computed by updateLayerPosition. | 313 // but it depends on the size computed by updateLayerPosition. |
| 280 if (m_scrollableArea) { | 314 if (m_scrollableArea) { |
| 281 if (ScrollAnimatorBase* scrollAnimator = m_scrollableArea->existingScrol
lAnimator()) | 315 if (ScrollAnimatorBase* scrollAnimator = m_scrollableArea->existingScrol
lAnimator()) |
| 282 scrollAnimator->updateAfterLayout(); | 316 scrollAnimator->updateAfterLayout(); |
| 283 } | 317 } |
| 284 | 318 |
| 285 // FIXME: We should be able to remove this call because we don't care about | 319 // FIXME: We should be able to remove this call because we don't care about |
| 286 // any descendant-dependent flags, but code somewhere else is reading these | 320 // any descendant-dependent flags, but code somewhere else is reading these |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 m_layoutObject->adjustPreviousPaintInvalidationForScrollIfNeeded(scrollD
elta); | 384 m_layoutObject->adjustPreviousPaintInvalidationForScrollIfNeeded(scrollD
elta); |
| 351 } | 385 } |
| 352 for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
{ | 386 for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
{ |
| 353 child->updateLayerPositionsAfterScrollRecursive(scrollDelta, | 387 child->updateLayerPositionsAfterScrollRecursive(scrollDelta, |
| 354 paintInvalidationContainerWasScrolled && !child->isPaintInvalidation
Container()); | 388 paintInvalidationContainerWasScrolled && !child->isPaintInvalidation
Container()); |
| 355 } | 389 } |
| 356 } | 390 } |
| 357 | 391 |
| 358 void PaintLayer::updateTransformationMatrix() | 392 void PaintLayer::updateTransformationMatrix() |
| 359 { | 393 { |
| 360 if (m_transform) { | 394 if (TransformationMatrix* transform = this->transform()) { |
| 361 LayoutBox* box = layoutBox(); | 395 LayoutBox* box = layoutBox(); |
| 362 ASSERT(box); | 396 ASSERT(box); |
| 363 m_transform->makeIdentity(); | 397 transform->makeIdentity(); |
| 364 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS
ize()), ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath,
ComputedStyle::IncludeIndependentTransformProperties); | 398 box->style()->applyTransform(*transform, LayoutSize(box->pixelSnappedSiz
e()), ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath, C
omputedStyle::IncludeIndependentTransformProperties); |
| 365 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi
ng()); | 399 makeMatrixRenderable(*transform, compositor()->hasAcceleratedCompositing
()); |
| 366 } | 400 } |
| 367 } | 401 } |
| 368 | 402 |
| 369 void PaintLayer::updateTransform(const ComputedStyle* oldStyle, const ComputedSt
yle& newStyle) | 403 void PaintLayer::updateTransform(const ComputedStyle* oldStyle, const ComputedSt
yle& newStyle) |
| 370 { | 404 { |
| 371 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle)) | 405 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle)) |
| 372 return; | 406 return; |
| 373 | 407 |
| 374 // hasTransform() on the layoutObject is also true when there is transform-s
tyle: preserve-3d or perspective set, | 408 // hasTransform() on the layoutObject is also true when there is transform-s
tyle: preserve-3d or perspective set, |
| 375 // so check style too. | 409 // so check style too. |
| 376 bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyl
e.hasTransform(); | 410 bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyl
e.hasTransform(); |
| 377 bool had3DTransform = has3DTransform(); | 411 bool had3DTransform = has3DTransform(); |
| 378 | 412 |
| 379 bool hadTransform = m_transform; | 413 bool hadTransform = transform(); |
| 380 if (hasTransform != hadTransform) { | 414 if (hasTransform != hadTransform) { |
| 381 if (hasTransform) | 415 if (hasTransform) |
| 382 m_transform = adoptPtr(new TransformationMatrix); | 416 ensureRareData().transform = adoptPtr(new TransformationMatrix); |
| 383 else | 417 else |
| 384 m_transform.clear(); | 418 m_rareData->transform.clear(); |
| 385 | 419 |
| 386 // PaintLayers with transforms act as clip rects roots, so clear the cac
hed clip rects here. | 420 // PaintLayers with transforms act as clip rects roots, so clear the cac
hed clip rects here. |
| 387 m_clipper.clearClipRectsIncludingDescendants(); | 421 m_clipper.clearClipRectsIncludingDescendants(); |
| 388 } else if (hasTransform) { | 422 } else if (hasTransform) { |
| 389 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects); | 423 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects); |
| 390 } | 424 } |
| 391 | 425 |
| 392 updateTransformationMatrix(); | 426 updateTransformationMatrix(); |
| 393 | 427 |
| 394 if (had3DTransform != has3DTransform()) | 428 if (had3DTransform != has3DTransform()) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 410 renderingContext = this; | 444 renderingContext = this; |
| 411 | 445 |
| 412 for (PaintLayer* current = enclosingLayerForContainingBlock(this); current &
& current->shouldPreserve3D(); current = enclosingLayerForContainingBlock(curren
t)) | 446 for (PaintLayer* current = enclosingLayerForContainingBlock(this); current &
& current->shouldPreserve3D(); current = enclosingLayerForContainingBlock(curren
t)) |
| 413 renderingContext = current; | 447 renderingContext = current; |
| 414 | 448 |
| 415 return renderingContext; | 449 return renderingContext; |
| 416 } | 450 } |
| 417 | 451 |
| 418 TransformationMatrix PaintLayer::currentTransform() const | 452 TransformationMatrix PaintLayer::currentTransform() const |
| 419 { | 453 { |
| 420 if (!m_transform) | 454 if (TransformationMatrix* transform = this->transform()) |
| 421 return TransformationMatrix(); | 455 return *transform; |
| 422 return *m_transform; | 456 return TransformationMatrix(); |
| 423 } | 457 } |
| 424 | 458 |
| 425 TransformationMatrix PaintLayer::renderableTransform(GlobalPaintFlags globalPain
tFlags) const | 459 TransformationMatrix PaintLayer::renderableTransform(GlobalPaintFlags globalPain
tFlags) const |
| 426 { | 460 { |
| 427 if (!m_transform) | 461 TransformationMatrix* transform = this->transform(); |
| 462 if (!transform) |
| 428 return TransformationMatrix(); | 463 return TransformationMatrix(); |
| 429 | 464 |
| 430 if (globalPaintFlags & GlobalPaintFlattenCompositingLayers) { | 465 if (globalPaintFlags & GlobalPaintFlattenCompositingLayers) { |
| 431 TransformationMatrix matrix = *m_transform; | 466 TransformationMatrix matrix = *transform; |
| 432 makeMatrixRenderable(matrix, false /* flatten 3d */); | 467 makeMatrixRenderable(matrix, false /* flatten 3d */); |
| 433 return matrix; | 468 return matrix; |
| 434 } | 469 } |
| 435 | 470 |
| 436 return *m_transform; | 471 return *transform; |
| 437 } | 472 } |
| 438 | 473 |
| 439 void PaintLayer::convertFromFlowThreadToVisualBoundingBoxInAncestor(const PaintL
ayer* ancestorLayer, LayoutRect& rect) const | 474 void PaintLayer::convertFromFlowThreadToVisualBoundingBoxInAncestor(const PaintL
ayer* ancestorLayer, LayoutRect& rect) const |
| 440 { | 475 { |
| 441 PaintLayer* paginationLayer = enclosingPaginationLayer(); | 476 PaintLayer* paginationLayer = enclosingPaginationLayer(); |
| 442 ASSERT(paginationLayer); | 477 ASSERT(paginationLayer); |
| 443 LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObj
ect()); | 478 LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObj
ect()); |
| 444 | 479 |
| 445 // First make the flow thread rectangle relative to the flow thread, not to
|layer|. | 480 // First make the flow thread rectangle relative to the flow thread, not to
|layer|. |
| 446 LayoutPoint offsetWithinPaginationLayer; | 481 LayoutPoint offsetWithinPaginationLayer; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 457 rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); | 492 rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); |
| 458 return; | 493 return; |
| 459 } | 494 } |
| 460 // The ancestor layer is inside the same pagination layer as |layer|, so we
need to subtract | 495 // The ancestor layer is inside the same pagination layer as |layer|, so we
need to subtract |
| 461 // the visual distance from the ancestor layer to the pagination layer. | 496 // the visual distance from the ancestor layer to the pagination layer. |
| 462 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); | 497 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); |
| 463 } | 498 } |
| 464 | 499 |
| 465 void PaintLayer::updatePaginationRecursive(bool needsPaginationUpdate) | 500 void PaintLayer::updatePaginationRecursive(bool needsPaginationUpdate) |
| 466 { | 501 { |
| 467 m_enclosingPaginationLayer = 0; | 502 if (m_rareData) |
| 503 m_rareData->enclosingPaginationLayer = nullptr; |
| 468 | 504 |
| 469 if (layoutObject()->isLayoutFlowThread()) | 505 if (layoutObject()->isLayoutFlowThread()) |
| 470 needsPaginationUpdate = true; | 506 needsPaginationUpdate = true; |
| 471 | 507 |
| 472 if (needsPaginationUpdate) { | 508 if (needsPaginationUpdate) { |
| 473 // Each paginated layer has to paint on its own. There is no recurring i
nto child layers. Each | 509 // Each paginated layer has to paint on its own. There is no recurring i
nto child layers. Each |
| 474 // layer has to be checked individually and genuinely know if it is goin
g to have to split | 510 // layer has to be checked individually and genuinely know if it is goin
g to have to split |
| 475 // itself up when painting only its contents (and not any other descenda
nt layers). We track an | 511 // itself up when painting only its contents (and not any other descenda
nt layers). We track an |
| 476 // enclosingPaginationLayer instead of using a simple bit, since we want
to be able to get back | 512 // enclosingPaginationLayer instead of using a simple bit, since we want
to be able to get back |
| 477 // to that layer easily. | 513 // to that layer easily. |
| 478 if (LayoutFlowThread* containingFlowThread = layoutObject()->flowThreadC
ontainingBlock()) | 514 if (LayoutFlowThread* containingFlowThread = layoutObject()->flowThreadC
ontainingBlock()) |
| 479 m_enclosingPaginationLayer = containingFlowThread->layer(); | 515 ensureRareData().enclosingPaginationLayer = containingFlowThread->la
yer(); |
| 480 } | 516 } |
| 481 | 517 |
| 482 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | 518 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) |
| 483 child->updatePaginationRecursive(needsPaginationUpdate); | 519 child->updatePaginationRecursive(needsPaginationUpdate); |
| 484 } | 520 } |
| 485 | 521 |
| 486 void PaintLayer::clearPaginationRecursive() | 522 void PaintLayer::clearPaginationRecursive() |
| 487 { | 523 { |
| 488 m_enclosingPaginationLayer = 0; | 524 if (m_rareData) |
| 525 m_rareData->enclosingPaginationLayer = nullptr; |
| 489 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | 526 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) |
| 490 child->clearPaginationRecursive(); | 527 child->clearPaginationRecursive(); |
| 491 } | 528 } |
| 492 | 529 |
| 493 LayoutPoint PaintLayer::positionFromPaintInvalidationBacking(const LayoutObject*
layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const Pai
ntInvalidationState* paintInvalidationState) | 530 LayoutPoint PaintLayer::positionFromPaintInvalidationBacking(const LayoutObject*
layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const Pai
ntInvalidationState* paintInvalidationState) |
| 494 { | 531 { |
| 495 FloatPoint point = layoutObject->localToAncestorPoint(FloatPoint(), paintInv
alidationContainer, 0, 0, paintInvalidationState); | 532 FloatPoint point = layoutObject->localToAncestorPoint(FloatPoint(), paintInv
alidationContainer, 0, 0, paintInvalidationState); |
| 496 | 533 |
| 497 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac
e. | 534 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac
e. |
| 498 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group
edMapping()) | 535 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group
edMapping()) |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 localPoint += offset; | 802 localPoint += offset; |
| 766 } | 803 } |
| 767 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { | 804 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { |
| 768 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); | 805 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); |
| 769 localPoint -= scrollOffset; | 806 localPoint -= scrollOffset; |
| 770 } | 807 } |
| 771 | 808 |
| 772 bool positionOrOffsetChanged = false; | 809 bool positionOrOffsetChanged = false; |
| 773 if (layoutObject()->isInFlowPositioned()) { | 810 if (layoutObject()->isInFlowPositioned()) { |
| 774 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); | 811 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); |
| 775 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition; | 812 positionOrOffsetChanged = newOffset != offsetForInFlowPosition(); |
| 776 m_offsetForInFlowPosition = newOffset; | 813 if (m_rareData || !newOffset.isZero()) |
| 777 localPoint.move(m_offsetForInFlowPosition); | 814 ensureRareData().offsetForInFlowPosition = newOffset; |
| 778 } else { | 815 localPoint.move(newOffset); |
| 779 m_offsetForInFlowPosition = LayoutSize(); | 816 } else if (m_rareData) { |
| 817 m_rareData->offsetForInFlowPosition = LayoutSize(); |
| 780 } | 818 } |
| 781 | 819 |
| 782 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the layoutObjects. | 820 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the layoutObjects. |
| 783 localPoint.moveBy(-inlineBoundingBoxOffset); | 821 localPoint.moveBy(-inlineBoundingBoxOffset); |
| 784 | 822 |
| 785 if (m_location != localPoint) { | 823 if (m_location != localPoint) { |
| 786 positionOrOffsetChanged = true; | 824 positionOrOffsetChanged = true; |
| 787 setNeedsRepaint(); | 825 setNeedsRepaint(); |
| 788 } | 826 } |
| 789 m_location = localPoint; | 827 m_location = localPoint; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 { | 901 { |
| 864 PaintLayer* curr = parent(); | 902 PaintLayer* curr = parent(); |
| 865 while (curr && !curr->isRootLayer() && !curr->layoutObject()->hasTransformRe
latedProperty()) | 903 while (curr && !curr->isRootLayer() && !curr->layoutObject()->hasTransformRe
latedProperty()) |
| 866 curr = curr->parent(); | 904 curr = curr->parent(); |
| 867 | 905 |
| 868 return curr; | 906 return curr; |
| 869 } | 907 } |
| 870 | 908 |
| 871 LayoutPoint PaintLayer::computeOffsetFromTransformedAncestor() const | 909 LayoutPoint PaintLayer::computeOffsetFromTransformedAncestor() const |
| 872 { | 910 { |
| 873 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); | |
| 874 | |
| 875 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 911 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
| 876 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip
are correct. | 912 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip
are correct. |
| 877 layoutObject()->mapLocalToAncestor(properties.transformAncestor ? properties
.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip); | 913 layoutObject()->mapLocalToAncestor(transformAncestor() ? transformAncestor()
->layoutObject() : nullptr, transformState, ApplyContainerFlip); |
| 878 transformState.flatten(); | 914 transformState.flatten(); |
| 879 return LayoutPoint(transformState.lastPlanarPoint()); | 915 return LayoutPoint(transformState.lastPlanarPoint()); |
| 880 } | 916 } |
| 881 | 917 |
| 882 PaintLayer* PaintLayer::compositingContainer() const | 918 PaintLayer* PaintLayer::compositingContainer() const |
| 883 { | 919 { |
| 884 if (!stackingNode()->isTreatedAsOrStackingContext()) | 920 if (!stackingNode()->isTreatedAsOrStackingContext()) |
| 885 return parent(); | 921 return parent(); |
| 886 if (PaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorS
tackingContextNode()) | 922 if (PaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorS
tackingContextNode()) |
| 887 return ancestorStackingNode->layer(); | 923 return ancestorStackingNode->layer(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 { | 984 { |
| 949 m_needsAncestorDependentCompositingInputsUpdate = true; | 985 m_needsAncestorDependentCompositingInputsUpdate = true; |
| 950 m_needsDescendantDependentCompositingInputsUpdate = true; | 986 m_needsDescendantDependentCompositingInputsUpdate = true; |
| 951 | 987 |
| 952 for (PaintLayer* current = this; current && !current->m_childNeedsCompositin
gInputsUpdate; current = current->parent()) | 988 for (PaintLayer* current = this; current && !current->m_childNeedsCompositin
gInputsUpdate; current = current->parent()) |
| 953 current->m_childNeedsCompositingInputsUpdate = true; | 989 current->m_childNeedsCompositingInputsUpdate = true; |
| 954 | 990 |
| 955 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInp
utChange); | 991 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInp
utChange); |
| 956 } | 992 } |
| 957 | 993 |
| 958 void PaintLayer::updateAncestorDependentCompositingInputs(const AncestorDependen
tCompositingInputs& compositingInputs) | 994 void PaintLayer::updateAncestorDependentCompositingInputs(const AncestorDependen
tCompositingInputs& compositingInputs, const RareAncestorDependentCompositingInp
uts& rareCompositingInputs, bool hasAncestorWithClipPath) |
| 959 { | 995 { |
| 960 m_ancestorDependentCompositingInputs = compositingInputs; | 996 m_ancestorDependentCompositingInputs = compositingInputs; |
| 997 if (rareCompositingInputs.isDefault()) |
| 998 m_rareAncestorDependentCompositingInputs.clear(); |
| 999 else |
| 1000 m_rareAncestorDependentCompositingInputs = adoptPtr(new RareAncestorDepe
ndentCompositingInputs(rareCompositingInputs)); |
| 1001 m_hasAncestorWithClipPath = hasAncestorWithClipPath; |
| 961 m_needsAncestorDependentCompositingInputsUpdate = false; | 1002 m_needsAncestorDependentCompositingInputsUpdate = false; |
| 962 } | 1003 } |
| 963 | 1004 |
| 964 void PaintLayer::updateDescendantDependentCompositingInputs(const DescendantDepe
ndentCompositingInputs& compositingInputs) | 1005 void PaintLayer::updateDescendantDependentCompositingInputs(bool hasDescendantWi
thClipPath, bool hasNonIsolatedDescendantWithBlendMode) |
| 965 { | 1006 { |
| 966 m_descendantDependentCompositingInputs = compositingInputs; | 1007 m_hasDescendantWithClipPath = hasDescendantWithClipPath; |
| 1008 m_hasNonIsolatedDescendantWithBlendMode = hasNonIsolatedDescendantWithBlendM
ode; |
| 967 m_needsDescendantDependentCompositingInputsUpdate = false; | 1009 m_needsDescendantDependentCompositingInputsUpdate = false; |
| 968 } | 1010 } |
| 969 | 1011 |
| 970 void PaintLayer::didUpdateCompositingInputs() | 1012 void PaintLayer::didUpdateCompositingInputs() |
| 971 { | 1013 { |
| 972 ASSERT(!needsCompositingInputsUpdate()); | 1014 ASSERT(!needsCompositingInputsUpdate()); |
| 973 m_childNeedsCompositingInputsUpdate = false; | 1015 m_childNeedsCompositingInputsUpdate = false; |
| 974 if (m_scrollableArea) | 1016 if (m_scrollableArea) |
| 975 m_scrollableArea->updateNeedsCompositedScrolling(); | 1017 m_scrollableArea->updateNeedsCompositedScrolling(); |
| 976 } | 1018 } |
| 977 | 1019 |
| 978 bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const | 1020 bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const |
| 979 { | 1021 { |
| 980 if (descendantDependentCompositingInputs().hasNonIsolatedDescendantWithBlend
Mode) | 1022 ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); |
| 1023 if (m_hasNonIsolatedDescendantWithBlendMode) |
| 981 return true; | 1024 return true; |
| 982 if (layoutObject()->isSVGRoot()) | 1025 if (layoutObject()->isSVGRoot()) |
| 983 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendant
s(); | 1026 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendant
s(); |
| 984 return false; | 1027 return false; |
| 985 } | 1028 } |
| 986 | 1029 |
| 987 void PaintLayer::setCompositingReasons(CompositingReasons reasons, CompositingRe
asons mask) | 1030 void PaintLayer::setCompositingReasons(CompositingReasons reasons, CompositingRe
asons mask) |
| 988 { | 1031 { |
| 989 if ((compositingReasons() & mask) == (reasons & mask)) | 1032 CompositingReasons oldReasons = m_rareData ? m_rareData->compositingReasons
: CompositingReasonNone; |
| 1033 if ((oldReasons & mask) == (reasons & mask)) |
| 990 return; | 1034 return; |
| 991 m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask); | 1035 CompositingReasons newReasons = (reasons & mask) | (oldReasons & ~mask); |
| 1036 if (m_rareData || newReasons != CompositingReasonNone) |
| 1037 ensureRareData().compositingReasons = newReasons; |
| 992 } | 1038 } |
| 993 | 1039 |
| 994 void PaintLayer::setHasCompositingDescendant(bool hasCompositingDescendant) | 1040 void PaintLayer::setHasCompositingDescendant(bool hasCompositingDescendant) |
| 995 { | 1041 { |
| 996 if (m_hasCompositingDescendant == static_cast<unsigned>(hasCompositingDescen
dant)) | 1042 if (m_hasCompositingDescendant == static_cast<unsigned>(hasCompositingDescen
dant)) |
| 997 return; | 1043 return; |
| 998 | 1044 |
| 999 m_hasCompositingDescendant = hasCompositingDescendant; | 1045 m_hasCompositingDescendant = hasCompositingDescendant; |
| 1000 | 1046 |
| 1001 if (hasCompositedLayerMapping()) | 1047 if (hasCompositedLayerMapping()) |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit
ingDescendants(); | 1268 layoutObject()->setShouldDoFullPaintInvalidationIncludingNonComposit
ingDescendants(); |
| 1223 } | 1269 } |
| 1224 } | 1270 } |
| 1225 | 1271 |
| 1226 m_clipper.clearClipRectsIncludingDescendants(); | 1272 m_clipper.clearClipRectsIncludingDescendants(); |
| 1227 | 1273 |
| 1228 PaintLayer* nextSib = nextSibling(); | 1274 PaintLayer* nextSib = nextSibling(); |
| 1229 | 1275 |
| 1230 // Remove the child reflection layer before moving other child layers. | 1276 // Remove the child reflection layer before moving other child layers. |
| 1231 // The reflection layer should not be moved to the parent. | 1277 // The reflection layer should not be moved to the parent. |
| 1232 if (m_reflectionInfo) | 1278 if (PaintLayerReflectionInfo* reflectionInfo = this->reflectionInfo()) |
| 1233 removeChild(m_reflectionInfo->reflectionLayer()); | 1279 removeChild(reflectionInfo->reflectionLayer()); |
| 1234 | 1280 |
| 1235 // Now walk our kids and reattach them to our parent. | 1281 // Now walk our kids and reattach them to our parent. |
| 1236 PaintLayer* current = m_first; | 1282 PaintLayer* current = m_first; |
| 1237 while (current) { | 1283 while (current) { |
| 1238 PaintLayer* next = current->nextSibling(); | 1284 PaintLayer* next = current->nextSibling(); |
| 1239 removeChild(current); | 1285 removeChild(current); |
| 1240 m_parent->addChild(current, nextSib); | 1286 m_parent->addChild(current, nextSib); |
| 1241 | 1287 |
| 1242 // FIXME: We should call a specialized version of this function. | 1288 // FIXME: We should call a specialized version of this function. |
| 1243 current->updateLayerPositionsAfterLayout(); | 1289 current->updateLayerPositionsAfterLayout(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 | 1412 |
| 1367 void PaintLayer::didUpdateNeedsCompositedScrolling() | 1413 void PaintLayer::didUpdateNeedsCompositedScrolling() |
| 1368 { | 1414 { |
| 1369 updateSelfPaintingLayer(); | 1415 updateSelfPaintingLayer(); |
| 1370 } | 1416 } |
| 1371 | 1417 |
| 1372 void PaintLayer::updateReflectionInfo(const ComputedStyle* oldStyle) | 1418 void PaintLayer::updateReflectionInfo(const ComputedStyle* oldStyle) |
| 1373 { | 1419 { |
| 1374 ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldSt
yle)); | 1420 ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldSt
yle)); |
| 1375 if (layoutObject()->hasReflection()) { | 1421 if (layoutObject()->hasReflection()) { |
| 1376 if (!m_reflectionInfo) | 1422 ensureRareData().reflectionInfo = adoptPtr(new PaintLayerReflectionInfo(
*layoutBox())); |
| 1377 m_reflectionInfo = adoptPtr(new PaintLayerReflectionInfo(*layoutBox(
))); | 1423 m_rareData->reflectionInfo->updateAfterStyleChange(oldStyle); |
| 1378 m_reflectionInfo->updateAfterStyleChange(oldStyle); | 1424 } else if (m_rareData && m_rareData->reflectionInfo) { |
| 1379 } else if (m_reflectionInfo) { | 1425 m_rareData->reflectionInfo->destroy(); |
| 1380 m_reflectionInfo->destroy(); | 1426 m_rareData->reflectionInfo = nullptr; |
| 1381 m_reflectionInfo = nullptr; | |
| 1382 } | 1427 } |
| 1383 } | 1428 } |
| 1384 | 1429 |
| 1385 void PaintLayer::updateStackingNode() | 1430 void PaintLayer::updateStackingNode() |
| 1386 { | 1431 { |
| 1387 ASSERT(!m_stackingNode); | 1432 ASSERT(!m_stackingNode); |
| 1388 if (requiresStackingNode()) | 1433 if (requiresStackingNode()) |
| 1389 m_stackingNode = adoptPtr(new PaintLayerStackingNode(this)); | 1434 m_stackingNode = adoptPtr(new PaintLayerStackingNode(this)); |
| 1390 else | 1435 else |
| 1391 m_stackingNode = nullptr; | 1436 m_stackingNode = nullptr; |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2061 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2017 return; | 2062 return; |
| 2018 | 2063 |
| 2019 setNeedsCompositingInputsUpdate(); | 2064 setNeedsCompositingInputsUpdate(); |
| 2020 } | 2065 } |
| 2021 | 2066 |
| 2022 void PaintLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) | 2067 void PaintLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) |
| 2023 { | 2068 { |
| 2024 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | 2069 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) |
| 2025 return; | 2070 return; |
| 2026 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); | 2071 if (!bounds.isEmpty()) |
| 2072 ensureRareData().blockSelectionGapsBounds.unite(enclosingIntRect(bounds)
); |
| 2027 blockSelectionGapsBoundsChanged(); | 2073 blockSelectionGapsBoundsChanged(); |
| 2028 } | 2074 } |
| 2029 | 2075 |
| 2030 void PaintLayer::clearBlockSelectionGapsBounds() | 2076 void PaintLayer::clearBlockSelectionGapsBounds() |
| 2031 { | 2077 { |
| 2032 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | 2078 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) |
| 2033 return; | 2079 return; |
| 2034 m_blockSelectionGapsBounds = IntRect(); | 2080 if (m_rareData) |
| 2081 m_rareData->blockSelectionGapsBounds = IntRect(); |
| 2035 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | 2082 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) |
| 2036 child->clearBlockSelectionGapsBounds(); | 2083 child->clearBlockSelectionGapsBounds(); |
| 2037 blockSelectionGapsBoundsChanged(); | 2084 blockSelectionGapsBoundsChanged(); |
| 2038 } | 2085 } |
| 2039 | 2086 |
| 2040 void PaintLayer::invalidatePaintForBlockSelectionGaps() | 2087 void PaintLayer::invalidatePaintForBlockSelectionGaps() |
| 2041 { | 2088 { |
| 2042 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | 2089 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) |
| 2043 return; | 2090 return; |
| 2044 | 2091 |
| 2045 for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
{ | 2092 for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
{ |
| 2046 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 | 2093 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 |
| 2047 DisablePaintInvalidationStateAsserts disabler; | 2094 DisablePaintInvalidationStateAsserts disabler; |
| 2048 child->invalidatePaintForBlockSelectionGaps(); | 2095 child->invalidatePaintForBlockSelectionGaps(); |
| 2049 } | 2096 } |
| 2050 | 2097 |
| 2051 if (m_blockSelectionGapsBounds.isEmpty()) | 2098 if (!m_rareData || m_rareData->blockSelectionGapsBounds.isEmpty()) |
| 2052 return; | 2099 return; |
| 2053 | 2100 |
| 2054 LayoutRect rect(m_blockSelectionGapsBounds); | 2101 LayoutRect rect(m_rareData->blockSelectionGapsBounds); |
| 2055 if (layoutObject()->hasOverflowClip()) { | 2102 if (layoutObject()->hasOverflowClip()) { |
| 2056 LayoutBox* box = layoutBox(); | 2103 LayoutBox* box = layoutBox(); |
| 2057 rect.move(-box->scrolledContentOffset()); | 2104 rect.move(-box->scrolledContentOffset()); |
| 2058 if (!scrollableArea()->usesCompositedScrolling()) | 2105 if (!scrollableArea()->usesCompositedScrolling()) |
| 2059 rect.intersect(box->overflowClipRect(LayoutPoint())); | 2106 rect.intersect(box->overflowClipRect(LayoutPoint())); |
| 2060 } | 2107 } |
| 2061 if (layoutObject()->hasClip()) | 2108 if (layoutObject()->hasClip()) |
| 2062 rect.intersect(toLayoutBox(layoutObject())->clipRect(LayoutPoint())); | 2109 rect.intersect(toLayoutBox(layoutObject())->clipRect(LayoutPoint())); |
| 2063 if (!rect.isEmpty()) { | 2110 if (!rect.isEmpty()) { |
| 2064 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 | 2111 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 return result; | 2309 return result; |
| 2263 } | 2310 } |
| 2264 | 2311 |
| 2265 CompositingState PaintLayer::compositingState() const | 2312 CompositingState PaintLayer::compositingState() const |
| 2266 { | 2313 { |
| 2267 ASSERT(isAllowedToQueryCompositingState()); | 2314 ASSERT(isAllowedToQueryCompositingState()); |
| 2268 | 2315 |
| 2269 // This is computed procedurally so there is no redundant state variable tha
t | 2316 // This is computed procedurally so there is no redundant state variable tha
t |
| 2270 // can get out of sync from the real actual compositing state. | 2317 // can get out of sync from the real actual compositing state. |
| 2271 | 2318 |
| 2272 if (m_groupedMapping) { | 2319 if (groupedMapping()) { |
| 2273 ASSERT(!m_compositedLayerMapping); | 2320 ASSERT(!compositedLayerMapping()); |
| 2274 return PaintsIntoGroupedBacking; | 2321 return PaintsIntoGroupedBacking; |
| 2275 } | 2322 } |
| 2276 | 2323 |
| 2277 if (!m_compositedLayerMapping) | 2324 if (!compositedLayerMapping()) |
| 2278 return NotComposited; | 2325 return NotComposited; |
| 2279 | 2326 |
| 2280 return PaintsIntoOwnBacking; | 2327 return PaintsIntoOwnBacking; |
| 2281 } | 2328 } |
| 2282 | 2329 |
| 2283 bool PaintLayer::isAllowedToQueryCompositingState() const | 2330 bool PaintLayer::isAllowedToQueryCompositingState() const |
| 2284 { | 2331 { |
| 2285 if (gCompositingQueryMode == CompositingQueriesAreAllowed || RuntimeEnabledF
eatures::slimmingPaintV2Enabled()) | 2332 if (gCompositingQueryMode == CompositingQueriesAreAllowed || RuntimeEnabledF
eatures::slimmingPaintV2Enabled()) |
| 2286 return true; | 2333 return true; |
| 2287 return layoutObject()->document().lifecycle().state() >= DocumentLifecycle::
InCompositingUpdate; | 2334 return layoutObject()->document().lifecycle().state() >= DocumentLifecycle::
InCompositingUpdate; |
| 2288 } | 2335 } |
| 2289 | 2336 |
| 2290 CompositedLayerMapping* PaintLayer::compositedLayerMapping() const | 2337 CompositedLayerMapping* PaintLayer::compositedLayerMapping() const |
| 2291 { | 2338 { |
| 2292 ASSERT(isAllowedToQueryCompositingState()); | 2339 ASSERT(isAllowedToQueryCompositingState()); |
| 2293 return m_compositedLayerMapping.get(); | 2340 return m_rareData ? m_rareData->compositedLayerMapping.get() : nullptr; |
| 2294 } | 2341 } |
| 2295 | 2342 |
| 2296 GraphicsLayer* PaintLayer::graphicsLayerBacking() const | 2343 GraphicsLayer* PaintLayer::graphicsLayerBacking() const |
| 2297 { | 2344 { |
| 2298 switch (compositingState()) { | 2345 switch (compositingState()) { |
| 2299 case NotComposited: | 2346 case NotComposited: |
| 2300 return 0; | 2347 return 0; |
| 2301 case PaintsIntoGroupedBacking: | 2348 case PaintsIntoGroupedBacking: |
| 2302 return groupedMapping()->squashingLayer(); | 2349 return groupedMapping()->squashingLayer(); |
| 2303 default: | 2350 default: |
| 2304 return compositedLayerMapping()->mainGraphicsLayer(); | 2351 return compositedLayerMapping()->mainGraphicsLayer(); |
| 2305 } | 2352 } |
| 2306 } | 2353 } |
| 2307 | 2354 |
| 2308 GraphicsLayer* PaintLayer::graphicsLayerBackingForScrolling() const | 2355 GraphicsLayer* PaintLayer::graphicsLayerBackingForScrolling() const |
| 2309 { | 2356 { |
| 2310 switch (compositingState()) { | 2357 switch (compositingState()) { |
| 2311 case NotComposited: | 2358 case NotComposited: |
| 2312 return 0; | 2359 return 0; |
| 2313 case PaintsIntoGroupedBacking: | 2360 case PaintsIntoGroupedBacking: |
| 2314 return groupedMapping()->squashingLayer(); | 2361 return groupedMapping()->squashingLayer(); |
| 2315 default: | 2362 default: |
| 2316 return compositedLayerMapping()->scrollingContentsLayer() ? compositedLa
yerMapping()->scrollingContentsLayer() : compositedLayerMapping()->mainGraphicsL
ayer(); | 2363 return compositedLayerMapping()->scrollingContentsLayer() ? compositedLa
yerMapping()->scrollingContentsLayer() : compositedLayerMapping()->mainGraphicsL
ayer(); |
| 2317 } | 2364 } |
| 2318 } | 2365 } |
| 2319 | 2366 |
| 2320 void PaintLayer::ensureCompositedLayerMapping() | 2367 void PaintLayer::ensureCompositedLayerMapping() |
| 2321 { | 2368 { |
| 2322 if (m_compositedLayerMapping) | 2369 if (m_rareData && m_rareData->compositedLayerMapping) |
| 2323 return; | 2370 return; |
| 2324 | 2371 |
| 2325 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(*this)); | 2372 ensureRareData().compositedLayerMapping = adoptPtr(new CompositedLayerMappin
g(*this)); |
| 2326 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSub
tree); | 2373 m_rareData->compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLaye
rUpdateSubtree); |
| 2327 | 2374 |
| 2328 updateOrRemoveFilterEffectBuilder(); | 2375 updateOrRemoveFilterEffectBuilder(); |
| 2329 } | 2376 } |
| 2330 | 2377 |
| 2331 void PaintLayer::clearCompositedLayerMapping(bool layerBeingDestroyed) | 2378 void PaintLayer::clearCompositedLayerMapping(bool layerBeingDestroyed) |
| 2332 { | 2379 { |
| 2333 if (!layerBeingDestroyed) { | 2380 if (!layerBeingDestroyed) { |
| 2334 // We need to make sure our decendants get a geometry update. In princip
le, | 2381 // We need to make sure our decendants get a geometry update. In princip
le, |
| 2335 // we could call setNeedsGraphicsLayerUpdate on our children, but that w
ould | 2382 // we could call setNeedsGraphicsLayerUpdate on our children, but that w
ould |
| 2336 // require walking the z-order lists to find them. Instead, we over-inva
lidate | 2383 // require walking the z-order lists to find them. Instead, we over-inva
lidate |
| 2337 // by marking our parent as needing a geometry update. | 2384 // by marking our parent as needing a geometry update. |
| 2338 if (PaintLayer* compositingParent = enclosingLayerWithCompositedLayerMap
ping(ExcludeSelf)) | 2385 if (PaintLayer* compositingParent = enclosingLayerWithCompositedLayerMap
ping(ExcludeSelf)) |
| 2339 compositingParent->compositedLayerMapping()->setNeedsGraphicsLayerUp
date(GraphicsLayerUpdateSubtree); | 2386 compositingParent->compositedLayerMapping()->setNeedsGraphicsLayerUp
date(GraphicsLayerUpdateSubtree); |
| 2340 } | 2387 } |
| 2341 | 2388 |
| 2342 m_compositedLayerMapping.clear(); | 2389 if (m_rareData) |
| 2390 m_rareData->compositedLayerMapping.clear(); |
| 2343 | 2391 |
| 2344 if (!layerBeingDestroyed) | 2392 if (!layerBeingDestroyed) |
| 2345 updateOrRemoveFilterEffectBuilder(); | 2393 updateOrRemoveFilterEffectBuilder(); |
| 2346 } | 2394 } |
| 2347 | 2395 |
| 2348 void PaintLayer::setGroupedMapping(CompositedLayerMapping* groupedMapping, SetGr
oupMappingOptions options) | 2396 void PaintLayer::setGroupedMapping(CompositedLayerMapping* groupedMapping, SetGr
oupMappingOptions options) |
| 2349 { | 2397 { |
| 2350 if (groupedMapping == m_groupedMapping) | 2398 CompositedLayerMapping* oldGroupedMapping = this->groupedMapping(); |
| 2399 if (groupedMapping == oldGroupedMapping) |
| 2351 return; | 2400 return; |
| 2352 | 2401 |
| 2353 if (options == InvalidateLayerAndRemoveFromMapping && m_groupedMapping) { | 2402 if (options == InvalidateLayerAndRemoveFromMapping && oldGroupedMapping) { |
| 2354 m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree
); | 2403 oldGroupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtre
e); |
| 2355 m_groupedMapping->removeLayerFromSquashingGraphicsLayer(this); | 2404 oldGroupedMapping->removeLayerFromSquashingGraphicsLayer(this); |
| 2356 } | 2405 } |
| 2357 m_groupedMapping = groupedMapping; | 2406 if (m_rareData || groupedMapping) |
| 2358 ASSERT(!m_groupedMapping || m_groupedMapping->verifyLayerInSquashingVector(t
his)); | 2407 ensureRareData().groupedMapping = groupedMapping; |
| 2359 if (options == InvalidateLayerAndRemoveFromMapping && m_groupedMapping) | 2408 ASSERT(!groupedMapping || groupedMapping->verifyLayerInSquashingVector(this)
); |
| 2360 m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree
); | 2409 if (options == InvalidateLayerAndRemoveFromMapping && groupedMapping) |
| 2410 groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); |
| 2361 } | 2411 } |
| 2362 | 2412 |
| 2363 bool PaintLayer::hasCompositedMask() const | 2413 bool PaintLayer::hasCompositedMask() const |
| 2364 { | 2414 { |
| 2365 return m_compositedLayerMapping && m_compositedLayerMapping->hasMaskLayer(); | 2415 return m_rareData && m_rareData->compositedLayerMapping && m_rareData->compo
sitedLayerMapping->hasMaskLayer(); |
| 2366 } | 2416 } |
| 2367 | 2417 |
| 2368 bool PaintLayer::hasCompositedClippingMask() const | 2418 bool PaintLayer::hasCompositedClippingMask() const |
| 2369 { | 2419 { |
| 2370 return m_compositedLayerMapping && m_compositedLayerMapping->hasChildClippin
gMaskLayer(); | 2420 return m_rareData && m_rareData->compositedLayerMapping && m_rareData->compo
sitedLayerMapping->hasChildClippingMaskLayer(); |
| 2371 } | 2421 } |
| 2372 | 2422 |
| 2373 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const | 2423 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const |
| 2374 { | 2424 { |
| 2375 return (transform() || layoutObject()->style()->position() == FixedPosition)
&& ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat
e() != PaintsIntoOwnBacking); | 2425 return (transform() || layoutObject()->style()->position() == FixedPosition)
&& ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat
e() != PaintsIntoOwnBacking); |
| 2376 } | 2426 } |
| 2377 | 2427 |
| 2378 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 2428 bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
| 2379 { | 2429 { |
| 2380 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 2430 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 { | 2544 { |
| 2495 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter())) | 2545 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter())) |
| 2496 return; | 2546 return; |
| 2497 | 2547 |
| 2498 updateOrRemoveFilterClients(); | 2548 updateOrRemoveFilterClients(); |
| 2499 updateOrRemoveFilterEffectBuilder(); | 2549 updateOrRemoveFilterEffectBuilder(); |
| 2500 } | 2550 } |
| 2501 | 2551 |
| 2502 bool PaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const Comp
utedStyle* oldStyle) | 2552 bool PaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const Comp
utedStyle* oldStyle) |
| 2503 { | 2553 { |
| 2504 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp
ositingReasonsFromStyle; | 2554 CompositingReasons oldPotentialCompositingReasonsFromStyle = potentialCompos
itingReasonsFromStyle(); |
| 2505 compositor()->updatePotentialCompositingReasonsFromStyle(this); | 2555 compositor()->updatePotentialCompositingReasonsFromStyle(this); |
| 2506 | 2556 |
| 2507 // This function implements an optimization for transforms and opacity. | 2557 // This function implements an optimization for transforms and opacity. |
| 2508 // A common pattern is for a touchmove handler to update the transform | 2558 // A common pattern is for a touchmove handler to update the transform |
| 2509 // and/or an opacity of an element every frame while the user moves their | 2559 // and/or an opacity of an element every frame while the user moves their |
| 2510 // finger across the screen. The conditions below recognize when the | 2560 // finger across the screen. The conditions below recognize when the |
| 2511 // compositing state is set up to receive a direct transform or opacity | 2561 // compositing state is set up to receive a direct transform or opacity |
| 2512 // update. | 2562 // update. |
| 2513 | 2563 |
| 2514 if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformCha
nged | StyleDifference::OpacityChanged)) | 2564 if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformCha
nged | StyleDifference::OpacityChanged)) |
| 2515 return false; | 2565 return false; |
| 2516 // The potentialCompositingReasonsFromStyle could have changed without | 2566 // The potentialCompositingReasonsFromStyle could have changed without |
| 2517 // a corresponding StyleDifference if an animation started or ended. | 2567 // a corresponding StyleDifference if an animation started or ended. |
| 2518 if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasons
FromStyle) | 2568 if (potentialCompositingReasonsFromStyle() != oldPotentialCompositingReasons
FromStyle) |
| 2519 return false; | 2569 return false; |
| 2520 // We could add support for reflections if we updated the transform on | 2570 // We could add support for reflections if we updated the transform on |
| 2521 // the reflection layers. | 2571 // the reflection layers. |
| 2522 if (layoutObject()->hasReflection()) | 2572 if (layoutObject()->hasReflection()) |
| 2523 return false; | 2573 return false; |
| 2524 // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't | 2574 // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't |
| 2525 // perform a direct compositing update because the filters code is going | 2575 // perform a direct compositing update because the filters code is going |
| 2526 // to produce different output this time around. We can remove this code | 2576 // to produce different output this time around. We can remove this code |
| 2527 // once we fix the chicken/egg bugs in the filters code and delete the | 2577 // once we fix the chicken/egg bugs in the filters code and delete the |
| 2528 // scheduleSVGFilterLayerUpdateHack(). | 2578 // scheduleSVGFilterLayerUpdateHack(). |
| 2529 if (layoutObject()->node() && layoutObject()->node()->svgFilterNeedsLayerUpd
ate()) | 2579 if (layoutObject()->node() && layoutObject()->node()->svgFilterNeedsLayerUpd
ate()) |
| 2530 return false; | 2580 return false; |
| 2531 if (!m_compositedLayerMapping) | 2581 if (!m_rareData || !m_rareData->compositedLayerMapping) |
| 2532 return false; | 2582 return false; |
| 2533 | 2583 |
| 2534 // To cut off almost all the work in the compositing update for | 2584 // To cut off almost all the work in the compositing update for |
| 2535 // this case, we treat inline transforms has having assumed overlap | 2585 // this case, we treat inline transforms has having assumed overlap |
| 2536 // (similar to how we treat animated transforms). Notice that we read | 2586 // (similar to how we treat animated transforms). Notice that we read |
| 2537 // CompositingReasonInlineTransform from the m_compositingReasons, which | 2587 // CompositingReasonInlineTransform from the m_compositingReasons, which |
| 2538 // means that the inline transform actually triggered assumed overlap in | 2588 // means that the inline transform actually triggered assumed overlap in |
| 2539 // the overlap map. | 2589 // the overlap map. |
| 2540 if (diff.transformChanged() && !(m_compositingReasons & CompositingReasonInl
ineTransform)) | 2590 if (diff.transformChanged() && (!m_rareData || !(m_rareData->compositingReas
ons & CompositingReasonInlineTransform))) |
| 2541 return false; | 2591 return false; |
| 2542 | 2592 |
| 2543 // We composite transparent Layers differently from non-transparent | 2593 // We composite transparent Layers differently from non-transparent |
| 2544 // Layers even when the non-transparent Layers are already a | 2594 // Layers even when the non-transparent Layers are already a |
| 2545 // stacking context. | 2595 // stacking context. |
| 2546 if (diff.opacityChanged() && m_layoutObject->style()->hasOpacity() != oldSty
le->hasOpacity()) | 2596 if (diff.opacityChanged() && m_layoutObject->style()->hasOpacity() != oldSty
le->hasOpacity()) |
| 2547 return false; | 2597 return false; |
| 2548 | 2598 |
| 2549 // Changes in pointer-events affect hit test visibility of the scrollable | 2599 // Changes in pointer-events affect hit test visibility of the scrollable |
| 2550 // area and its |m_scrollsOverflow| value which determines if the layer | 2600 // area and its |m_scrollsOverflow| value which determines if the layer |
| 2551 // requires composited scrolling or not. | 2601 // requires composited scrolling or not. |
| 2552 if (m_scrollableArea && m_layoutObject->style()->pointerEvents() != oldStyle
->pointerEvents()) | 2602 if (m_scrollableArea && m_layoutObject->style()->pointerEvents() != oldStyle
->pointerEvents()) |
| 2553 return false; | 2603 return false; |
| 2554 | 2604 |
| 2555 updateTransform(oldStyle, layoutObject()->styleRef()); | 2605 updateTransform(oldStyle, layoutObject()->styleRef()); |
| 2556 | 2606 |
| 2557 // FIXME: Consider introducing a smaller graphics layer update scope | 2607 // FIXME: Consider introducing a smaller graphics layer update scope |
| 2558 // that just handles transforms and opacity. GraphicsLayerUpdateLocal | 2608 // that just handles transforms and opacity. GraphicsLayerUpdateLocal |
| 2559 // will also program bounds, clips, and many other properties that could | 2609 // will also program bounds, clips, and many other properties that could |
| 2560 // not possibly have changed. | 2610 // not possibly have changed. |
| 2561 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLoc
al); | 2611 m_rareData->compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLaye
rUpdateLocal); |
| 2562 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange
); | 2612 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange
); |
| 2563 | 2613 |
| 2564 if (m_scrollableArea) | 2614 if (m_scrollableArea) |
| 2565 m_scrollableArea->updateAfterStyleChange(oldStyle); | 2615 m_scrollableArea->updateAfterStyleChange(oldStyle); |
| 2566 | 2616 |
| 2567 return true; | 2617 return true; |
| 2568 } | 2618 } |
| 2569 | 2619 |
| 2570 void PaintLayer::styleChanged(StyleDifference diff, const ComputedStyle* oldStyl
e) | 2620 void PaintLayer::styleChanged(StyleDifference diff, const ComputedStyle* oldStyl
e) |
| 2571 { | 2621 { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2830 | 2880 |
| 2831 void showLayerTree(const blink::LayoutObject* layoutObject) | 2881 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2832 { | 2882 { |
| 2833 if (!layoutObject) { | 2883 if (!layoutObject) { |
| 2834 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2884 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2835 return; | 2885 return; |
| 2836 } | 2886 } |
| 2837 showLayerTree(layoutObject->enclosingLayer()); | 2887 showLayerTree(layoutObject->enclosingLayer()); |
| 2838 } | 2888 } |
| 2839 #endif | 2889 #endif |
| OLD | NEW |