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

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

Issue 2761863002: Add StyleDifference::needsVisualRectUpdate (Closed)
Patch Set: - Created 3 years, 9 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
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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 diff.setNeedsFullLayout(); 554 diff.setNeedsFullLayout();
555 else 555 else
556 diff.setNeedsPositionedMovementLayout(); 556 diff.setNeedsPositionedMovementLayout();
557 } 557 }
558 558
559 if (diffNeedsPaintInvalidationSubtree(other)) 559 if (diffNeedsPaintInvalidationSubtree(other))
560 diff.setNeedsPaintInvalidationSubtree(); 560 diff.setNeedsPaintInvalidationSubtree();
561 else if (diffNeedsPaintInvalidationObject(other)) 561 else if (diffNeedsPaintInvalidationObject(other))
562 diff.setNeedsPaintInvalidationObject(); 562 diff.setNeedsPaintInvalidationObject();
563 563
564 if (diffNeedsVisualRectUpdate(other))
565 diff.setNeedsVisualRectUpdate();
566
564 updatePropertySpecificDifferences(other, diff); 567 updatePropertySpecificDifferences(other, diff);
565 568
566 // The following condition needs to be at last, because it may depend on 569 // The following condition needs to be at last, because it may depend on
567 // conditions in diff computed above. 570 // conditions in diff computed above.
568 if (scrollAnchorDisablingPropertyChanged(other, diff)) 571 if (scrollAnchorDisablingPropertyChanged(other, diff))
569 diff.setScrollAnchorDisablingPropertyChanged(); 572 diff.setScrollAnchorDisablingPropertyChanged();
570 573
571 // Cursors are not checked, since they will be set appropriately in response 574 // Cursors are not checked, since they will be set appropriately in response
572 // to mouse events, so they don't need to cause any paint invalidation or 575 // to mouse events, so they don't need to cause any paint invalidation or
573 // layout. 576 // layout.
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 for (const AtomicString& property : 1000 for (const AtomicString& property :
998 *value->customInvalidationProperties()) { 1001 *value->customInvalidationProperties()) {
999 if (!dataEquivalent(getVariable(property), other.getVariable(property))) 1002 if (!dataEquivalent(getVariable(property), other.getVariable(property)))
1000 return true; 1003 return true;
1001 } 1004 }
1002 } 1005 }
1003 1006
1004 return false; 1007 return false;
1005 } 1008 }
1006 1009
1010 // This doesn't include conditions needing layout or overflow recomputation
1011 // which implies visual rect update.
1012 bool ComputedStyle::diffNeedsVisualRectUpdate(
1013 const ComputedStyle& other) const {
1014 // Visual rect is empty if visibility is hidden.
1015 if (visibility() != other.visibility())
pdr. 2017/03/20 21:23:04 Where was this logic before this patch? Can we rem
Xianzhu 2017/03/20 22:26:35 This is to make https://codereview.chromium.org/27
1016 return true;
1017
1018 // Need to update visual rect of the resizer.
1019 if (resize() != other.resize())
pdr. 2017/03/20 21:23:04 The old code seemed to check against RESIZE_NONE w
Xianzhu 2017/03/20 22:26:35 The old code always invalidates the whole box cont
1020 return true;
1021
1022 return false;
1023 }
1024
1007 void ComputedStyle::updatePropertySpecificDifferences( 1025 void ComputedStyle::updatePropertySpecificDifferences(
1008 const ComputedStyle& other, 1026 const ComputedStyle& other,
1009 StyleDifference& diff) const { 1027 StyleDifference& diff) const {
1010 if (m_box->zIndex() != other.m_box->zIndex() || 1028 if (m_box->zIndex() != other.m_box->zIndex() ||
1011 isStackingContext() != other.isStackingContext()) 1029 isStackingContext() != other.isStackingContext())
1012 diff.setZIndexChanged(); 1030 diff.setZIndexChanged();
1013 1031
1014 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { 1032 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) {
1015 if (!transformDataEquivalent(other) || 1033 if (!transformDataEquivalent(other) ||
1016 m_rareNonInheritedData->m_perspective != 1034 m_rareNonInheritedData->m_perspective !=
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 if (value < 0) 2497 if (value < 0)
2480 fvalue -= 0.5f; 2498 fvalue -= 0.5f;
2481 else 2499 else
2482 fvalue += 0.5f; 2500 fvalue += 0.5f;
2483 } 2501 }
2484 2502
2485 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2503 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2486 } 2504 }
2487 2505
2488 } // namespace blink 2506 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/StyleDifference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698