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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 334373002: Clear absolute clip rects when transform changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Split updateTransform into two parts Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 481 }
482 482
483 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 483 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
484 child->updateLayerPositionsAfterScroll(flags); 484 child->updateLayerPositionsAfterScroll(flags);
485 485
486 // We don't update our reflection as scrolling is a translation which does n ot change the size() 486 // We don't update our reflection as scrolling is a translation which does n ot change the size()
487 // of an object, thus RenderReplica will still repaint itself properly as th e layer position was 487 // of an object, thus RenderReplica will still repaint itself properly as th e layer position was
488 // updated above. 488 // updated above.
489 } 489 }
490 490
491 void RenderLayer::updateTransform() 491 void RenderLayer::updateTransformationMatrix()
492 { 492 {
493 if (m_transform) {
494 RenderBox* box = renderBox();
495 ASSERT(box);
496 m_transform->makeIdentity();
497 box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRec t().size(), RenderStyle::IncludeTransformOrigin);
498 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng());
499 }
500 }
501
502 void RenderLayer::updateTransform(const RenderStyle* oldStyle, RenderStyle* newS tyle)
503 {
504 if (oldStyle && newStyle->transformDataEquivalent(*oldStyle))
505 return;
506
493 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 507 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
494 // so check style too. 508 // so check style too.
495 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); 509 bool hasTransform = renderer()->hasTransform() && newStyle->hasTransform();
496 bool had3DTransform = has3DTransform(); 510 bool had3DTransform = has3DTransform();
497 511
498 bool hadTransform = m_transform; 512 bool hadTransform = m_transform;
499 if (hasTransform != hadTransform) { 513 if (hasTransform != hadTransform) {
500 if (hasTransform) 514 if (hasTransform)
501 m_transform = adoptPtr(new TransformationMatrix); 515 m_transform = adoptPtr(new TransformationMatrix);
502 else 516 else
503 m_transform.clear(); 517 m_transform.clear();
504 518
505 // Layers with transforms act as clip rects roots, so clear the cached c lip rects here. 519 // Layers with transforms act as clip rects roots, so clear the cached c lip rects here.
506 m_clipper.clearClipRectsIncludingDescendants(); 520 m_clipper.clearClipRectsIncludingDescendants();
521 } else if (hasTransform) {
522 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects);
507 } 523 }
508 524
509 if (hasTransform) { 525 updateTransformationMatrix();
510 RenderBox* box = renderBox();
511 ASSERT(box);
512 m_transform->makeIdentity();
513 box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRec t().size(), RenderStyle::IncludeTransformOrigin);
514 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng());
515 }
516 526
517 if (had3DTransform != has3DTransform()) 527 if (had3DTransform != has3DTransform())
ajuma 2014/06/17 23:21:39 We don't need to also check this in the post-layou
518 dirty3DTransformedDescendantStatus(); 528 dirty3DTransformedDescendantStatus();
519 } 529 }
520 530
521 static RenderLayer* enclosingLayerForContainingBlock(RenderLayer* layer) 531 static RenderLayer* enclosingLayerForContainingBlock(RenderLayer* layer)
522 { 532 {
523 if (RenderObject* containingBlock = layer->renderer()->containingBlock()) 533 if (RenderObject* containingBlock = layer->renderer()->containingBlock())
524 return containingBlock->enclosingLayer(); 534 return containingBlock->enclosingLayer();
525 return 0; 535 return 0;
526 } 536 }
527 537
(...skipping 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3685 if (!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle)) { 3695 if (!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle)) {
3686 ASSERT(!oldStyle || diff.needsFullLayout()); 3696 ASSERT(!oldStyle || diff.needsFullLayout());
3687 updateReflectionInfo(oldStyle); 3697 updateReflectionInfo(oldStyle);
3688 } 3698 }
3689 3699
3690 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 3700 if (RuntimeEnabledFeatures::cssCompositingEnabled())
3691 m_blendInfo.updateBlendMode(); 3701 m_blendInfo.updateBlendMode();
3692 3702
3693 updateDescendantDependentFlags(); 3703 updateDescendantDependentFlags();
3694 3704
3695 if (!oldStyle || !renderer()->style()->transformDataEquivalent(*oldStyle)) 3705 updateTransform(oldStyle, renderer()->style());
3696 updateTransform();
3697 3706
3698 { 3707 {
3699 // https://code.google.com/p/chromium/issues/detail?id=343759 3708 // https://code.google.com/p/chromium/issues/detail?id=343759
3700 DisableCompositingQueryAsserts disabler; 3709 DisableCompositingQueryAsserts disabler;
3701 updateFilters(oldStyle, renderer()->style()); 3710 updateFilters(oldStyle, renderer()->style());
3702 } 3711 }
3703 3712
3704 compositor()->updateStyleDeterminedCompositingReasons(this); 3713 compositor()->updateStyleDeterminedCompositingReasons(this);
3705 3714
3706 setNeedsCompositingInputsUpdate(); 3715 setNeedsCompositingInputsUpdate();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3864 } 3873 }
3865 } 3874 }
3866 3875
3867 void showLayerTree(const WebCore::RenderObject* renderer) 3876 void showLayerTree(const WebCore::RenderObject* renderer)
3868 { 3877 {
3869 if (!renderer) 3878 if (!renderer)
3870 return; 3879 return;
3871 showLayerTree(renderer->enclosingLayer()); 3880 showLayerTree(renderer->enclosingLayer());
3872 } 3881 }
3873 #endif 3882 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698