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

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

Issue 2047283002: Avoid touching z-index in StyleAdjuster by using an isStackingContext flag instead (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Animation expectation Created 4 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
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return true; 547 return true;
548 548
549 // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree. 549 // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
550 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti ves.get(); 550 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti ves.get();
551 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD irectives.get(); 551 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD irectives.get();
552 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) 552 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
553 return true; 553 return true;
554 554
555 // We only need do layout for opacity changes if adding or losing opacit y could trigger a change 555 // We only need do layout for opacity changes if adding or losing opacit y could trigger a change
556 // in us being a stacking context. 556 // in us being a stacking context.
557 if (hasAutoZIndex() != other.hasAutoZIndex() && rareNonInheritedData->ha sOpacity() != other.rareNonInheritedData->hasOpacity()) { 557 if (isStackingContext() != other.isStackingContext() && rareNonInherited Data->hasOpacity() != other.rareNonInheritedData->hasOpacity()) {
558 // FIXME: We would like to use SimplifiedLayout here, but we can't q uite do that yet. 558 // FIXME: We would like to use SimplifiedLayout here, but we can't q uite do that yet.
559 // We need to make sure SimplifiedLayout can operate correctly on La youtInlines (we will need 559 // We need to make sure SimplifiedLayout can operate correctly on La youtInlines (we will need
560 // to add a selfNeedsSimplifiedLayout bit in order to not get confus ed and taint every line). 560 // to add a selfNeedsSimplifiedLayout bit in order to not get confus ed and taint every line).
561 // In addition we need to solve the floating object issue when layer s come and go. Right now 561 // In addition we need to solve the floating object issue when layer s come and go. Right now
562 // a full layout is necessary to keep floating object lists sane. 562 // a full layout is necessary to keep floating object lists sane.
563 return true; 563 return true;
564 } 564 }
565 } 565 }
566 566
567 if (rareInheritedData.get() != other.rareInheritedData.get()) { 567 if (rareInheritedData.get() != other.rareInheritedData.get()) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 if (!dataEquivalent(thisVar, otherVar)) 804 if (!dataEquivalent(thisVar, otherVar))
805 return true; 805 return true;
806 } 806 }
807 } 807 }
808 808
809 return false; 809 return false;
810 } 810 }
811 811
812 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const 812 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other , StyleDifference& diff) const
813 { 813 {
814 // StyleAdjuster has ensured that zIndex is non-auto only if it's applicable . 814 if (m_box->zIndex() != other.m_box->zIndex() || isStackingContext() != other .isStackingContext())
rune 2016/06/10 12:25:52 This comment is still valid with the last patchset
815 if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != ot her.m_box->hasAutoZIndex())
816 diff.setZIndexChanged(); 815 diff.setZIndexChanged();
817 816
818 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 817 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
819 if (!transformDataEquivalent(other)) 818 if (!transformDataEquivalent(other))
820 diff.setTransformChanged(); 819 diff.setTransformChanged();
821 820
822 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity ) 821 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity )
823 diff.setOpacityChanged(); 822 diff.setOpacityChanged();
824 823
825 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt er) 824 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt er)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 { 885 {
887 rareInheritedData.access()->quotes = q; 886 rareInheritedData.access()->quotes = q;
888 } 887 }
889 888
890 void ComputedStyle::clearCursorList() 889 void ComputedStyle::clearCursorList()
891 { 890 {
892 if (rareInheritedData->cursorData) 891 if (rareInheritedData->cursorData)
893 rareInheritedData.access()->cursorData = nullptr; 892 rareInheritedData.access()->cursorData = nullptr;
894 } 893 }
895 894
895 static bool hasPropertyThatCreatesStackingContext(const Vector<CSSPropertyID>& p roperties)
896 {
897 for (CSSPropertyID property : properties) {
898 switch (property) {
899 case CSSPropertyOpacity:
900 case CSSPropertyTransform:
901 case CSSPropertyAliasWebkitTransform:
902 case CSSPropertyTransformStyle:
903 case CSSPropertyAliasWebkitTransformStyle:
904 case CSSPropertyPerspective:
905 case CSSPropertyAliasWebkitPerspective:
906 case CSSPropertyWebkitMask:
907 case CSSPropertyWebkitMaskBoxImage:
908 case CSSPropertyWebkitClipPath:
909 case CSSPropertyWebkitBoxReflect:
910 case CSSPropertyWebkitFilter:
911 case CSSPropertyBackdropFilter:
912 case CSSPropertyZIndex:
913 case CSSPropertyPosition:
914 case CSSPropertyMixBlendMode:
915 case CSSPropertyIsolation:
916 return true;
917 default:
918 break;
919 }
920 }
921 return false;
922 }
923
924 void ComputedStyle::updateIsStackingContext(bool isDocumentElement, bool isInTop Layer)
925 {
926 if (isStackingContext())
927 return;
928
929 if (isDocumentElement
930 || isInTopLayer
931 || styleType() == PseudoIdBackdrop
932 || hasOpacity()
933 || hasTransformRelatedProperty()
934 || hasMask()
935 || clipPath()
936 || boxReflect()
937 || hasFilterInducingProperty()
938 || hasBlendMode()
939 || hasIsolation()
940 || hasViewportConstrainedPosition()
941 || hasPropertyThatCreatesStackingContext(willChangeProperties())
942 || containsPaint()) {
943 setIsStackingContext(true);
944 }
945 }
946
896 void ComputedStyle::addCallbackSelector(const String& selector) 947 void ComputedStyle::addCallbackSelector(const String& selector)
897 { 948 {
898 if (!rareNonInheritedData->m_callbackSelectors.contains(selector)) 949 if (!rareNonInheritedData->m_callbackSelectors.contains(selector))
899 rareNonInheritedData.access()->m_callbackSelectors.append(selector); 950 rareNonInheritedData.access()->m_callbackSelectors.append(selector);
900 } 951 }
901 952
902 void ComputedStyle::setContent(ContentData* contentData) 953 void ComputedStyle::setContent(ContentData* contentData)
903 { 954 {
904 SET_VAR(rareNonInheritedData, m_content, contentData); 955 SET_VAR(rareNonInheritedData, m_content, contentData);
905 } 956 }
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 if (value < 0) 1924 if (value < 0)
1874 fvalue -= 0.5f; 1925 fvalue -= 0.5f;
1875 else 1926 else
1876 fvalue += 0.5f; 1927 fvalue += 0.5f;
1877 } 1928 }
1878 1929
1879 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 1930 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
1880 } 1931 }
1881 1932
1882 } // namespace blink 1933 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698