X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Tools%2FLayoutReloaded%2FLayoutTree%2FContainer.js;h=b8dd1ee98ba779f6f5ab94549a2a57bf4dc1b903;hp=1042bf539edbbe33c1f8fccce2cc7fc130b61e1d;hb=8c186521b97d682e6552eff4818d92a55b9b6133;hpb=7790d048a826fb909fcf6e614aa85bb0b6dbe8a6;ds=sidebyside diff --git a/Tools/LayoutReloaded/LayoutTree/Container.js b/Tools/LayoutReloaded/LayoutTree/Container.js index 1042bf539edb..b8dd1ee98ba7 100644 --- a/Tools/LayoutReloaded/LayoutTree/Container.js +++ b/Tools/LayoutReloaded/LayoutTree/Container.js @@ -55,6 +55,15 @@ Layout.Container = class Container extends Layout.Box { return firstChild.nextInFlowSibling(); } + firstInFlowOrFloatChild() { + if (!this.hasChild()) + return null; + let firstChild = this.firstChild(); + if (firstChild.isInFlow() || firstChild.isFloatingPositioned()) + return firstChild; + return firstChild.nextInFlowOrFloatSibling(); + } + lastChild() { return this.m_lastChild; } @@ -75,4 +84,29 @@ Layout.Container = class Container extends Layout.Box { hasInFlowChild() { return !!this.firstInFlowChild(); } + + hasInFlowOrFloatChild() { + return !!this.firstInFlowOrFloatChild(); + } + + outOfFlowDescendants() { + if (!this.isPositioned()) + return new Array(); + let outOfFlowBoxes = new Array(); + let descendants = new Array(); + for (let child = this.firstChild(); child; child = child.nextSibling()) + descendants.push(child); + while (descendants.length) { + let descendant = descendants.pop(); + if (descendant.isOutOfFlowPositioned() && descendant.containingBlock() == this) + outOfFlowBoxes.push(descendant); + if (!descendant.isContainer()) + continue; + for (let child = descendant.lastChild(); child; child = child.previousSibling()) + descendants.push(child); + } + return outOfFlowBoxes; + } + + }