refactor(render): rename `RenderView` and `RenderProtoView`

Part of #1675
Closes #1705
This commit is contained in:
Tobias Bosch 2015-05-06 11:22:28 -07:00
parent 0b1bb172c9
commit abc3de7efe
20 changed files with 76 additions and 76 deletions

View File

@ -131,10 +131,10 @@ export class DirectiveMetadata {
} }
} }
// An opaque reference to a RenderProtoView // An opaque reference to a DomProtoView
export class RenderProtoViewRef {} export class RenderProtoViewRef {}
// An opaque reference to a RenderView // An opaque reference to a DomView
export class RenderViewRef {} export class RenderViewRef {}
export class RenderViewContainerRef { export class RenderViewContainerRef {
@ -175,7 +175,7 @@ export class RenderCompiler {
createImperativeComponentProtoView(rendererId):Promise<ProtoViewDto> { return null; } createImperativeComponentProtoView(rendererId):Promise<ProtoViewDto> { return null; }
/** /**
* Compiles a single RenderProtoView. Non recursive so that * Compiles a single DomProtoView. Non recursive so that
* we don't need to serialize all possible components over the wire, * we don't need to serialize all possible components over the wire,
* but only the needed ones based on previous calls. * but only the needed ones based on previous calls.
*/ */
@ -186,7 +186,7 @@ export class RenderCompiler {
* which will be instantiated when this protoView is instantiated. * which will be instantiated when this protoView is instantiated.
* Note: We can't create new ProtoViewRefs here as we need to support cycles / recursive components. * Note: We can't create new ProtoViewRefs here as we need to support cycles / recursive components.
* @param {List<RenderProtoViewRef>} protoViewRefs * @param {List<RenderProtoViewRef>} protoViewRefs
* RenderProtoView for every element with a component in this protoView or in a view container's protoView * DomProtoView for every element with a component in this protoView or in a view container's protoView
*/ */
mergeChildComponentProtoViews(protoViewRef:RenderProtoViewRef, componentProtoViewRefs:List<RenderProtoViewRef>) { return null; } mergeChildComponentProtoViews(protoViewRef:RenderProtoViewRef, componentProtoViewRefs:List<RenderProtoViewRef>) { return null; }
} }
@ -259,7 +259,7 @@ export class Renderer {
/** /**
* This will set the value for a text node. * This will set the value for a text node.
* Note: This needs to be separate from setElementProperty as we don't have ElementBinders * Note: This needs to be separate from setElementProperty as we don't have ElementBinders
* for text nodes in the RenderProtoView either. * for text nodes in the DomProtoView either.
*/ */
setText(view:RenderViewRef, textNodeIndex:number, text:string):void {} setText(view:RenderViewRef, textNodeIndex:number, text:string):void {}

View File

@ -4,8 +4,8 @@ import {List, ListWrapper} from 'angular2/src/facade/collection';
import {isBlank, isPresent, BaseException} from 'angular2/src/facade/lang'; import {isBlank, isPresent, BaseException} from 'angular2/src/facade/lang';
import * as api from '../api'; import * as api from '../api';
import {RenderView} from './view/view'; import {DomView} from './view/view';
import {RenderProtoView} from './view/proto_view'; import {DomProtoView} from './view/proto_view';
import {ViewFactory} from './view/view_factory'; import {ViewFactory} from './view/view_factory';
import {RenderViewHydrator} from './view/view_hydrator'; import {RenderViewHydrator} from './view/view_hydrator';
import {ShadowDomStrategy} from './shadow_dom/shadow_dom_strategy'; import {ShadowDomStrategy} from './shadow_dom/shadow_dom_strategy';
@ -23,7 +23,7 @@ function _resolveProtoView(protoViewRef:DirectDomProtoViewRef) {
return isPresent(protoViewRef) ? protoViewRef.delegate : null; return isPresent(protoViewRef) ? protoViewRef.delegate : null;
} }
function _wrapView(view:RenderView) { function _wrapView(view:DomView) {
return new DirectDomViewRef(view); return new DirectDomViewRef(view);
} }
@ -44,18 +44,18 @@ function _collectComponentChildViewRefs(view, target = null) {
// public so that the compiler can use it. // public so that the compiler can use it.
export class DirectDomProtoViewRef extends api.RenderProtoViewRef { export class DirectDomProtoViewRef extends api.RenderProtoViewRef {
delegate:RenderProtoView; delegate:DomProtoView;
constructor(delegate:RenderProtoView) { constructor(delegate:DomProtoView) {
super(); super();
this.delegate = delegate; this.delegate = delegate;
} }
} }
export class DirectDomViewRef extends api.RenderViewRef { export class DirectDomViewRef extends api.RenderViewRef {
delegate:RenderView; delegate:DomView;
constructor(delegate:RenderView) { constructor(delegate:DomView) {
super(); super();
this.delegate = delegate; this.delegate = delegate;
} }

View File

@ -33,11 +33,11 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
return false; return false;
} }
attachTemplate(el, view:viewModule.RenderView) { attachTemplate(el, view:viewModule.DomView) {
moveViewNodesIntoParent(el, view); moveViewNodesIntoParent(el, view);
} }
constructLightDom(lightDomView:viewModule.RenderView, shadowDomView:viewModule.RenderView, el): LightDom { constructLightDom(lightDomView:viewModule.DomView, shadowDomView:viewModule.DomView, el): LightDom {
return new LightDom(lightDomView, shadowDomView, el); return new LightDom(lightDomView, shadowDomView, el);
} }

View File

@ -21,14 +21,14 @@ class _Root {
// once interfaces are supported // once interfaces are supported
export class LightDom { export class LightDom {
// The light DOM of the element is enclosed inside the lightDomView // The light DOM of the element is enclosed inside the lightDomView
lightDomView:viewModule.RenderView; lightDomView:viewModule.DomView;
// The shadow DOM // The shadow DOM
shadowDomView:viewModule.RenderView; shadowDomView:viewModule.DomView;
// The nodes of the light DOM // The nodes of the light DOM
nodes:List; nodes:List;
roots:List<_Root>; roots:List<_Root>;
constructor(lightDomView:viewModule.RenderView, shadowDomView:viewModule.RenderView, element) { constructor(lightDomView:viewModule.DomView, shadowDomView:viewModule.DomView, element) {
this.lightDomView = lightDomView; this.lightDomView = lightDomView;
this.shadowDomView = shadowDomView; this.shadowDomView = shadowDomView;
this.nodes = DOM.childNodesAsList(element); this.nodes = DOM.childNodesAsList(element);
@ -45,7 +45,7 @@ export class LightDom {
} }
// Collects the Content directives from the view and all its child views // Collects the Content directives from the view and all its child views
_collectAllContentTags(view: viewModule.RenderView, acc:List<Content>):List<Content> { _collectAllContentTags(view: viewModule.DomView, acc:List<Content>):List<Content> {
var contentTags = view.contentTags; var contentTags = view.contentTags;
var vcs = view.viewContainers; var vcs = view.viewContainers;
for (var i=0; i<vcs.length; i++) { for (var i=0; i<vcs.length; i++) {

View File

@ -22,7 +22,7 @@ export class NativeShadowDomStrategy extends ShadowDomStrategy {
this.styleUrlResolver = styleUrlResolver; this.styleUrlResolver = styleUrlResolver;
} }
attachTemplate(el, view:viewModule.RenderView){ attachTemplate(el, view:viewModule.DomView){
moveViewNodesIntoParent(DOM.createShadowRoot(el), view); moveViewNodesIntoParent(DOM.createShadowRoot(el), view);
} }

View File

@ -9,9 +9,9 @@ export class ShadowDomStrategy {
return true; return true;
} }
attachTemplate(el, view:viewModule.RenderView) {} attachTemplate(el, view:viewModule.DomView) {}
constructLightDom(lightDomView:viewModule.RenderView, shadowDomView:viewModule.RenderView, el): LightDom { constructLightDom(lightDomView:viewModule.DomView, shadowDomView:viewModule.DomView, el): LightDom {
return null; return null;
} }

View File

@ -7,7 +7,7 @@ import * as protoViewModule from './proto_view';
export class ElementBinder { export class ElementBinder {
contentTagSelector: string; contentTagSelector: string;
textNodeIndices: List<number>; textNodeIndices: List<number>;
nestedProtoView: protoViewModule.RenderProtoView; nestedProtoView: protoViewModule.DomProtoView;
eventLocals: AST; eventLocals: AST;
localEvents: List<Event>; localEvents: List<Event>;
globalEvents: List<Event>; globalEvents: List<Event>;

View File

@ -6,7 +6,7 @@ import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection
import {ElementBinder} from './element_binder'; import {ElementBinder} from './element_binder';
import {NG_BINDING_CLASS} from '../util'; import {NG_BINDING_CLASS} from '../util';
export class RenderProtoView { export class DomProtoView {
element; element;
elementBinders:List<ElementBinder>; elementBinders:List<ElementBinder>;
isTemplateElement:boolean; isTemplateElement:boolean;
@ -30,7 +30,7 @@ export class RenderProtoView {
} }
} }
mergeChildComponentProtoViews(componentProtoViews:List<RenderProtoView>) { mergeChildComponentProtoViews(componentProtoViews:List<DomProtoView>) {
var componentProtoViewIndex = 0; var componentProtoViewIndex = 0;
for (var i=0; i<this.elementBinders.length; i++) { for (var i=0; i<this.elementBinders.length; i++) {
var eb = this.elementBinders[i]; var eb = this.elementBinders[i];

View File

@ -6,7 +6,7 @@ import {
ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver
} from 'angular2/change_detection'; } from 'angular2/change_detection';
import {RenderProtoView} from './proto_view'; import {DomProtoView} from './proto_view';
import {ElementBinder, Event} from './element_binder'; import {ElementBinder, Event} from './element_binder';
import {setterFactory} from './property_setter_factory'; import {setterFactory} from './property_setter_factory';
@ -43,7 +43,7 @@ export class ProtoViewBuilder {
bindVariable(name, value) { bindVariable(name, value) {
// Store the variable map from value to variable, reflecting how it will be used later by // Store the variable map from value to variable, reflecting how it will be used later by
// RenderView. When a local is set to the view, a lookup for the variable name will take place keyed // DomView. When a local is set to the view, a lookup for the variable name will take place keyed
// by the "value", or exported identifier. For example, ng-repeat sets a view local of "index". // by the "value", or exported identifier. For example, ng-repeat sets a view local of "index".
// When this occurs, a lookup keyed by "index" must occur to find if there is a var referencing // When this occurs, a lookup keyed by "index" must occur to find if there is a var referencing
// it. // it.
@ -102,7 +102,7 @@ export class ProtoViewBuilder {
})); }));
}); });
return new api.ProtoViewDto({ return new api.ProtoViewDto({
render: new directDomRenderer.DirectDomProtoViewRef(new RenderProtoView({ render: new directDomRenderer.DirectDomProtoViewRef(new DomProtoView({
element: this.rootElement, element: this.rootElement,
elementBinders: renderElementBinders, elementBinders: renderElementBinders,
imperativeRendererId: this.imperativeRendererId imperativeRendererId: this.imperativeRendererId
@ -192,7 +192,7 @@ export class ElementBinderBuilder {
this.nestedProtoView.bindVariable(name, value); this.nestedProtoView.bindVariable(name, value);
} else { } else {
// Store the variable map from value to variable, reflecting how it will be used later by // Store the variable map from value to variable, reflecting how it will be used later by
// RenderView. When a local is set to the view, a lookup for the variable name will take place keyed // DomView. When a local is set to the view, a lookup for the variable name will take place keyed
// by the "value", or exported identifier. For example, ng-repeat sets a view local of "index". // by the "value", or exported identifier. For example, ng-repeat sets a view local of "index".
// When this occurs, a lookup keyed by "index" must occur to find if there is a var referencing // When this occurs, a lookup keyed by "index" must occur to find if there is a var referencing
// it. // it.

View File

@ -3,7 +3,7 @@ import {ListWrapper, MapWrapper, Map, StringMapWrapper, List} from 'angular2/src
import {int, isPresent, isBlank, BaseException} from 'angular2/src/facade/lang'; import {int, isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
import {ViewContainer} from './view_container'; import {ViewContainer} from './view_container';
import {RenderProtoView} from './proto_view'; import {DomProtoView} from './proto_view';
import {LightDom} from '../shadow_dom/light_dom'; import {LightDom} from '../shadow_dom/light_dom';
import {Content} from '../shadow_dom/content_tag'; import {Content} from '../shadow_dom/content_tag';
@ -14,7 +14,7 @@ const NG_BINDING_CLASS = 'ng-binding';
/** /**
* Const of making objects: http://jsperf.com/instantiate-size-of-object * Const of making objects: http://jsperf.com/instantiate-size-of-object
*/ */
export class RenderView { export class DomView {
boundElements:List; boundElements:List;
boundTextNodes:List; boundTextNodes:List;
/// When the view is part of render tree, the DocumentFragment is empty, which is why we need /// When the view is part of render tree, the DocumentFragment is empty, which is why we need
@ -22,21 +22,21 @@ export class RenderView {
rootNodes:List; rootNodes:List;
// TODO(tbosch): move componentChildViews, viewContainers, contentTags, lightDoms into // TODO(tbosch): move componentChildViews, viewContainers, contentTags, lightDoms into
// a single array with records inside // a single array with records inside
componentChildViews: List<RenderView>; componentChildViews: List<DomView>;
viewContainers: List<ViewContainer>; viewContainers: List<ViewContainer>;
contentTags: List<Content>; contentTags: List<Content>;
lightDoms: List<LightDom>; lightDoms: List<LightDom>;
hostLightDom: LightDom; hostLightDom: LightDom;
proto: RenderProtoView; proto: DomProtoView;
hydrated: boolean; hydrated: boolean;
_eventDispatcher: any/*EventDispatcher*/; _eventDispatcher: any/*EventDispatcher*/;
eventHandlerRemovers: List<Function>; eventHandlerRemovers: List<Function>;
/// Host views that were added by an imperative view. /// Host views that were added by an imperative view.
/// This is a dynamically growing / shrinking array. /// This is a dynamically growing / shrinking array.
imperativeHostViews: List<RenderView>; imperativeHostViews: List<DomView>;
constructor( constructor(
proto:RenderProtoView, rootNodes:List, proto:DomProtoView, rootNodes:List,
boundTextNodes: List, boundElements:List, contentTags:List) { boundTextNodes: List, boundElements:List, contentTags:List) {
this.proto = proto; this.proto = proto;
this.rootNodes = rootNodes; this.rootNodes = rootNodes;

View File

@ -5,18 +5,18 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
import * as viewModule from './view'; import * as viewModule from './view';
export class ViewContainer { export class ViewContainer {
parentView: viewModule.RenderView; parentView: viewModule.DomView;
boundElementIndex: number; boundElementIndex: number;
views: List<viewModule.RenderView>; views: List<viewModule.DomView>;
constructor(parentView: viewModule.RenderView, boundElementIndex: number) { constructor(parentView: viewModule.DomView, boundElementIndex: number) {
this.parentView = parentView; this.parentView = parentView;
this.boundElementIndex = boundElementIndex; this.boundElementIndex = boundElementIndex;
// The order in this list matches the DOM order. // The order in this list matches the DOM order.
this.views = []; this.views = [];
} }
get(index: number): viewModule.RenderView { get(index: number): viewModule.DomView {
return this.views[index]; return this.views[index];
} }
@ -48,7 +48,7 @@ export class ViewContainer {
} }
} }
insert(view, atIndex=-1): viewModule.RenderView { insert(view, atIndex=-1): viewModule.DomView {
this._checkHydrated(); this._checkHydrated();
if (atIndex == -1) atIndex = this.views.length; if (atIndex == -1) atIndex = this.views.length;
ListWrapper.insert(this.views, atIndex, view); ListWrapper.insert(this.views, atIndex, view);

View File

@ -18,7 +18,7 @@ export const VIEW_POOL_CAPACITY = 'render.ViewFactory.viewPoolCapacity';
@Injectable() @Injectable()
export class ViewFactory { export class ViewFactory {
_poolCapacityPerProtoView:number; _poolCapacityPerProtoView:number;
_pooledViewsPerProtoView:Map<pvModule.RenderProtoView, List<viewModule.RenderView>>; _pooledViewsPerProtoView:Map<pvModule.DomProtoView, List<viewModule.DomView>>;
_eventManager:EventManager; _eventManager:EventManager;
_shadowDomStrategy:ShadowDomStrategy; _shadowDomStrategy:ShadowDomStrategy;
@ -30,11 +30,11 @@ export class ViewFactory {
this._shadowDomStrategy = shadowDomStrategy; this._shadowDomStrategy = shadowDomStrategy;
} }
createInPlaceHostView(hostElementSelector, hostProtoView:pvModule.RenderProtoView):viewModule.RenderView { createInPlaceHostView(hostElementSelector, hostProtoView:pvModule.DomProtoView):viewModule.DomView {
return this._createView(hostProtoView, hostElementSelector); return this._createView(hostProtoView, hostElementSelector);
} }
getView(protoView:pvModule.RenderProtoView):viewModule.RenderView { getView(protoView:pvModule.DomProtoView):viewModule.DomView {
var pooledViews = MapWrapper.get(this._pooledViewsPerProtoView, protoView); var pooledViews = MapWrapper.get(this._pooledViewsPerProtoView, protoView);
if (isPresent(pooledViews) && pooledViews.length > 0) { if (isPresent(pooledViews) && pooledViews.length > 0) {
return ListWrapper.removeLast(pooledViews); return ListWrapper.removeLast(pooledViews);
@ -42,7 +42,7 @@ export class ViewFactory {
return this._createView(protoView, null); return this._createView(protoView, null);
} }
returnView(view:viewModule.RenderView) { returnView(view:viewModule.DomView) {
if (view.hydrated) { if (view.hydrated) {
throw new BaseException('View is still hydrated'); throw new BaseException('View is still hydrated');
} }
@ -57,9 +57,9 @@ export class ViewFactory {
} }
} }
_createView(protoView:pvModule.RenderProtoView, inplaceElement): viewModule.RenderView { _createView(protoView:pvModule.DomProtoView, inplaceElement): viewModule.DomView {
if (isPresent(protoView.imperativeRendererId)) { if (isPresent(protoView.imperativeRendererId)) {
return new viewModule.RenderView( return new viewModule.DomView(
protoView, [], [], [], [] protoView, [], [], [], []
); );
} }
@ -80,7 +80,7 @@ export class ViewFactory {
var viewRootNodes; var viewRootNodes;
if (protoView.isTemplateElement) { if (protoView.isTemplateElement) {
var childNode = DOM.firstChild(DOM.content(rootElementClone)); var childNode = DOM.firstChild(DOM.content(rootElementClone));
viewRootNodes = []; // TODO(perf): Should be fixed size, since we could pre-compute in in pvModule.RenderProtoView viewRootNodes = []; // TODO(perf): Should be fixed size, since we could pre-compute in in pvModule.DomProtoView
// Note: An explicit loop is the fastest way to convert a DOM array into a JS array! // Note: An explicit loop is the fastest way to convert a DOM array into a JS array!
while(childNode != null) { while(childNode != null) {
ListWrapper.push(viewRootNodes, childNode); ListWrapper.push(viewRootNodes, childNode);
@ -119,7 +119,7 @@ export class ViewFactory {
contentTags[binderIdx] = contentTag; contentTags[binderIdx] = contentTag;
} }
var view = new viewModule.RenderView( var view = new viewModule.DomView(
protoView, viewRootNodes, protoView, viewRootNodes,
boundTextNodes, boundElements, contentTags boundTextNodes, boundElements, contentTags
); );
@ -154,7 +154,7 @@ export class ViewFactory {
// This method is used by the ViewFactory and the ViewHydrator // This method is used by the ViewFactory and the ViewHydrator
// TODO(tbosch): change shadow dom emulation so that LightDom // TODO(tbosch): change shadow dom emulation so that LightDom
// instances don't need to be recreated by instead hydrated/dehydrated // instances don't need to be recreated by instead hydrated/dehydrated
static setComponentView(shadowDomStrategy:ShadowDomStrategy, hostView:viewModule.RenderView, elementIndex:number, componentView:viewModule.RenderView) { static setComponentView(shadowDomStrategy:ShadowDomStrategy, hostView:viewModule.DomView, elementIndex:number, componentView:viewModule.DomView) {
var element = hostView.boundElements[elementIndex]; var element = hostView.boundElements[elementIndex];
var lightDom = shadowDomStrategy.constructLightDom(hostView, componentView, element); var lightDom = shadowDomStrategy.constructLightDom(hostView, componentView, element);
shadowDomStrategy.attachTemplate(element, componentView); shadowDomStrategy.attachTemplate(element, componentView);

View File

@ -32,7 +32,7 @@ export class RenderViewHydrator {
this._shadowDomStrategy = shadowDomStrategy; this._shadowDomStrategy = shadowDomStrategy;
} }
hydrateDynamicComponentView(hostView:viewModule.RenderView, boundElementIndex:number, componentView:viewModule.RenderView) { hydrateDynamicComponentView(hostView:viewModule.DomView, boundElementIndex:number, componentView:viewModule.DomView) {
ViewFactory.setComponentView(this._shadowDomStrategy, hostView, boundElementIndex, componentView); ViewFactory.setComponentView(this._shadowDomStrategy, hostView, boundElementIndex, componentView);
var lightDom = hostView.lightDoms[boundElementIndex]; var lightDom = hostView.lightDoms[boundElementIndex];
this._viewHydrateRecurse(componentView, lightDom); this._viewHydrateRecurse(componentView, lightDom);
@ -41,7 +41,7 @@ export class RenderViewHydrator {
} }
} }
dehydrateDynamicComponentView(parentView:viewModule.RenderView, boundElementIndex:number) { dehydrateDynamicComponentView(parentView:viewModule.DomView, boundElementIndex:number) {
throw new BaseException('Not supported yet'); throw new BaseException('Not supported yet');
// Something along these lines: // Something along these lines:
// var componentView = parentView.componentChildViews[boundElementIndex]; // var componentView = parentView.componentChildViews[boundElementIndex];
@ -51,14 +51,14 @@ export class RenderViewHydrator {
// this._viewDehydrateRecurse(componentView); // this._viewDehydrateRecurse(componentView);
} }
hydrateInPlaceHostView(parentView:viewModule.RenderView, hostView:viewModule.RenderView) { hydrateInPlaceHostView(parentView:viewModule.DomView, hostView:viewModule.DomView) {
if (isPresent(parentView)) { if (isPresent(parentView)) {
ListWrapper.push(parentView.imperativeHostViews, hostView); ListWrapper.push(parentView.imperativeHostViews, hostView);
} }
this._viewHydrateRecurse(hostView, null); this._viewHydrateRecurse(hostView, null);
} }
dehydrateInPlaceHostView(parentView:viewModule.RenderView, hostView:viewModule.RenderView) { dehydrateInPlaceHostView(parentView:viewModule.DomView, hostView:viewModule.DomView) {
if (isPresent(parentView)) { if (isPresent(parentView)) {
ListWrapper.remove(parentView.imperativeHostViews, hostView); ListWrapper.remove(parentView.imperativeHostViews, hostView);
} }
@ -67,11 +67,11 @@ export class RenderViewHydrator {
this._viewDehydrateRecurse(hostView); this._viewDehydrateRecurse(hostView);
} }
hydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.RenderView) { hydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.DomView) {
this._viewHydrateRecurse(view, viewContainer.parentView.hostLightDom); this._viewHydrateRecurse(view, viewContainer.parentView.hostLightDom);
} }
dehydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.RenderView) { dehydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.DomView) {
this._viewDehydrateRecurse(view); this._viewDehydrateRecurse(view);
} }

View File

@ -28,7 +28,7 @@ import {
import {UrlResolver} from 'angular2/src/services/url_resolver'; import {UrlResolver} from 'angular2/src/services/url_resolver';
import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver'; import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';
import {StyleInliner} from 'angular2/src/render/dom/shadow_dom/style_inliner'; import {StyleInliner} from 'angular2/src/render/dom/shadow_dom/style_inliner';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
export function main() { export function main() {
describe('EmulatedScopedShadowDomStrategy', () => { describe('EmulatedScopedShadowDomStrategy', () => {
@ -48,7 +48,7 @@ export function main() {
var host = el('<div><span>original content</span></div>'); var host = el('<div><span>original content</span></div>');
var originalChild = DOM.childNodes(host)[0]; var originalChild = DOM.childNodes(host)[0];
var nodes = el('<div>view</div>'); var nodes = el('<div>view</div>');
var view = new RenderView(null, [nodes], [], [], []); var view = new DomView(null, [nodes], [], [], []);
strategy.attachTemplate(host, view); strategy.attachTemplate(host, view);
expect(DOM.childNodes(host)[0]).toBe(originalChild); expect(DOM.childNodes(host)[0]).toBe(originalChild);

View File

@ -23,7 +23,7 @@ import {
} from 'angular2/src/render/dom/shadow_dom/util'; } from 'angular2/src/render/dom/shadow_dom/util';
import {UrlResolver} from 'angular2/src/services/url_resolver'; import {UrlResolver} from 'angular2/src/services/url_resolver';
import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver'; import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
export function main() { export function main() {
var strategy; var strategy;
@ -43,7 +43,7 @@ export function main() {
var host = el('<div><span>original content</span></div>'); var host = el('<div><span>original content</span></div>');
var originalChild = DOM.childNodes(host)[0]; var originalChild = DOM.childNodes(host)[0];
var nodes = el('<div>view</div>'); var nodes = el('<div>view</div>');
var view = new RenderView(null, [nodes], [], [], []); var view = new DomView(null, [nodes], [], [], []);
strategy.attachTemplate(host, view); strategy.attachTemplate(host, view);
expect(DOM.childNodes(host)[0]).toBe(originalChild); expect(DOM.childNodes(host)[0]).toBe(originalChild);

View File

@ -4,11 +4,11 @@ import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
import {DOM} from 'angular2/src/dom/dom_adapter'; import {DOM} from 'angular2/src/dom/dom_adapter';
import {Content} from 'angular2/src/render/dom/shadow_dom/content_tag'; import {Content} from 'angular2/src/render/dom/shadow_dom/content_tag';
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom'; import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
import {ViewContainer} from 'angular2/src/render/dom/view/view_container'; import {ViewContainer} from 'angular2/src/render/dom/view/view_container';
@proxy @proxy
@IMPLEMENTS(RenderView) @IMPLEMENTS(DomView)
class FakeView { class FakeView {
boundElements; boundElements;
contentTags; contentTags;

View File

@ -17,7 +17,7 @@ import {
} from 'angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy'; } from 'angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy';
import {UrlResolver} from 'angular2/src/services/url_resolver'; import {UrlResolver} from 'angular2/src/services/url_resolver';
import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver'; import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
import {isPresent, isBlank} from 'angular2/src/facade/lang'; import {isPresent, isBlank} from 'angular2/src/facade/lang';
import {DOM} from 'angular2/src/dom/dom_adapter'; import {DOM} from 'angular2/src/dom/dom_adapter';
@ -35,7 +35,7 @@ export function main() {
it('should attach the view nodes to the shadow root', () => { it('should attach the view nodes to the shadow root', () => {
var host = el('<div><span>original content</span></div>'); var host = el('<div><span>original content</span></div>');
var nodes = el('<div>view</div>'); var nodes = el('<div>view</div>');
var view = new RenderView(null, [nodes], [], [], []); var view = new DomView(null, [nodes], [], [], []);
strategy.attachTemplate(host, view); strategy.attachTemplate(host, view);
var shadowRoot = DOM.getShadowRoot(host); var shadowRoot = DOM.getShadowRoot(host);

View File

@ -17,8 +17,8 @@ import {
import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang'; import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang';
import {ListWrapper} from 'angular2/src/facade/collection'; import {ListWrapper} from 'angular2/src/facade/collection';
import {ViewFactory} from 'angular2/src/render/dom/view/view_factory'; import {ViewFactory} from 'angular2/src/render/dom/view/view_factory';
import {RenderProtoView} from 'angular2/src/render/dom/view/proto_view'; import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder'; import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy'; import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy';
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom' import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom'
@ -40,7 +40,7 @@ export function main() {
if (isBlank(binders)) { if (isBlank(binders)) {
binders = []; binders = [];
} }
return new RenderProtoView({ return new DomProtoView({
element: rootEl, element: rootEl,
elementBinders: binders elementBinders: binders
}); });
@ -66,7 +66,7 @@ export function main() {
var vf = createViewFactory({ var vf = createViewFactory({
capacity: 0 capacity: 0
}); });
expect(vf.getView(pv) instanceof RenderView).toBe(true); expect(vf.getView(pv) instanceof DomView).toBe(true);
}); });
describe('caching', () => { describe('caching', () => {

View File

@ -16,9 +16,9 @@ import {
} from 'angular2/test_lib'; } from 'angular2/test_lib';
import {IMPLEMENTS, isBlank, isPresent} from 'angular2/src/facade/lang'; import {IMPLEMENTS, isBlank, isPresent} from 'angular2/src/facade/lang';
import {RenderProtoView} from 'angular2/src/render/dom/view/proto_view'; import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder'; import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy'; import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy';
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom'; import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom';
import {EventManager} from 'angular2/src/render/dom/events/event_manager'; import {EventManager} from 'angular2/src/render/dom/events/event_manager';
@ -41,7 +41,7 @@ export function main() {
if (isBlank(binders)) { if (isBlank(binders)) {
binders = []; binders = [];
} }
return new RenderProtoView({ return new DomProtoView({
element: rootEl, element: rootEl,
elementBinders: binders elementBinders: binders
}); });
@ -69,12 +69,12 @@ export function main() {
function createEmptyView() { function createEmptyView() {
var root = el('<div><div></div></div>'); var root = el('<div><div></div></div>');
return new RenderView(createProtoView(), [DOM.childNodes(root)[0]], return new DomView(createProtoView(), [DOM.childNodes(root)[0]],
[], [], []); [], [], []);
} }
function createHostView(pv, shadowDomView) { function createHostView(pv, shadowDomView) {
var view = new RenderView(pv, [el('<div></div>')], var view = new DomView(pv, [el('<div></div>')],
[], [el('<div></div>')], [null]); [], [el('<div></div>')], [null]);
ViewFactory.setComponentView(shadowDomStrategy, view, 0, shadowDomView); ViewFactory.setComponentView(shadowDomStrategy, view, 0, shadowDomView);
return view; return view;

View File

@ -17,22 +17,22 @@ import {
import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang'; import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang';
import {ListWrapper} from 'angular2/src/facade/collection'; import {ListWrapper} from 'angular2/src/facade/collection';
import {RenderProtoView} from 'angular2/src/render/dom/view/proto_view'; import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder'; import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
import {RenderView} from 'angular2/src/render/dom/view/view'; import {DomView} from 'angular2/src/render/dom/view/view';
import {ViewContainer} from 'angular2/src/render/dom/view/view_container'; import {ViewContainer} from 'angular2/src/render/dom/view/view_container';
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom'; import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom';
import {DOM} from 'angular2/src/dom/dom_adapter'; import {DOM} from 'angular2/src/dom/dom_adapter';
export function main() { export function main() {
describe('RenderView', () => { describe('DomView', () => {
function createProtoView(binders = null) { function createProtoView(binders = null) {
if (isBlank(binders)) { if (isBlank(binders)) {
binders = []; binders = [];
} }
var rootEl = el('<div></div>'); var rootEl = el('<div></div>');
return new RenderProtoView({ return new DomProtoView({
element: rootEl, element: rootEl,
elementBinders: binders elementBinders: binders
}); });
@ -47,7 +47,7 @@ export function main() {
for (var i=0; i<boundElementCount; i++) { for (var i=0; i<boundElementCount; i++) {
ListWrapper.push(boundElements, el('<span></span')); ListWrapper.push(boundElements, el('<span></span'));
} }
return new RenderView(pv, [DOM.childNodes(root)[0]], return new DomView(pv, [DOM.childNodes(root)[0]],
[], boundElements, []); [], boundElements, []);
} }