From f65febb1afb973ba087f5c50a633f063f33d12c0 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Thu, 25 Aug 2016 15:28:35 -0700 Subject: [PATCH] Remove certain computed values from output style Summary: Remove output properties from computed styles as they will be computed to their output values before we can read them. Only include them if they are explicitly set by the user. Reviewed By: IanChilds Differential Revision: D3770917 fbshipit-source-id: e55996cf8744073496debea19c36a188d2e5086c --- gentest/gentest.js | 15 ++++++++++++++- tests/CSSLayoutFlexBasisTest.cpp | 6 +----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gentest/gentest.js b/gentest/gentest.js index 0ef07f49..56e6957a 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -93,8 +93,20 @@ function setupTestTree(node, nodeName, parentName, index) { ]; for (var style in node.style) { + + // Skip position info for root as it messes up tests + if (node.declaredStyle[style] === "" && + (style == 'position' || + style == 'left' || + style == 'top' || + style == 'right' || + style == 'bottom' || + style == 'width' || + style == 'height')) { + continue; + } + if (node.style[style] !== getDefaultStyleValue(style)) { - var TODO = ''; switch (style) { case 'direction': lines.push('CSSNodeSetDirection(' + nodeName + ', ' + @@ -337,6 +349,7 @@ function calculateTree(root) { height: child.offsetHeight, children: calculateTree(child), style: getCSSLayoutStyle(child), + declaredStyle: child.style, }); } diff --git a/tests/CSSLayoutFlexBasisTest.cpp b/tests/CSSLayoutFlexBasisTest.cpp index 4bdaef3b..2fe8e344 100644 --- a/tests/CSSLayoutFlexBasisTest.cpp +++ b/tests/CSSLayoutFlexBasisTest.cpp @@ -30,14 +30,10 @@ TEST(CSSLayoutTest, flex_basis) { const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexBasis(root_child0, 100); - CSSNodeStyleSetWidth(root_child0, 200); - CSSNodeStyleSetHeight(root_child0, 100); CSSNodeInsertChild(root, root_child0, 0); const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); - CSSNodeStyleSetWidth(root_child1, 100); - CSSNodeStyleSetHeight(root_child1, 100); CSSNodeInsertChild(root, root_child1, 1); CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); @@ -55,4 +51,4 @@ TEST(CSSLayoutTest, flex_basis) { ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child1)); ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child1)); ASSERT_EQ(100, CSSNodeLayoutGetHeight(root_child1)); -} + }