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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 247713003: Separate repaint and layout requirements of StyleDifference (Step 3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments; Rebase on RAL Created 6 years, 7 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
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/SVGRenderStyle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right()))) 361 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right())))
362 return false; 362 return false;
363 363
364 // One of the units is fixed or percent in both directions and stayed 364 // One of the units is fixed or percent in both directions and stayed
365 // that way in the new style. Therefore all we are doing is moving. 365 // that way in the new style. Therefore all we are doing is moving.
366 return true; 366 return true;
367 } 367 }
368 368
369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un signed& changedContextSensitiveProperties) const 369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un signed& changedContextSensitiveProperties) const
370 { 370 {
371 changedContextSensitiveProperties = ContextSensitivePropertyNone;
372
373 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep 371 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep
374 // compare, which is duplicate work when we're going to compare each propert y inside 372 // compare, which is duplicate work when we're going to compare each propert y inside
375 // this function anyway. 373 // this function anyway.
376 374
377 StyleDifference diff; 375 StyleDifference diff;
378 if (m_svgStyle.get() != other.m_svgStyle.get()) { 376 if (m_svgStyle.get() != other.m_svgStyle.get())
379 diff = m_svgStyle->diff(other.m_svgStyle.get()); 377 diff = m_svgStyle->diff(other.m_svgStyle.get());
380 if (diff.needsFullLayout())
381 return diff;
382 }
383 378
384 if (diffNeedsFullLayout(other)) { 379 if (!diff.needsFullLayout() && diffNeedsFullLayout(other))
385 diff.setNeedsFullLayout(); 380 diff.setNeedsFullLayout();
386 return diff;
387 }
388 381
389 if (position() != StaticPosition && surround->offset != other.surround->offs et) { 382 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off set != other.surround->offset) {
390 // Optimize for the case where a positioned layer is moving but not chan ging size. 383 // Optimize for the case where a positioned layer is moving but not chan ging size.
391 if ((position() == AbsolutePosition || position() == FixedPosition) 384 if ((position() == AbsolutePosition || position() == FixedPosition)
392 && positionedObjectMovedOnly(surround->offset, other.surround->offse t, m_box->width())) { 385 && positionedObjectMovedOnly(surround->offset, other.surround->offse t, m_box->width())) {
393 diff.setNeedsPositionedMovementLayout(); 386 diff.setNeedsPositionedMovementLayout();
394 } else { 387 } else {
395 // FIXME: We would like to use SimplifiedLayout for relative positio ning, but we can't quite do that yet. 388 // FIXME: We would like to use SimplifiedLayout for relative positio ning, but we can't quite do that yet.
396 // We need to make sure SimplifiedLayout can operate correctly on Re nderInlines (we will need 389 // We need to make sure SimplifiedLayout can operate correctly on Re nderInlines (we will need
397 // to add a selfNeedsSimplifiedLayout bit in order to not get confus ed and taint every line). 390 // to add a selfNeedsSimplifiedLayout bit in order to not get confus ed and taint every line).
398 diff.setNeedsFullLayout(); 391 diff.setNeedsFullLayout();
399 return diff;
400 } 392 }
401 } 393 }
402 394
403 if (diffNeedsRepaintLayerOnly(other)) 395 if (diffNeedsRepaintLayer(other))
404 diff.setNeedsRepaintLayer(); 396 diff.setNeedsRepaintLayer();
405 else if (diffNeedsRepaintObjectOnly(other)) 397 else if (diffNeedsRepaintObject(other))
406 diff.setNeedsRepaintObject(); 398 diff.setNeedsRepaintObject();
407 399
408 changedContextSensitiveProperties = computeChangedContextSensitiveProperties (other, diff); 400 changedContextSensitiveProperties = computeChangedContextSensitiveProperties (other, diff);
409 401
410 if (diff.needsRepaint() && diff.needsPositionedMovementLayout()) { 402 if (diff.hasNoChange() && diffNeedsRecompositeLayer(other))
411 // FIXME: When both repaint and positioned-movement-layout are needed, t he original
412 // code promoted diff to StyleDifferenceLayout because the original enum can't express
413 // the exact needs in the case. The following code is temporary to keep the original
414 // behavior. Will remove in later changes when we optimize and change fu nctionality,
415 // which may be just to rebaseline layout test expectations.
416 diff.clearNeedsRepaint();
417 diff.setNeedsFullLayout();
418 return diff;
419 }
420
421 if (diff.hasNoChange() && diffNeedsRecompositeLayerOnly(other))
422 diff.setNeedsRecompositeLayer(); 403 diff.setNeedsRecompositeLayer();
423 404
424 // Cursors are not checked, since they will be set appropriately in response to mouse events, 405 // Cursors are not checked, since they will be set appropriately in response to mouse events,
425 // so they don't need to cause any repaint or layout. 406 // so they don't need to cause any repaint or layout.
426 407
427 // Animations don't need to be checked either. We always set the new style o n the RenderObject, so we will get a chance to fire off 408 // Animations don't need to be checked either. We always set the new style o n the RenderObject, so we will get a chance to fire off
428 // the resulting transition properly. 409 // the resulting transition properly.
429 410
430 return diff; 411 return diff;
431 } 412 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { 596 if (!m_background->outline().visuallyEqual(other.m_background->outline())) {
616 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it. 597 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it.
617 return true; 598 return true;
618 } 599 }
619 600
620 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff(). 601 // Movement of non-static-positioned object is special cased in RenderStyle: :visualInvalidationDiff().
621 602
622 return false; 603 return false;
623 } 604 }
624 605
625 bool RenderStyle::diffNeedsRepaintLayerOnly(const RenderStyle& other) const 606 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const
626 { 607 {
627 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip)) 608 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasClip != other.visual->hasClip))
628 return true; 609 return true;
629 610
630 if (RuntimeEnabledFeatures::cssCompositingEnabled() && (rareNonInheritedData ->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode 611 if (RuntimeEnabledFeatures::cssCompositingEnabled() && (rareNonInheritedData ->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode
631 || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_is olation)) 612 || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_is olation))
632 return true; 613 return true;
633 614
634 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask 615 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask
635 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m _maskBoxImage) 616 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m _maskBoxImage)
636 return true; 617 return true;
637 618
638 return false; 619 return false;
639 } 620 }
640 621
641 bool RenderStyle::diffNeedsRepaintObjectOnly(const RenderStyle& other) const 622 bool RenderStyle::diffNeedsRepaintObject(const RenderStyle& other) const
642 { 623 {
643 if (inherited_flags._visibility != other.inherited_flags._visibility 624 if (inherited_flags._visibility != other.inherited_flags._visibility
644 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo lorAdjust 625 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo lorAdjust
645 || inherited_flags._insideLink != other.inherited_flags._insideLink 626 || inherited_flags._insideLink != other.inherited_flags._insideLink
646 || !surround->border.visuallyEqual(other.surround->border) 627 || !surround->border.visuallyEqual(other.surround->border)
647 || !m_background->visuallyEqual(*other.m_background) 628 || !m_background->visuallyEqual(*other.m_background)
648 || rareInheritedData->userModify != other.rareInheritedData->userModify 629 || rareInheritedData->userModify != other.rareInheritedData->userModify
649 || rareInheritedData->userSelect != other.rareInheritedData->userSelect 630 || rareInheritedData->userSelect != other.rareInheritedData->userSelect
650 || rareNonInheritedData->userDrag != other.rareNonInheritedData->userDra g 631 || rareNonInheritedData->userDrag != other.rareNonInheritedData->userDra g
651 || rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_bo rderFit 632 || rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_bo rderFit
652 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_ob jectFit 633 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_ob jectFit
653 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedData- >m_objectPosition 634 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedData- >m_objectPosition
654 || rareInheritedData->m_imageRendering != other.rareInheritedData->m_ima geRendering) 635 || rareInheritedData->m_imageRendering != other.rareInheritedData->m_ima geRendering)
655 return true; 636 return true;
656 637
657 if (rareNonInheritedData->m_shapeOutside != other.rareNonInheritedData->m_sh apeOutside) 638 if (rareNonInheritedData->m_shapeOutside != other.rareNonInheritedData->m_sh apeOutside)
658 return true; 639 return true;
659 640
660 if (rareNonInheritedData->m_clipPath != other.rareNonInheritedData->m_clipPa th) 641 if (rareNonInheritedData->m_clipPath != other.rareNonInheritedData->m_clipPa th)
661 return true; 642 return true;
662 643
663 return false; 644 return false;
664 } 645 }
665 646
666 bool RenderStyle::diffNeedsRecompositeLayerOnly(const RenderStyle& other) const 647 bool RenderStyle::diffNeedsRecompositeLayer(const RenderStyle& other) const
667 { 648 {
668 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 649 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
669 if (rareNonInheritedData->m_transformStyle3D != other.rareNonInheritedDa ta->m_transformStyle3D 650 if (rareNonInheritedData->m_transformStyle3D != other.rareNonInheritedDa ta->m_transformStyle3D
670 || rareNonInheritedData->m_backfaceVisibility != other.rareNonInheri tedData->m_backfaceVisibility 651 || rareNonInheritedData->m_backfaceVisibility != other.rareNonInheri tedData->m_backfaceVisibility
671 || rareNonInheritedData->m_perspective != other.rareNonInheritedData ->m_perspective 652 || rareNonInheritedData->m_perspective != other.rareNonInheritedData ->m_perspective
672 || rareNonInheritedData->m_perspectiveOriginX != other.rareNonInheri tedData->m_perspectiveOriginX 653 || rareNonInheritedData->m_perspectiveOriginX != other.rareNonInheri tedData->m_perspectiveOriginX
673 || rareNonInheritedData->m_perspectiveOriginY != other.rareNonInheri tedData->m_perspectiveOriginY 654 || rareNonInheritedData->m_perspectiveOriginY != other.rareNonInheri tedData->m_perspectiveOriginY
674 || hasWillChangeCompositingHint() != other.hasWillChangeCompositingH int() 655 || hasWillChangeCompositingHint() != other.hasWillChangeCompositingH int()
675 || hasWillChangeGpuRasterizationHint() != other.hasWillChangeGpuRast erizationHint()) 656 || hasWillChangeGpuRasterizationHint() != other.hasWillChangeGpuRast erizationHint())
676 return true; 657 return true;
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 // right 1663 // right
1683 radiiSum = radii.topRight().height() + radii.bottomRight().height(); 1664 radiiSum = radii.topRight().height() + radii.bottomRight().height();
1684 if (radiiSum > rect.height()) 1665 if (radiiSum > rect.height())
1685 factor = std::min(rect.height() / radiiSum, factor); 1666 factor = std::min(rect.height() / radiiSum, factor);
1686 1667
1687 ASSERT(factor <= 1); 1668 ASSERT(factor <= 1);
1688 return factor; 1669 return factor;
1689 } 1670 }
1690 1671
1691 } // namespace WebCore 1672 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/SVGRenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698