Skip to content

Commit

Permalink
resources: rename V1 to R1, to clear up ambiguity (#34227)
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri authored May 5, 2021
1 parent c7778e4 commit 3884a6b
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion build-system/externs/amp.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ let time;
let AmpElement = function () {};

/** @return {boolean} */
AmpElement.prototype.V1 = function () {};
AmpElement.prototype.R1 = function () {};

/** @return {boolean} */
AmpElement.prototype.deferredMount = function () {};
Expand Down
2 changes: 1 addition & 1 deletion build-system/global-configs/experiments-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"environment": "AMP",
"issue": "https://github.com/ampproject/amphtml/issues/31915",
"expiration_date_utc": "2021-06-30",
"define_experiment_constant": "V1_IMG_DEFERRED_BUILD"
"define_experiment_constant": "R1_IMG_DEFERRED_BUILD"
},
"experimentC": {}
}
2 changes: 1 addition & 1 deletion build-system/global-configs/experiments-const.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"INI_LOAD_INOB": true,
"NO_SIGNING_RTV": true,
"V1_IMG_DEFERRED_BUILD": false,
"R1_IMG_DEFERRED_BUILD": false,
"WITHIN_VIEWPORT_INOB": false
}
14 changes: 7 additions & 7 deletions builtins/amp-img.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const ATTRIBUTES_TO_PROPAGATE = [

export class AmpImg extends BaseElement {
/** @override @nocollapse */
static V1() {
return V1_IMG_DEFERRED_BUILD;
static R1() {
return R1_IMG_DEFERRED_BUILD;
}

/** @override @nocollapse */
Expand Down Expand Up @@ -141,7 +141,7 @@ export class AmpImg extends BaseElement {
guaranteeSrcForSrcsetUnsupportedBrowsers(this.img_);
}

if (AmpImg.V1() && !this.img_.complete) {
if (AmpImg.R1() && !this.img_.complete) {
this.setReadyState(ReadyState.LOADING);
}
}
Expand Down Expand Up @@ -238,8 +238,8 @@ export class AmpImg extends BaseElement {
* @private
*/
maybeGenerateSizes_(sync) {
if (V1_IMG_DEFERRED_BUILD) {
// The `getLayoutSize()` is not available for a V1 element. Skip this
if (R1_IMG_DEFERRED_BUILD) {
// The `getLayoutSize()` is not available for a R1 element. Skip this
// codepath. Also: is this feature at all useful? E.g. it doesn't even
// execute in the `i-amphtml-ssr` mode.
return;
Expand Down Expand Up @@ -367,8 +367,8 @@ export class AmpImg extends BaseElement {

/** @override */
unlayoutCallback() {
if (AmpImg.V1()) {
// TODO(#31915): Reconsider if this is still desired for V1. This helps
if (AmpImg.R1()) {
// TODO(#31915): Reconsider if this is still desired for R1. This helps
// with network interruption when a document is inactivated.
return;
}
Expand Down
32 changes: 16 additions & 16 deletions src/base-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ import {toWin} from './types';
*/
export class BaseElement {
/**
* Whether this element supports V1 protocol, which includes:
* Whether this element supports R1 protocol, which includes:
* 1. Layout/unlayout are not managed by the runtime, but instead are
* implemented by the element as needed.
* 2. The element can defer its build until later. See `deferredMount`.
Expand All @@ -119,7 +119,7 @@ export class BaseElement {
* @return {boolean}
* @nocollapse
*/
static V1() {
static R1() {
return false;
}

Expand All @@ -128,7 +128,7 @@ export class BaseElement {
* element's build will be deferred roughly based on the
* `content-visibility: auto` rules.
*
* Only used for V1 elements.
* Only used for R1 elements.
*
* @param {!AmpElement} unusedElement
* @return {boolean}
Expand Down Expand Up @@ -284,7 +284,7 @@ export class BaseElement {
*
* The default priority for base elements is LayoutPriority.CONTENT.
* @return {number}
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
getLayoutPriority() {
return LayoutPriority.CONTENT;
Expand Down Expand Up @@ -317,7 +317,7 @@ export class BaseElement {
* mainly affects fixed-position elements that are adjusted to be always
* relative to the document position in the viewport.
* @return {!./layout-rect.LayoutRectDef}
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
getLayoutBox() {
return this.element.getLayoutBox();
Expand All @@ -326,7 +326,7 @@ export class BaseElement {
/**
* Returns a previously measured layout size.
* @return {!./layout-rect.LayoutSizeDef}
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
getLayoutSize() {
return this.element.getLayoutSize();
Expand Down Expand Up @@ -437,7 +437,7 @@ export class BaseElement {
* hosts and prefetch resources it is likely to need. May be called
* multiple times because connections can time out.
* @param {boolean=} opt_onLayout
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
preconnectCallback(opt_onLayout) {
// Subclasses may override.
Expand All @@ -463,7 +463,7 @@ export class BaseElement {

/**
* Set itself as a container element that can be monitored by the scheduler
* for auto-mounting. Scheduler is used for V1 elements. A container is
* for auto-mounting. Scheduler is used for R1 elements. A container is
* usually a top-level scrollable overlay such as a lightbox or a sidebar.
* The main scheduler (`IntersectionObserver`) cannot properly handle elements
* inside a non-document scroller and this method instructs the scheduler
Expand Down Expand Up @@ -533,14 +533,14 @@ export class BaseElement {
/**
* Ensure that the element is being eagerly loaded.
*
* Only used for V1 elements.
* Only used for R1 elements.
*/
ensureLoaded() {}

/**
* Update the current `readyState`.
*
* Only used for V1 elements.
* Only used for R1 elements.
*
* @param {!./ready-state.ReadyState} state
* @param {*=} opt_failure
Expand Down Expand Up @@ -590,7 +590,7 @@ export class BaseElement {
* {@link isRelayoutNeeded} method.
*
* @return {!Promise}
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
layoutCallback() {
return Promise.resolve();
Expand All @@ -613,15 +613,15 @@ export class BaseElement {
* Requests the element to stop its activity when the document goes into
* inactive state. The scope is up to the actual component. Among other
* things the active playback of video or audio content must be stopped.
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
pauseCallback() {}

/**
* Requests the element to resume its activity when the document returns from
* an inactive state. The scope is up to the actual component. Among other
* things the active playback of video or audio content may be resumed.
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
resumeCallback() {}

Expand All @@ -632,7 +632,7 @@ export class BaseElement {
* {@link layoutCallback} in case document becomes active again.
*
* @return {boolean}
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
unlayoutCallback() {
return false;
Expand All @@ -642,7 +642,7 @@ export class BaseElement {
* Subclasses can override this method to opt-in into calling
* {@link unlayoutCallback} when paused.
* @return {boolean}
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
unlayoutOnPause() {
return false;
Expand Down Expand Up @@ -1099,7 +1099,7 @@ export class BaseElement {
* This may currently not work with extended elements. Please file
* an issue if that is required.
* @public
* TODO(#31915): remove once V1 migration is complete.
* TODO(#31915): remove once R1 migration is complete.
*/
onLayoutMeasure() {}

Expand Down
Loading

0 comments on commit 3884a6b

Please sign in to comment.