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

Unified Diff: third_party/WebKit/Source/core/paint/ViewPaintInvalidator.cpp

Issue 2699463004: Fix gradient background invalidation when HTML size changes (Closed)
Patch Set: - Created 3 years, 10 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
Index: third_party/WebKit/Source/core/paint/ViewPaintInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/paint/ViewPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/ViewPaintInvalidator.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4a68e21520bdbcadf9cfc25d94a887d64278dc1c
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/ViewPaintInvalidator.cpp
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/paint/ViewPaintInvalidator.h"
+
+#include "core/layout/LayoutView.h"
+#include "core/paint/BoxPaintInvalidator.h"
+#include "platform/geometry/LayoutSize.h"
+
+namespace blink {
+
+PaintInvalidationReason ViewPaintInvalidator::invalidatePaintIfNeeded() {
chrishtr 2017/02/16 23:11:25 Indentation nit: if (m_view.styleRef().hasEntirel
Xianzhu 2017/02/16 23:39:35 Done.
+ if (!m_view.styleRef().hasEntirelyFixedBackground()) {
+ // LayoutView's non-fixed-attachment background is positioned in the
+ // document element.
chrishtr 2017/02/16 23:11:25 Please link to the spec here, for reference.
Xianzhu 2017/02/16 23:39:35 Done.
+ if (Element* documentElement = m_view.document().documentElement()) {
+ const LayoutObject* backgroundObject = documentElement->layoutObject();
+ if (backgroundObject && backgroundObject->isBox()) {
+ const LayoutBox& backgroundBox = toLayoutBox(*backgroundObject);
+ LayoutSize oldSize =
+ BoxPaintInvalidator::previousBorderBoxSize(backgroundBox);
+ LayoutSize newSize = backgroundBox.size();
+ const auto& backgroundLayers = m_view.styleRef().backgroundLayers();
+ if ((oldSize.width() != newSize.width() &&
+ LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(
chrishtr 2017/02/16 23:11:25 This looks like mostly the same code as LayoutView
Xianzhu 2017/02/16 23:39:35 Currently we can only reuse 4 lines of code becaus
+ backgroundLayers)) ||
+ (oldSize.height() != newSize.height() &&
+ LayoutBox::mustInvalidateFillLayersPaintOnHeightChange(
+ backgroundLayers))) {
+ m_view.getMutableForPainting().setShouldDoFullPaintInvalidation(
+ PaintInvalidationViewBackground);
+ }
+ }
+ }
+ }
+
+ return BoxPaintInvalidator(m_view, m_context).invalidatePaintIfNeeded();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698