Merge branch 'master' into improvement/add-linter

This commit is contained in:
daviskoh
2015-02-05 19:51:45 -05:00

View File

@@ -44,47 +44,60 @@ var layoutTestUtils = (function() {
}; };
} }
function renderIframe() {
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
return iframe;
}
var cachedIframe; var cachedIframe;
function getIframe() { function getIframe() {
if (cachedIframe) { if (cachedIframe) {
return cachedIframe; return cachedIframe;
} }
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
var doc = iframe.contentDocument; var doc = iframe.contentDocument;
var style = document.createElement('style'); if(doc.readyState === 'complete') {
style.innerText = (function() {/* var style = document.createElement('style');
body, div { style.textContent = (function() {/*
box-sizing: border-box; body, div {
border: 0 solid black; box-sizing: border-box;
position: relative; border: 0 solid black;
position: relative;
display: flex; display: flex;
display: -webkit-flex; display: -webkit-flex;
flex-direction: column; flex-direction: column;
-webkit-flex-direction: column; -webkit-flex-direction: column;
align-items: stretch; align-items: stretch;
-webkit-align-items: stretch; -webkit-align-items: stretch;
justify-content: flex-start; justify-content: flex-start;
-webkit-justify-content: flex-start; -webkit-justify-content: flex-start;
flex-shrink: 0; flex-shrink: 0;
-webkit-flex-shrink: 0; -webkit-flex-shrink: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
hack to ignore three hundred px width of the body {} hack to ignore three hundred px width of the body {}
body > div { body > div {
align-self: flex-start; align-self: flex-start;
} }
*/} + '').slice(15, -4); */} + '').slice(15, -4);
doc.head.appendChild(style); doc.head.appendChild(style);
cachedIframe = iframe; cachedIframe = iframe;
return iframe; return iframe;
} else {
setTimeout(getIframe, 0);
}
} }
if (typeof window !== 'undefined') {
var iframe = renderIframe();
getIframe();
}
if (typeof computeLayout === 'function') { if (typeof computeLayout === 'function') {
var realComputeLayout = computeLayout; var realComputeLayout = computeLayout;