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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2450033002: Refine the criteria for ScrollAnchor-disabling properties (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | 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 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 diff.setNeedsPositionedMovementLayout(); 591 diff.setNeedsPositionedMovementLayout();
592 } 592 }
593 593
594 if (diffNeedsPaintInvalidationSubtree(other)) 594 if (diffNeedsPaintInvalidationSubtree(other))
595 diff.setNeedsPaintInvalidationSubtree(); 595 diff.setNeedsPaintInvalidationSubtree();
596 else if (diffNeedsPaintInvalidationObject(other)) 596 else if (diffNeedsPaintInvalidationObject(other))
597 diff.setNeedsPaintInvalidationObject(); 597 diff.setNeedsPaintInvalidationObject();
598 598
599 updatePropertySpecificDifferences(other, diff); 599 updatePropertySpecificDifferences(other, diff);
600 600
601 // TODO(skobes): Refine the criteria for ScrollAnchor-disabling properties. 601 if (scrollAnchorDisablingPropertyChanged(other, diff))
602 // Some things set needsLayout but shouldn't disable scroll anchoring.
603 if (diff.needsLayout() || diff.transformChanged())
604 diff.setScrollAnchorDisablingPropertyChanged(); 602 diff.setScrollAnchorDisablingPropertyChanged();
605 603
606 // Cursors are not checked, since they will be set appropriately in response 604 // Cursors are not checked, since they will be set appropriately in response
607 // to mouse events, so they don't need to cause any paint invalidation or 605 // to mouse events, so they don't need to cause any paint invalidation or
608 // layout. 606 // layout.
609 607
610 // Animations don't need to be checked either. We always set the new style on 608 // Animations don't need to be checked either. We always set the new style on
611 // the layoutObject, so we will get a chance to fire off the resulting 609 // the layoutObject, so we will get a chance to fire off the resulting
612 // transition properly. 610 // transition properly.
613 611
614 return diff; 612 return diff;
615 } 613 }
616 614
615 bool ComputedStyle::scrollAnchorDisablingPropertyChanged(
616 const ComputedStyle& other,
617 StyleDifference& diff) const {
618 if (m_nonInheritedData.m_position != other.m_nonInheritedData.m_position)
619 return true;
620
621 if (m_box.get() != other.m_box.get()) {
622 if (m_box->width() != other.m_box->width() ||
623 m_box->minWidth() != other.m_box->minWidth() ||
624 m_box->maxWidth() != other.m_box->maxWidth() ||
625 m_box->height() != other.m_box->height() ||
626 m_box->minHeight() != other.m_box->minHeight() ||
627 m_box->maxHeight() != other.m_box->maxHeight())
628 return true;
629 }
630
631 if (m_surround.get() != other.m_surround.get()) {
632 if (m_surround->margin != other.m_surround->margin ||
633 m_surround->offset != other.m_surround->offset ||
634 m_surround->padding != other.m_surround->padding)
635 return true;
636 }
637
638 if (diff.transformChanged())
639 return true;
640
641 return false;
642 }
643
617 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation( 644 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(
618 const ComputedStyle& other) const { 645 const ComputedStyle& other) const {
619 // FIXME: Not all cases in this method need both full layout and paint 646 // FIXME: Not all cases in this method need both full layout and paint
620 // invalidation. 647 // invalidation.
621 // Should move cases into diffNeedsFullLayout() if 648 // Should move cases into diffNeedsFullLayout() if
622 // - don't need paint invalidation at all; 649 // - don't need paint invalidation at all;
623 // - or the layoutObject knows how to exactly invalidate paints caused by the 650 // - or the layoutObject knows how to exactly invalidate paints caused by the
624 // layout change instead of forced full paint invalidation. 651 // layout change instead of forced full paint invalidation.
625 652
626 if (m_surround.get() != other.m_surround.get()) { 653 if (m_surround.get() != other.m_surround.get()) {
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 if (value < 0) 2400 if (value < 0)
2374 fvalue -= 0.5f; 2401 fvalue -= 0.5f;
2375 else 2402 else
2376 fvalue += 0.5f; 2403 fvalue += 0.5f;
2377 } 2404 }
2378 2405
2379 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2406 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2380 } 2407 }
2381 2408
2382 } // namespace blink 2409 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698