Skip to content

Android: Refactor HierarchyOptimizer in preparation of inline view support - #8908

Closed
rigdern wants to merge 2 commits into
react:masterfrom
rigdern:rigdern/refactor-optimizer
Closed

Android: Refactor HierarchyOptimizer in preparation of inline view support#8908
rigdern wants to merge 2 commits into
react:masterfrom
rigdern:rigdern/refactor-optimizer

Conversation

@rigdern

Copy link
Copy Markdown
Contributor

This PR was split from commits originally in #8619. /cc @dmmiller

These refactorings to the HierarchyOptimizer are in preparation for implementing support for inline views in #8619.

Refactoring 1: Collapse add*LayoutOnlyNodeToLayoutOnlyNode

addLayoutOnlyNodeToLayoutOnlyNode and addNonLayoutOnlyNodeToLayoutOnlyNode
had nearly identical implementations. They both walk thru the ancestors
looking for a nonlayout-only node and adjusting the passed in index at each
step. This introduces a new function, walkUpUntilNonLayoutOnly, which
takes care of that responsibility. This simplifies addNodeToNode
because it can now consider the type of the parent and the type of
the child independently.

Refactoring 2: Extract addGrandchildren

Pull out addLayoutOnlyNode's logic into a helper called
addGrandchildren. We will need to call this method in
another place later.

Test plan (required)

This change was tested with UIExplorer and a small test app and it's being used in my team's app.

Adam Comella
Microsoft Corp.

Adam Comella added 2 commits July 19, 2016 15:26
…yNode
addLayoutOnlyNodeToLayoutOnlyNode and addNonLayoutOnlyNodeToLayoutOnlyNode
had nearly identical implementations. They both walk thru the ancestors
looking for a nonlayout-only node and adjusting the passed in index at each
step. This introduces a new function, walkUpUntilNonLayoutOnly, which
takes care of that responsibility. This simplifies addNodeToNode
because it can now consider the type of the parent and the type of
the child independently.
Pull out addLayoutOnlyNode's logic into a helper called
addGrandchildren. We will need to call this method in
another place later.
@ghost

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @dmmiller and @mkonicek to be potential reviewers.

@ghostghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jul 19, 2016
@rigdern

Copy link
Copy Markdown
ContributorAuthor

@dmmiller I considered splitting this into 2 PRs but I couldn't think of an easy way for me to do it. The second commit builds on the first one and relies on function names introduced in the first commit.

@ghostghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 20, 2016
@dmmiller

Copy link
Copy Markdown

@facebook-github-bot shipit

@ghostghost added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Jul 20, 2016
@ghost

Copy link
Copy Markdown

Thanks for importing. If you are an FB employee go to Phabricator to review internal test results.

@facebook-github-botfacebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 20, 2016
@ghostghost closed this in e1b3bbdJul 20, 2016
tungdo194 pushed a commit to tungdo194/rn-test that referenced this pull request Apr 28, 2024
…pport
Summary:
This PR was split from commits originally in #8619. /cc dmmiller
These refactorings to the HierarchyOptimizer are in preparation for implementing support for inline views in #8619.
**Refactoring 1: Collapse add*LayoutOnlyNodeToLayoutOnlyNode**
addLayoutOnlyNodeToLayoutOnlyNode and addNonLayoutOnlyNodeToLayoutOnlyNode
had nearly identical implementations. They both walk thru the ancestors
looking for a nonlayout-only node and adjusting the passed in index at each
step. This introduces a new function, walkUpUntilNonLayoutOnly, which
takes care of that responsibility. This simplifies addNodeToNode
because it can now consider the type of the parent and the type of
the child independently.
**Refactoring 2: Extract addGrandchildren**
Pull out addLayoutOnlyNode's logic into a helper called
addGrandchildren. We will need to call this method in
another place later.
**Test plan (required)**
This change was tested with UIExplorer and a small test app and it's being used in my team's app.
Closesreact/react-native#8908
Differential Revision: D3592783
Pulled By: dmmiller
fbshipit-source-id: a513e8d381e71112ce6348bbee7d4a7c62c33619
This pull request was closed.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.Import StartedThis pull request has been imported. This does not imply the PR has been approved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rigdern@dmmiller@facebook-github-bot