@Test public void testCustomDomObject() throws Exception { WXDomObject root = new TestDomObject(); root.add(new WXListDomObject(),0); root.add(new WXScrollerDomObject(),0); root.add(new WXTextDomObject(),0); root.add(new WXSwitchDomObject(),0); root.add(new TextAreaEditTextDomObject(),0); stmt.layout(root); root.traverseTree(WXDomStatement.ApplyStyleConsumer.getInstance()); }
void layout(WXDomObject rootDom) { if (rootDom == null) { return; } long start0 = System.currentTimeMillis(); rebuildingFixedDomTree(rootDom); rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutBefore(); } }); long start = System.currentTimeMillis(); rootDom.calculateLayout(mLayoutContext); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.cssLayoutTime(System.currentTimeMillis() - start); } rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutAfter(); } }); start = System.currentTimeMillis(); rootDom.traverseTree(new ApplyUpdateConsumer()); if (instance != null) { instance.applyUpdateTime(System.currentTimeMillis() - start); } start = System.currentTimeMillis(); updateDomObj(); if (instance != null) { instance.updateDomObjTime(System.currentTimeMillis() - start); } parseAnimation(); int count = mNormalTasks.size(); for (int i = 0; i < count && !mDestroy; ++i) { mWXRenderManager.runOnThread(mInstanceId, mNormalTasks.get(i)); } mNormalTasks.clear(); mAddDom.clear(); animations.clear(); mDirty = false; if (instance != null) { instance.batchTime(System.currentTimeMillis() - start0); } }
WXDomStatement { void layout(WXDomObject rootDom) { if (rootDom == null) { return; } long start0 = System.currentTimeMillis(); rebuildingFixedDomTree(rootDom); rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutBefore(); } }); long start = System.currentTimeMillis(); rootDom.calculateLayout(mLayoutContext); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.cssLayoutTime(System.currentTimeMillis() - start); } rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutAfter(); } }); start = System.currentTimeMillis(); rootDom.traverseTree(new ApplyUpdateConsumer()); if (instance != null) { instance.applyUpdateTime(System.currentTimeMillis() - start); } start = System.currentTimeMillis(); updateDomObj(); if (instance != null) { instance.updateDomObjTime(System.currentTimeMillis() - start); } parseAnimation(); int count = mNormalTasks.size(); for (int i = 0; i < count && !mDestroy; ++i) { mWXRenderManager.runOnThread(mInstanceId, mNormalTasks.get(i)); } mNormalTasks.clear(); mAddDom.clear(); animations.clear(); mDirty = false; if (instance != null) { instance.batchTime(System.currentTimeMillis() - start0); } } }
WXDomStatement { void layout(WXDomObject rootDom) { if (rootDom == null) { return; } long start0 = System.currentTimeMillis(); rebuildingFixedDomTree(rootDom); rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutBefore(); } }); long start = System.currentTimeMillis(); rootDom.calculateLayout(mLayoutContext); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.cssLayoutTime(System.currentTimeMillis() - start); } rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutAfter(); } }); start = System.currentTimeMillis(); rootDom.traverseTree(new ApplyUpdateConsumer()); if (instance != null) { instance.applyUpdateTime(System.currentTimeMillis() - start); } start = System.currentTimeMillis(); updateDomObj(); if (instance != null) { instance.updateDomObjTime(System.currentTimeMillis() - start); } parseAnimation(); int count = mNormalTasks.size(); for (int i = 0; i < count && !mDestroy; ++i) { mWXRenderManager.runOnThread(mInstanceId, mNormalTasks.get(i)); } mNormalTasks.clear(); mAddDom.clear(); animations.clear(); mDirty = false; if (instance != null) { instance.batchTime(System.currentTimeMillis() - start0); } } WXDomStatement(String instanceId, WXRenderManager renderManager); }
WXDomStatement { void layout(WXDomObject rootDom) { if (rootDom == null) { return; } long start0 = System.currentTimeMillis(); rebuildingFixedDomTree(rootDom); rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutBefore(); } }); long start = System.currentTimeMillis(); rootDom.calculateLayout(mLayoutContext); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.cssLayoutTime(System.currentTimeMillis() - start); } rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutAfter(); } }); start = System.currentTimeMillis(); rootDom.traverseTree(new ApplyUpdateConsumer()); if (instance != null) { instance.applyUpdateTime(System.currentTimeMillis() - start); } start = System.currentTimeMillis(); updateDomObj(); if (instance != null) { instance.updateDomObjTime(System.currentTimeMillis() - start); } parseAnimation(); int count = mNormalTasks.size(); for (int i = 0; i < count && !mDestroy; ++i) { mWXRenderManager.runOnThread(mInstanceId, mNormalTasks.get(i)); } mNormalTasks.clear(); mAddDom.clear(); animations.clear(); mDirty = false; if (instance != null) { instance.batchTime(System.currentTimeMillis() - start0); } } WXDomStatement(String instanceId, WXRenderManager renderManager); void destroy(); void getComponentSize(final String ref, final JSCallback callback); }
WXDomStatement { void layout(WXDomObject rootDom) { if (rootDom == null) { return; } long start0 = System.currentTimeMillis(); rebuildingFixedDomTree(rootDom); rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutBefore(); } }); long start = System.currentTimeMillis(); rootDom.calculateLayout(mLayoutContext); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.cssLayoutTime(System.currentTimeMillis() - start); } rootDom.traverseTree( new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { if (!dom.hasUpdate() || mDestroy) { return; } dom.layoutAfter(); } }); start = System.currentTimeMillis(); rootDom.traverseTree(new ApplyUpdateConsumer()); if (instance != null) { instance.applyUpdateTime(System.currentTimeMillis() - start); } start = System.currentTimeMillis(); updateDomObj(); if (instance != null) { instance.updateDomObjTime(System.currentTimeMillis() - start); } parseAnimation(); int count = mNormalTasks.size(); for (int i = 0; i < count && !mDestroy; ++i) { mWXRenderManager.runOnThread(mInstanceId, mNormalTasks.get(i)); } mNormalTasks.clear(); mAddDom.clear(); animations.clear(); mDirty = false; if (instance != null) { instance.batchTime(System.currentTimeMillis() - start0); } } WXDomStatement(String instanceId, WXRenderManager renderManager); void destroy(); void getComponentSize(final String ref, final JSCallback callback);  }