refactor(render): use render layer fully

Introduces angular2/src/core/compiler/ViewFactory which
extracts ProtoView.instantiate and replaces ViewPool.

Note: This is a work in progress commit to unblock other commits.
There will be follow ups to add unit tests, remove TODOs, …
This commit is contained in:
Tobias Bosch
2015-04-07 20:54:20 -07:00
parent de581ea8b3
commit 50098767fc
60 changed files with 1206 additions and 3341 deletions

View File

@ -1,7 +1,7 @@
import {AsyncTestCompleter, inject, ddescribe, describe, it, iit, xit, expect, SpyObject} from 'angular2/test_lib';
import {DOM, DomAdapter} from 'angular2/src/dom/dom_adapter';
import {NgElement} from 'angular2/src/core/dom/element';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import {Ruler, Rectangle} from 'angular2/src/services/ruler';
import {createRectangle} from './rectangle_mock';
@ -35,7 +35,7 @@ export function main() {
inject([AsyncTestCompleter], (async) => {
var ruler = new Ruler(new DomAdapterMock(createRectangle(10, 20, 200, 100)));
ruler.measure(new NgElement(null)).then((rect) => {
ruler.measure(new FakeNgElement(null)).then((rect) => {
assertDimensions(rect, 10, 210, 20, 120, 200, 100);
async.done();
});
@ -46,7 +46,7 @@ export function main() {
inject([AsyncTestCompleter], (async) => {
var ruler = new Ruler(DOM);
ruler.measure(new NgElement(DOM.createElement('div'))).then((rect) => {
ruler.measure(new FakeNgElement(DOM.createElement('div'))).then((rect) => {
//here we are using an element created in a doc fragment so all the measures will come back as 0
assertDimensions(rect, 0, 0, 0, 0, 0, 0);
async.done();
@ -55,3 +55,16 @@ export function main() {
});
}
class FakeNgElement extends NgElement {
_domElement;
constructor(domElement) {
super(null, null);
this._domElement = domElement;
}
get domElement() {
return this._domElement;
}
}