Skip to content

static-layout: extract getEffectiveLayout and revert amp-layout buildDom extraction#35148

Merged
samouri merged 10 commits intoampproject:mainfrom
samouri:calc-effective-layout
Jul 13, 2021
Merged

static-layout: extract getEffectiveLayout and revert amp-layout buildDom extraction#35148
samouri merged 10 commits intoampproject:mainfrom
samouri:calc-effective-layout

Conversation

@samouri
Copy link
Copy Markdown
Member

@samouri samouri commented Jul 7, 2021

summary

Commits in order:

  1. f8c14ed: Extracts getEffectiveLayout from applyStaticStyles so that layout calc can be done in isolation.
  2. b8509b5: Reverts the most recent amp-layout buildDom extraction revert (Revert: "amp-layout: extract buildDOM #compiler (#34770)" #35146)
  3. ad2586b: Utilizes getEffectiveLayout within amp-layout's buildDom instead of parseLayout

Testing done

@samouri samouri force-pushed the calc-effective-layout branch from a8958d2 to 9ec2de0 Compare July 8, 2021 03:06
@samouri samouri force-pushed the calc-effective-layout branch 2 times, most recently from c887a51 to 7da51a8 Compare July 8, 2021 19:33
@samouri samouri force-pushed the calc-effective-layout branch from 7da51a8 to ad2586b Compare July 8, 2021 20:45
@samouri samouri self-assigned this Jul 8, 2021
@samouri samouri changed the title static-layout: extract getEffectiveLayout static-layout: extract getEffectiveLayout / extract amp-layout buildDom Jul 8, 2021
@samouri samouri changed the title static-layout: extract getEffectiveLayout / extract amp-layout buildDom static-layout: extract getEffectiveLayout and revert amp-layout buildDom extraction Jul 8, 2021
@samouri samouri marked this pull request as ready for review July 8, 2021 22:20
@amp-owners-bot amp-owners-bot bot requested a review from kristoferbaxter July 8, 2021 22:20
@samouri samouri requested review from jridgewell and rcebulko and removed request for kristoferbaxter July 8, 2021 22:20
// If the layout was already done by server-side rendering (SSR), then the
// code below will not run. Any changes below will necessitate a change to SSR
// and must be coordinated with caches that implement SSR. See bit.ly/amp-ssr.
const {height, layout, width} = getEffectiveLayout(element);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does any of this code change as it is moved?

Copy link
Copy Markdown
Member Author

@samouri samouri Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change was that I return the these three values instead of them all being defined inline...I wonder if I can improve diff output.

samouri and others added 2 commits July 13, 2021 10:28
}

/**
*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*
* Some explanation of how `buildDom` is different from most functions and a link to a more detailed doc/readme on how it's consumed and what its restrictions are

Copy link
Copy Markdown
Member Author

@samouri samouri Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planned as a followup! This is intended as a small-as-possible revert of a revert

@samouri samouri force-pushed the calc-effective-layout branch from c4dcecb to 1ecd5ee Compare July 13, 2021 20:51
@samouri samouri merged commit aa1f758 into ampproject:main Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants