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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2450033002: Refine the criteria for ScrollAnchor-disabling properties (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 08db13def869a7d84a2ab03df1efeb663de58b75..935bc431515c0bc859e42937d60581a679ff7a8a 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -598,9 +598,7 @@ StyleDifference ComputedStyle::visualInvalidationDiff(
updatePropertySpecificDifferences(other, diff);
- // TODO(skobes): Refine the criteria for ScrollAnchor-disabling properties.
- // Some things set needsLayout but shouldn't disable scroll anchoring.
- if (diff.needsLayout() || diff.transformChanged())
+ if (scrollAnchorDisablingPropertyChanged(other, diff))
diff.setScrollAnchorDisablingPropertyChanged();
// Cursors are not checked, since they will be set appropriately in response
@@ -614,6 +612,35 @@ StyleDifference ComputedStyle::visualInvalidationDiff(
return diff;
}
+bool ComputedStyle::scrollAnchorDisablingPropertyChanged(
+ const ComputedStyle& other,
+ StyleDifference& diff) const {
+ if (m_nonInheritedData.m_position != other.m_nonInheritedData.m_position)
+ return true;
+
+ if (m_box.get() != other.m_box.get()) {
+ if (m_box->width() != other.m_box->width() ||
+ m_box->minWidth() != other.m_box->minWidth() ||
+ m_box->maxWidth() != other.m_box->maxWidth() ||
+ m_box->height() != other.m_box->height() ||
+ m_box->minHeight() != other.m_box->minHeight() ||
+ m_box->maxHeight() != other.m_box->maxHeight())
+ return true;
+ }
+
+ if (m_surround.get() != other.m_surround.get()) {
+ if (m_surround->margin != other.m_surround->margin ||
+ m_surround->offset != other.m_surround->offset ||
+ m_surround->padding != other.m_surround->padding)
+ return true;
+ }
+
+ if (diff.transformChanged())
+ return true;
+
+ return false;
+}
+
bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(
const ComputedStyle& other) const {
// FIXME: Not all cases in this method need both full layout and paint
« 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