diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-03-11 11:32:04 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-03-18 13:40:17 +0000 |
commit | 31ccca0778db85c159634478b4ec7997f6704860 (patch) | |
tree | 3d33fc3afd9d5ec95541e1bbe074a9cf8da12a0e /chromium/styleguide | |
parent | 248b70b82a40964d5594eb04feca0fa36716185d (diff) | |
download | qtwebengine-chromium-31ccca0778db85c159634478b4ec7997f6704860.tar.gz |
BASELINE: Update Chromium to 80.0.3987.136
Change-Id: I98e1649aafae85ba3a83e67af00bb27ef301db7b
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'chromium/styleguide')
-rw-r--r-- | chromium/styleguide/c++/c++-dos-and-donts.md | 23 | ||||
-rw-r--r-- | chromium/styleguide/web/web.md | 26 |
2 files changed, 38 insertions, 11 deletions
diff --git a/chromium/styleguide/c++/c++-dos-and-donts.md b/chromium/styleguide/c++/c++-dos-and-donts.md index 1b5b25419af..f7906662224 100644 --- a/chromium/styleguide/c++/c++-dos-and-donts.md +++ b/chromium/styleguide/c++/c++-dos-and-donts.md @@ -37,6 +37,23 @@ void foo() { } ``` +## Explicitly declare class copyability/movability + +The +[Google Style Guide](http://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types) +says classes can omit copy/move declarations or deletions "only if they are +obvious". Because "obvious" is subjective and even the examples in the style +guide take some thought to figure out, being explicit is clear, simple, and +avoids any risk of accidental copying. + +Declare or delete these operations in the public section, between other +constructors and the destructor; `DISALLOW_COPY_AND_ASSIGN` is deprecated. For +a non-copyable/movable type, delete the copy operations (the move operations +will be implicitly deleted); otherwise, declare either copy operations, move +operations, or both (a non-declared pair will be implicitly deleted). Always +declare or delete both construction and assignment, not just one (which can +introduce subtle bugs). + ## Variable initialization There are myriad ways to initialize variables in C++11. Prefer the following @@ -263,3 +280,9 @@ The common ways to represent names in comments are as follows: // FooImpl implements the FooBase class. // FooFunction() modifies |foo_member_|. ``` + +## Named namespaces + +Named namespaces are discouraged in top-level embedders (e.g., `chrome/`). See +[this thread](https://groups.google.com/a/chromium.org/d/msg/chromium-dev/8ROncnL1t4k/J7uJMCQ8BwAJ) +for background and discussion. diff --git a/chromium/styleguide/web/web.md b/chromium/styleguide/web/web.md index 62e86bf20dc..414b8153ae9 100644 --- a/chromium/styleguide/web/web.md +++ b/chromium/styleguide/web/web.md @@ -207,8 +207,7 @@ compatibility issues are less relevant for Chrome-only code). * Alphabetize properties. * `-webkit` properties should be listed at the top, sorted alphabetically. - * `--variables` and `--mixins: {}` should be alphabetically declared when - possible. + * `--variables` should be alphabetically declared when possible. * Insert a space after the colon separating property and value. @@ -241,6 +240,16 @@ compatibility issues are less relevant for Chrome-only code). * Use scalable `font-size` units like `%` or `em` to respect users' default font size +* Don't use CSS Mixins (`--mixin: {}` or `@apply --mixin;`) in new code. [We're + removing them.](https://crbug.com/973674) + * Mixins were [dropped from CSS](https://www.xanthir.com/b4o00) in favor of + [CSS Shadow Parts](https://drafts.csswg.org/css-shadow-parts/). + * Instead, replace CSS mixin usage with one of these natively supported + alternatives: + * CSS Shadow Parts or CSS variables for styling of DOM nodes residing in + the Shadow DOM of a child node. + * Plain CSS classes, for grouping a set of styles together for easy + reuse. ### Color @@ -451,15 +460,10 @@ function isWindows() { ``` `<include src="[path]">` reads the file at `path` and replaces the `<include>` -tag with the file contents of `[path]`. - -Don't use `</include>` to close these tags; they're not needed nor supported. - -<div class="note"> -Using <code><include></code> simply pastes the entire contents of a file, -which can lead to duplication. If you simply want to ensure some code is loaded -(and usually you do), you should use HTML Imports instead. -</div> +tag with the file contents of `[path]`. Don't use `<include>` in new JS code; +[it is being removed.](https://docs.google.com/document/d/1Z18WTNv28z5FW3smNEm_GtsfVD2IL-CmmAikwjw3ryo/edit?usp=sharing#heading=h.66ycuu6hfi9n) +Instead, use JS imports in new pages and pages that use JS modules. Use HTML +imports in existing pages that are still using HTML imports/Polymer 2. Grit can read and inline resources when enabled via `flattenhtml="true"`. |