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

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

Issue 2761863002: Add StyleDifference::needsVisualRectUpdate (Closed)
Patch Set: Still keep visibility change detection for full paint invalidation. Will optimize in later CLs 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
567 // This needs to be at last, because it may depend on conditions in diff
568 // computed above.
564 updatePropertySpecificDifferences(other, diff); 569 updatePropertySpecificDifferences(other, diff);
565 570
566 // The following condition needs to be at last, because it may depend on
567 // conditions in diff computed above.
568 if (scrollAnchorDisablingPropertyChanged(other, diff))
569 diff.setScrollAnchorDisablingPropertyChanged();
570
571 // Cursors are not checked, since they will be set appropriately in response 571 // 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 572 // to mouse events, so they don't need to cause any paint invalidation or
573 // layout. 573 // layout.
574 574
575 // Animations don't need to be checked either. We always set the new style on 575 // Animations don't need to be checked either. We always set the new style on
576 // the layoutObject, so we will get a chance to fire off the resulting 576 // the layoutObject, so we will get a chance to fire off the resulting
577 // transition properly. 577 // transition properly.
578 578
579 return diff; 579 return diff;
580 } 580 }
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 for (const AtomicString& property : 997 for (const AtomicString& property :
998 *value->customInvalidationProperties()) { 998 *value->customInvalidationProperties()) {
999 if (!dataEquivalent(getVariable(property), other.getVariable(property))) 999 if (!dataEquivalent(getVariable(property), other.getVariable(property)))
1000 return true; 1000 return true;
1001 } 1001 }
1002 } 1002 }
1003 1003
1004 return false; 1004 return false;
1005 } 1005 }
1006 1006
1007 // This doesn't include conditions needing layout or overflow recomputation
1008 // which implies visual rect update.
1009 bool ComputedStyle::diffNeedsVisualRectUpdate(
1010 const ComputedStyle& other) const {
1011 // Visual rect is empty if visibility is hidden.
1012 if (visibility() != other.visibility())
1013 return true;
1014
1015 // Need to update visual rect of the resizer.
1016 if (resize() != other.resize())
1017 return true;
1018
1019 return false;
1020 }
1021
1007 void ComputedStyle::updatePropertySpecificDifferences( 1022 void ComputedStyle::updatePropertySpecificDifferences(
1008 const ComputedStyle& other, 1023 const ComputedStyle& other,
1009 StyleDifference& diff) const { 1024 StyleDifference& diff) const {
1010 if (m_box->zIndex() != other.m_box->zIndex() || 1025 if (m_box->zIndex() != other.m_box->zIndex() ||
1011 isStackingContext() != other.isStackingContext()) 1026 isStackingContext() != other.isStackingContext())
1012 diff.setZIndexChanged(); 1027 diff.setZIndexChanged();
1013 1028
1014 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { 1029 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) {
1015 if (!transformDataEquivalent(other) || 1030 if (!transformDataEquivalent(other) ||
1016 m_rareNonInheritedData->m_perspective != 1031 m_rareNonInheritedData->m_perspective !=
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 diff.setTextDecorationOrColorChanged(); 1106 diff.setTextDecorationOrColorChanged();
1092 } 1107 }
1093 } 1108 }
1094 1109
1095 bool hasClip = hasOutOfFlowPosition() && !m_visual->hasAutoClip; 1110 bool hasClip = hasOutOfFlowPosition() && !m_visual->hasAutoClip;
1096 bool otherHasClip = 1111 bool otherHasClip =
1097 other.hasOutOfFlowPosition() && !other.m_visual->hasAutoClip; 1112 other.hasOutOfFlowPosition() && !other.m_visual->hasAutoClip;
1098 if (hasClip != otherHasClip || 1113 if (hasClip != otherHasClip ||
1099 (hasClip && m_visual->clip != other.m_visual->clip)) 1114 (hasClip && m_visual->clip != other.m_visual->clip))
1100 diff.setCSSClipChanged(); 1115 diff.setCSSClipChanged();
1116
1117 if (scrollAnchorDisablingPropertyChanged(other, diff))
1118 diff.setScrollAnchorDisablingPropertyChanged();
1101 } 1119 }
1102 1120
1103 void ComputedStyle::addPaintImage(StyleImage* image) { 1121 void ComputedStyle::addPaintImage(StyleImage* image) {
1104 if (!m_rareNonInheritedData.access()->m_paintImages) { 1122 if (!m_rareNonInheritedData.access()->m_paintImages) {
1105 m_rareNonInheritedData.access()->m_paintImages = 1123 m_rareNonInheritedData.access()->m_paintImages =
1106 WTF::makeUnique<Vector<Persistent<StyleImage>>>(); 1124 WTF::makeUnique<Vector<Persistent<StyleImage>>>();
1107 } 1125 }
1108 m_rareNonInheritedData.access()->m_paintImages->push_back(image); 1126 m_rareNonInheritedData.access()->m_paintImages->push_back(image);
1109 } 1127 }
1110 1128
(...skipping 1368 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