summaryrefslogtreecommitdiff
path: root/chromium/styleguide
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-11-18 16:35:47 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-11-18 15:45:54 +0000
commit32f5a1c56531e4210bc4cf8d8c7825d66e081888 (patch)
treeeeeec6822f4d738d8454525233fd0e2e3a659e6d /chromium/styleguide
parent99677208ff3b216fdfec551fbe548da5520cd6fb (diff)
downloadqtwebengine-chromium-32f5a1c56531e4210bc4cf8d8c7825d66e081888.tar.gz
BASELINE: Update Chromium to 87.0.4280.67
Change-Id: Ib157360be8c2ffb2c73125751a89f60e049c1d54 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/styleguide')
-rw-r--r--chromium/styleguide/c++/c++11.html15
-rw-r--r--chromium/styleguide/inclusive_code.md6
-rw-r--r--chromium/styleguide/java/java.md3
-rw-r--r--chromium/styleguide/web/es.md69
-rw-r--r--chromium/styleguide/web/web.md72
5 files changed, 49 insertions, 116 deletions
diff --git a/chromium/styleguide/c++/c++11.html b/chromium/styleguide/c++/c++11.html
index 633c649666b..1e4c7329bbd 100644
--- a/chromium/styleguide/c++/c++11.html
+++ b/chromium/styleguide/c++/c++11.html
@@ -51,7 +51,10 @@ The current status of existing standards and Abseil features is:
<li><b>C++14:</b> <i>Default allowed; see banned features below</i></li>
<li><b>C++17:</b> <i>Not yet supported in Chromium, unlikely before mid-2021; <a href="http://crbug.com/752720">tracking bug</a></i></li>
<li><b>C++20:</b> <i>Not yet standardized</i></li>
-<li><b>Abseil:</b> Initially supported July 31, 2020; see allowed/banned/TBD features below</li>
+<li><b>Abseil:</b> Initially supported July 31, 2020; see allowed/banned/TBD features below
+<ul>
+<li>absl::StatusOr: Initially supported September 3, 2020</li>
+</ul></li>
</ul></p>
@@ -405,7 +408,7 @@ absl::InlinedVector, absl::FixedArray</code></td>
<td><code>auto it = absl::c_find(container, value);</code></td>
<td>Container-based versions of algorithmic functions within C++ standard library.</td>
<td><a href="https://source.chromium.org/chromium/chromium/src/+/master:third_party/abseil-cpp/absl/algorithm/container.h">container.h</a></td>
-<td>Overlaps with <code>base/util/ranges/algorithm.h</code>.</td>
+<td>Overlaps with <code>base/ranges/algorithm.h</code>.</td>
</tr>
<tr>
@@ -442,6 +445,14 @@ size_t index = absl::Uniform(bitgen, 0u, elems.size());</code></td>
</tr>
<tr>
+<td>StatusOr</td>
+<td><code>absl::StatusOr&lt;T&gt;</td>
+<td>An object that is either a usable value, or an error Status explaining why such a value is not present.</td>
+<td><a href="https://source.chromium.org/chromium/chromium/src/+/master:third_party/abseil-cpp/absl/status/statusor.h">statusor.h</a></td>
+<td></td>
+</tr>
+
+<tr>
<td>String Formatting</td>
<td><code>absl::StrFormat</code>
<td>A typesafe replacement for the family of printf() string formatting routines.</td>
diff --git a/chromium/styleguide/inclusive_code.md b/chromium/styleguide/inclusive_code.md
index 22a03436b27..2626653d159 100644
--- a/chromium/styleguide/inclusive_code.md
+++ b/chromium/styleguide/inclusive_code.md
@@ -105,9 +105,9 @@ changing their meanings, but particular instances may need other replacements.
For a long list of changes, see [this bug](https://crbug.com/842296). Some
examples:
-* ["Blacklist"->"Blocklist" in interventions-internals UI.](https://crrev.com/1055905)
-* [Remove "whitelist" and "blacklist" from extension docs.](https://crrev.com/1056027)
-* [Declarative Net Request: Replace usages of 'blacklist' and 'whitelist'.](https://crrev.com/1094141)
+* ["Blacklist"->"Blocklist" in interventions-internals UI.](https://crrev.com/c/1055905)
+* [Remove "whitelist" and "blacklist" from extension docs.](https://crrev.com/c/1056027)
+* [Declarative Net Request: Replace usages of 'blacklist' and 'whitelist'.](https://crrev.com/c/1094141)
## Thanks
diff --git a/chromium/styleguide/java/java.md b/chromium/styleguide/java/java.md
index 36ebfcae49f..f5bc1b0d895 100644
--- a/chromium/styleguide/java/java.md
+++ b/chromium/styleguide/java/java.md
@@ -121,7 +121,8 @@ Custom finalizers:
* causes additional garbage collector jank.
Classes that need destructor logic should provide an explicit `destroy()`
-method.
+method. Use [LifetimeAssert](https://chromium.googlesource.com/chromium/src/+/master/base/android/java/src/org/chromium/base/LifetimeAssert.java)
+to ensure in debug builds and tests that `destroy()` is called.
### Other Android Support Library Annotations
* Use them! They are [documented here](https://developer.android.com/studio/write/annotations).
diff --git a/chromium/styleguide/web/es.md b/chromium/styleguide/web/es.md
index ab52d3fca29..3d7b2766c68 100644
--- a/chromium/styleguide/web/es.md
+++ b/chromium/styleguide/web/es.md
@@ -14,75 +14,6 @@
hyphen-hyphen-hyphen (change to actual hyphen)
-->
-<style>
- .doc {
- font-size: 16px;
- }
-
- .doc h3[id] {
- line-height: 20px;
- font-size: 16px;
- }
-
- .doc h3 > code {
- font-size: 16px;
- font-weight: bold;
- }
-
- .feature-container {
- background-color: #e8eef7;
- border: 1px solid #c3d9ff;
- margin-bottom: 5px;
- border-radius: 5px;
- }
-
- .feature-container > h3 {
- cursor: pointer;
- background-color: #c3d9ff;
- margin: 0;
- padding: 5px;
- border-radius: 5px;
- }
-
- .feature-container > *:not(h3){
- display: none;
- padding: 0px 10px;
- }
-
- .feature-container.open > *:not(h3){
- display: block;
- }
-</style>
-
-<script>
-document.addEventListener('DOMContentLoaded', function(event) {
- // Move all headers and corresponding contents to an accordion container.
- document.querySelectorAll('h3[id]').forEach(function(header) {
- const container = document.createElement('div');
- container.classList.add('feature-container');
- header.parentNode.insertBefore(container, header);
-
- // Add all the following siblings until it hits an <hr>.
- let el = header;
- while (el && el.tagName !== 'HR') {
- var nextEl = el.nextElementSibling;
- container.append(el);
- el = nextEl;
- }
-
- // Add handler to open accordion on click.
- header.addEventListener('click', function() {
- header.parentNode.classList.toggle('open');
- });
- });
-
- // Then remove all <hr>s since everything's accordionized.
- document.querySelectorAll('hr').forEach(function(el) {
- el.parentNode.removeChild(el);
- });
-});
-</script>
-
# ECMAScript Features in Chromium
This doc extends the [style guide](web.md#JavaScript) by specifying which new
diff --git a/chromium/styleguide/web/web.md b/chromium/styleguide/web/web.md
index 344e87e6f88..bbf61f3ce65 100644
--- a/chromium/styleguide/web/web.md
+++ b/chromium/styleguide/web/web.md
@@ -1,13 +1,3 @@
-<style>
-
-.note::before {
- content: 'Note: ';
- font-variant: small-caps;
- font-style: italic;
-}
-
-</style>
-
# Chromium Web Development Style Guide
[TOC]
@@ -25,10 +15,10 @@ This guide follows and builds on:
* [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)
* [Google Polymer Style Guide](http://go/polymer-style)
-<div class="note">
-Concerns for browser compatibility are usually not relevant for Chromium-only
-code.
-</div>
+*** aside
+Note: Concerns for browser compatibility are usually not relevant for
+Chromium-only code.
+***
## Separation of presentation and content
@@ -73,14 +63,14 @@ document.querySelector('b').onclick = fireZeeMissiles;
DON'T:
```html
<!-- missile-button.html -->
-<b style="color: red;" onclick="fireZeeMissiles()">LAUNCH BUTTON WARNING</span>
+<b style="color: red;" onclick="fireZeeMissiles()">LAUNCH BUTTON WARNING</b>
```
-<div class="note">
-For various technical and historical reasons, code using the Polymer library may
-use <code>on-event</code>-style event listener wiring and
-<code>&lt;style&gt;</code> tags that live inside of .html files.
-</div>
+*** aside
+Note: For various technical and historical reasons, code using the Polymer
+library may use `on-event`-style event listener wiring and `<style>` tags that
+live inside of .html files.
+***
## HTML
@@ -117,10 +107,10 @@ guide](https://google.github.io/styleguide/htmlcssguide.html).
* Include the appropriate JS scripts.
* Do not add JS to element event handlers.
-<div class="note">
-Polymer event handlers like <code>on-click</code> are allowed and often reduce
-the amount of addressing (adding an ID just to wire up event handling).
-</div>
+*** aside
+Note: Polymer event handlers like `on-click` are allowed and often reduce the
+amount of addressing (adding an ID just to wire up event handling).
+***
### Body
@@ -157,10 +147,10 @@ the amount of addressing (adding an ID just to wire up event handling).
* DO: `<input type="radio">`
* DON'T: `<input type="radio" />`
-<div class="note">
-All <code>&lt;custom-elements&gt;</code> and some HTML elements like
-<code>&lt;iframe&gt;</code> require closing.
-</div>
+*** aside
+Note: All `<custom-elements>` and some HTML elements like `<iframe>` require
+closing.
+***
* Use the `button` element instead of `<input type="button">`.
@@ -270,7 +260,7 @@ compatibility issues are less relevant for Chrome-only code).
background-image: url(../path/to/image.svg);
```
-The contents of file.png are base64-encoded and the `url()` is replaced with
+The contents of image.svg are base64-encoded and the `url()` is replaced with
```css
background-image: url(data:image/svg+xml;base64,...);
@@ -383,7 +373,7 @@ Also see the [Google Polymer Style Guide](http://go/polymer-style).
* event handlers, computed functions, and private methods
* Use camelCase for element IDs to simplify local DOM accessors (i.e.
- `this.$.camelCase` instead of `this.$[‘dash-case’]`).
+ `this.$.camelCase` instead of `this.$['dash-case']`).
* Use `this.foo` instead of `newFoo` arguments in observers when possible.
This makes changing the type of `this.foo` easier (as the `@type` is
@@ -435,18 +425,18 @@ Chromium.
### Preprocessing
Grit can be used to selectively include or exclude code at compile-time in web
-code. Preprocessing is be enabled by adding the `preprocess="true"` attribute
+code. Preprocessing is enabled by adding the `preprocess="true"` attribute
inside of a `.grd` file on `<structure>` and `<include>` nodes.
-<div class="note">
-These preprocesor statements can live in places that surprise linters or
-formatters (for example: running clang-format on a .js file with an &lt;if&gt;
-in it). Generally, putting these language-invalid features inside of comments
+*** aside
+Note: These preprocessor statements can live in places that surprise linters or
+formatters (for example: running clang-format on a .js file with an `<if>` in
+it). Generally, putting these language-invalid features inside of comments
helps alleviate problems with unexpected input.
-</div>
+***
`<if>` tags allow conditional logic by evaluating an expression in a
-compile-time environment of grit variables. These allow conditionally include
+compile-time environment of grit variables. These allow conditionally including
or excluding code.
Example:
@@ -466,10 +456,10 @@ Instead, use JS imports in new pages and pages that use JS modules.
Grit can read and inline resources when enabled via `flattenhtml="true"`.
-<div class="note">
-The implementation of flattening does HTML parsing and URL detection via regular
-expresions and is not guaranteed to work in all cases.
-</div>
+*** aside
+Note: The implementation of flattening does HTML parsing and URL detection via regular
+expressions and is not guaranteed to work in all cases.
+***
Example: