Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(animations): use a lightweight renderer for non-animation components #17003

Merged
merged 1 commit into from May 26, 2017

Conversation

matsko
Copy link
Contributor

@matsko matsko commented May 24, 2017

No description provided.

@mary-poppins
Copy link

The angular.io preview for 9e61f8d is available here.

@mary-poppins
Copy link

The angular.io preview for a6bf832 is available here.

@matsko matsko force-pushed the lightweight_renderer branch 2 times, most recently from 9ad9e1f to 8f5b441 Compare May 25, 2017 20:56
@mary-poppins
Copy link

The angular.io preview for 9ad9e1f is available here.

@mary-poppins
Copy link

The angular.io preview for 8f5b441 is available here.

@matsko matsko changed the title WIP: fix(animations): use a lightweight renderer for non-animation components fix(animations): use a lightweight renderer for non-animation components May 25, 2017

import {AnimationDriver} from './animation_driver';
import {getOrSetAsInMap, listenOnPlayer, makeAnimationEvent, normalizeKeyframes, optimizeGroupPlayer} from './shared';

const EMPTY_PLAYER_ARRAY: AnimationPlayer[] = [];
const ANIMATE_EPOCH_ATTR = 'ng-animate-epoch';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a better name?

// cache the delegates to find out which cached delegate can
// be used by which cached renderer
const delegate = this.delegate.createRenderer(hostElement, type);
let renderer: BaseAnimationRenderer|undefined = this._rendererCache.get(delegate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move renderer inside of the if, as it is not needed anywhere else.

public destroyNode: ((node: any) => any)|null = null;
public microtaskCount: number = 0;
export class BaseAnimationRenderer implements Renderer2 {
public namespaceId: string = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take the namespaceId in the constructor, and make it protected.

this.delegate.removeStyle(el, style, flags);
}

setProperty(el: any, name: string, value: any): void {
if (name.charAt(0) != '@') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check is not needed...

this.delegate.appendChild(parent, newChild);
this._engine.onInsert(this._namespaceId, newChild, parent, false);
listen(target: any, eventName: string, callback: (event: any) => boolean | void): () => void {
if (eventName.charAt(0) == '@') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this logic needed for the base renderer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. it probably should go into the regular AnimationRenderer.

private delegate: RendererFactory2, private _engine: AnimationEngine, private _zone: NgZone) {
_engine.onRemovalComplete = (element: any, delegate: any) => {
private delegate: RendererFactory2, private engine: AnimationEngine, private _zone: NgZone) {
engine.onRemovalComplete = (element: any, delegate: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type the delegate to be a RendererV2.

Copy link
Contributor

@tbosch tbosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes to core and the renderer.

@mary-poppins
Copy link

The angular.io preview for 4200ab9 is available here.

@chuckjaz chuckjaz added the action: merge The PR is ready for merge by the caretaker label May 26, 2017
@chuckjaz chuckjaz merged commit 3ab86bd into angular:master May 26, 2017
chuckjaz added a commit to chuckjaz/angular that referenced this pull request May 26, 2017
matsko added a commit to matsko/angular that referenced this pull request May 26, 2017
matsko added a commit to matsko/angular that referenced this pull request May 26, 2017
chuckjaz pushed a commit that referenced this pull request May 26, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
@matsko matsko deleted the lightweight_renderer branch January 17, 2019 19:42
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: animations cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants