[go: nahoru, domu]

Add LayoutSuperclass<>() and DeprecatedLayoutImmediately().

LayoutSuperclass<>() invokes Layout() on behalf of a subclass. It will
be used to replace calls to base class Layout() implementations from
inside Layout() overrides.

DeprecatedLayoutImmediately() is a public accessor to
LayoutImmediately(). It will be used for all other Layout() calls, to
make it clear these will eventually be removed.

Bug: 1521108
Change-Id: I2d61890c6d3e2a594a6eb63b3e35efb9422b2b30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5242027
Reviewed-by: Allen Bauer <kylixrd@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1253567}
diff --git a/ui/views/view_nocompile.nc b/ui/views/view_nocompile.nc
index ec194fe..758d4ae 100644
--- a/ui/views/view_nocompile.nc
+++ b/ui/views/view_nocompile.nc
@@ -15,4 +15,13 @@
   }
 };
 
+// `LayoutSuperclass<SuperT>(this)` should be the only way to trigger superclass
+// layout.
+struct SuperclassLayout : public View {
+  void Layout() override {
+    LayoutSuperclass<SuperclassLayout>(this);  // expected-error {{no matching member function}}
+    LayoutSuperclass<SyncLayout>(this);        // expected-error {{no matching member function}}
+  }
+};
+
 }  // namespace views