| 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() {
|
| + if (!m_view.styleRef().hasEntirelyFixedBackground()) {
|
| + // LayoutView's non-fixed-attachment background is positioned in the
|
| + // document element.
|
| + 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(
|
| + backgroundLayers)) ||
|
| + (oldSize.height() != newSize.height() &&
|
| + LayoutBox::mustInvalidateFillLayersPaintOnHeightChange(
|
| + backgroundLayers))) {
|
| + m_view.getMutableForPainting().setShouldDoFullPaintInvalidation(
|
| + PaintInvalidationViewBackground);
|
| + }
|
| + }
|
| + }
|
| + }
|
| +
|
| + return BoxPaintInvalidator(m_view, m_context).invalidatePaintIfNeeded();
|
| +}
|
| +
|
| +} // namespace blink
|
|
|