Commit 50fa4991 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Fix ScrollbarAppearanceTest.NativeScrollbarChangeToMobileByEmulator

As above.

This iterates over all the scrollable areas, and marks their respective
layout objects as requiring layout.

This is required as LayoutNG has caches more items than in the existing
LayoutNG, and nothing marks the layout_box with the scrollbar as needing
layout.

This is similar to the kPaintChange, which invalidates paint all of paint
when something like high-contrast mode is enabled.

Bug: 922456
Change-Id: Ie65b14872a832b73b197247c06ce77727d8e6aec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1476811
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638247}
parent 463e5242
...@@ -574,6 +574,7 @@ ...@@ -574,6 +574,7 @@
{ {
name: "forceAndroidOverlayScrollbar", name: "forceAndroidOverlayScrollbar",
initial: false, initial: false,
invalidate: "ScrollbarLayout",
}, },
// Set the timeout seconds of the network-quiet timers in IdlenessDetector. // Set the timeout seconds of the network-quiet timers in IdlenessDetector.
......
...@@ -68,6 +68,7 @@ class CORE_EXPORT SettingsDelegate { ...@@ -68,6 +68,7 @@ class CORE_EXPORT SettingsDelegate {
kPluginsChange, kPluginsChange,
kHighlightAdsChange, kHighlightAdsChange,
kPaintChange, kPaintChange,
kScrollbarLayoutChange,
}; };
virtual void SettingsChanged(ChangeType) = 0; virtual void SettingsChanged(ChangeType) = 0;
......
...@@ -1432,10 +1432,6 @@ TEST_P(ScrollbarAppearanceTest, ...@@ -1432,10 +1432,6 @@ TEST_P(ScrollbarAppearanceTest,
#else #else
TEST_P(ScrollbarAppearanceTest, NativeScrollbarChangeToMobileByEmulator) { TEST_P(ScrollbarAppearanceTest, NativeScrollbarChangeToMobileByEmulator) {
#endif #endif
// TODO(crbug.com/934634): This test fails with LayoutNG.
if (RuntimeEnabledFeatures::LayoutNGEnabled())
return;
ScopedTestingPlatformSupport<ScrollbarTestingPlatformSupport> platform; ScopedTestingPlatformSupport<ScrollbarTestingPlatformSupport> platform;
bool use_overlay_scrollbar = GetParam(); bool use_overlay_scrollbar = GetParam();
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include "third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h" #include "third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h"
#include "third_party/blink/renderer/core/page/spatial_navigation_controller.h" #include "third_party/blink/renderer/core/page/spatial_navigation_controller.h"
#include "third_party/blink/renderer/core/page/validation_message_client_impl.h" #include "third_party/blink/renderer/core/page/validation_message_client_impl.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h" #include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h" #include "third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h"
...@@ -664,7 +665,7 @@ void Page::SettingsChanged(SettingsDelegate::ChangeType change_type) { ...@@ -664,7 +665,7 @@ void Page::SettingsChanged(SettingsDelegate::ChangeType change_type) {
} }
break; break;
} }
case SettingsDelegate::kPaintChange: case SettingsDelegate::kPaintChange: {
for (Frame* frame = MainFrame(); frame; for (Frame* frame = MainFrame(); frame;
frame = frame->Tree().TraverseNext()) { frame = frame->Tree().TraverseNext()) {
auto* local_frame = DynamicTo<LocalFrame>(frame); auto* local_frame = DynamicTo<LocalFrame>(frame);
...@@ -674,6 +675,28 @@ void Page::SettingsChanged(SettingsDelegate::ChangeType change_type) { ...@@ -674,6 +675,28 @@ void Page::SettingsChanged(SettingsDelegate::ChangeType change_type) {
view->InvalidatePaintForViewAndCompositedLayers(); view->InvalidatePaintForViewAndCompositedLayers();
} }
break; break;
}
case SettingsDelegate::kScrollbarLayoutChange: {
for (Frame* frame = MainFrame(); frame;
frame = frame->Tree().TraverseNext()) {
auto* local_frame = DynamicTo<LocalFrame>(frame);
if (!local_frame)
continue;
// Iterate through all of the scrollable areas and mark their layout
// objects for layout.
if (LocalFrameView* view = local_frame->View()) {
if (const auto* scrollable_areas = view->ScrollableAreas()) {
for (const auto& scrollable_area : *scrollable_areas) {
if (auto* layout_box = scrollable_area->GetLayoutBox()) {
layout_box->SetNeedsLayout(
layout_invalidation_reason::kScrollbarChanged);
}
}
}
}
}
break;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment