[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,98 +2,152 @@
|
||||
id: wiki-2026-0508-render-tree
|
||||
title: Render Tree
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [Browser-Render-Tree, Layout-Tree]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [browser, rendering, performance, web]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: javascript
|
||||
framework: web-platform
|
||||
---
|
||||
|
||||
# [[Render Tree|Render Tree]]
|
||||
# Render Tree
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
렌더 트리(Render Tree)는 웹 브라우저의 렌더링 과정에서 DOM(문서 객체 모델)과 [[CSSOM|CSSOM]](CSS 객체 모델)이 결합하여 만들어지는 구조입니다 [1-3]. 이 트리는 화면에 시각적으로 출력되어야 하는 노드들과 해당 노드들의 계산된 스타일 정보만을 포함합니다 [3-5]. 완성된 렌더 트리는 이후 화면에서 각 요소의 정확한 위치와 크기를 계산하는 레이아웃(Layout) 단계와 실제 픽셀을 그리는 페인트(Paint) 단계의 핵심 입력 데이터로 사용됩니다 [1, 6, 7].
|
||||
## 매 한 줄
|
||||
> **"매 DOM × CSSOM = Render Tree"**. Browser는 매 parsed HTML (DOM) 과 매 styles (CSSOM) 을 매 merge — visible nodes만 매 골라 layout, paint, composite의 input 으로 사용. 2026 Chromium은 매 LayoutNG + RenderingNG로 매 진화.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **생성 과정:**
|
||||
브라우저는 DOM 트리의 루트에서부터 시작하여 화면에 표시되는(visible) 각 노드를 순회하며 렌더 트리를 구성합니다 [3, 5, 8]. 화면에 표시되는 각각의 노드에 대해 브라우저는 CSSOM에서 일치하는 적절한 규칙을 찾아 적용하며, 최종적으로 콘텐츠와 계산된 스타일을 함께 포함하는 렌더 트리를 완성합니다 [4, 5].
|
||||
## 매 핵심
|
||||
|
||||
* **포함 및 제외 요소의 기준:**
|
||||
렌더 트리는 시각적 레이아웃에 영향을 미치는 요소들만 포함합니다 [1]. 따라서 `<head>`, `<script>`, `<meta>`와 같이 시각적 정보가 없는 노드들은 렌더 트리에서 제외됩니다 [1, 3, 5, 8]. 또한 CSS에서 `display: none` 속성이 적용된 요소와 그 자식 노드들 역시 화면의 레이아웃 공간을 차지하지 않기 때문에 렌더 트리에서 완전히 누락됩니다 [1, 3, 5, 9]. 반면에 `visibility: hidden` 속성이 적용된 요소는 화면에 보이지는 않지만 여전히 공간을 차지하므로 렌더 트리에는 포함됩니다 [8, 10].
|
||||
### 매 Pipeline (Critical Rendering Path)
|
||||
1. **HTML → DOM** (tokenize + tree construct).
|
||||
2. **CSS → CSSOM** (parse stylesheets, compute cascade).
|
||||
3. **DOM + CSSOM → Render Tree** — 매 `display: none` 노드는 매 제외, `::before`/`::after` 매 포함.
|
||||
4. **Layout (Reflow)** — geometry 계산.
|
||||
5. **Paint** — pixel commands → layers.
|
||||
6. **Composite** — GPU layer merge → screen.
|
||||
|
||||
* **렌더링 파이프라인에서의 역할 (레이아웃 및 페인트):**
|
||||
렌더 트리가 합성되고 나면 브라우저는 이를 바탕으로 각 요소의 기하학적 형태(크기와 위치)를 결정하는 레이아웃(Layout 또는 Reflow) 단계를 진행합니다 [6, 11, 12]. 레이아웃 단계가 완료되면, 렌더 트리의 노드들을 화면의 실제 픽셀로 변환하는 페인트(Paint) 단계가 이어집니다 [13-15].
|
||||
### 매 Render Tree ≠ DOM
|
||||
- DOM 의 모든 노드 의 X. `<head>`, `<script>`, `display:none` 매 제외.
|
||||
- `visibility: hidden` 의 매 포함됨 (매 space 차지).
|
||||
- Pseudo-elements (`::before`) 매 추가됨 (DOM 에 없음).
|
||||
|
||||
* **성능 최적화 관점:**
|
||||
새로운 노드가 추가되거나, 콘텐츠가 변경되거나, 노드의 박스 모델 스타일이 업데이트되는 등 렌더 트리에 수정이 발생할 때마다 레이아웃(Reflow) 단계가 다시 발생하게 됩니다 [16]. 렌더 트리의 노드 수가 많을수록, 그리고 적용된 스타일이 복잡할수록(예: 단색 배경 대신 그림자 효과 사용 등) 레이아웃과 페인트에 소요되는 시간이 길어지기 때문에 DOM 트리와 CSSOM을 최적화하는 것이 프론트엔드 성능 개선의 핵심입니다 [13, 16, 17].
|
||||
### 매 Blocking
|
||||
- **CSS 의 render-blocking by default**: CSSOM 완성 전에는 매 render tree 못 만듦.
|
||||
- `<script>` 의 parser-blocking — `defer`/`async`로 완화.
|
||||
- `<link rel="preload">` + `media` query 매 selective load.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** [[DOM|DOM]], CSSOM, [[Critical Rendering Path|Critical Rendering Path]], Layout, Paint
|
||||
- **Projects/Contexts:** 브라우저 렌더링 최적화([[Browser|Browser]] Rendering Optimization), 프론트엔드 성능 엔지니어링([[Frontend|Frontend]] Performance Engineering)
|
||||
- **Contradictions/Notes:** 제공된 소스 간의 모순은 발견되지 않았으며, 모든 자료가 렌더 트리를 'DOM과 CSSOM의 결합이자 화면에 렌더링되는 시각적 요소들만의 집합'으로 일관되게 정의하고 있습니다.
|
||||
### 매 2026 modern state (RenderingNG)
|
||||
- **LayoutNG** — fragment tree로 매 incremental, isolation.
|
||||
- **CompositeAfterPaint (CAP)** — paint ordering 의 매 composite 단계로 통합.
|
||||
- **Off-main-thread scrolling/animation** — composite-only properties (`transform`, `opacity`) 매 main thread skip.
|
||||
- **CSS Containment** (`contain: layout paint`) — subtree isolation.
|
||||
- **content-visibility: auto** — 매 viewport 외 subtree skip layout/paint.
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-25*
|
||||
### 매 응용
|
||||
1. Critical CSS inline → 매 first paint 단축.
|
||||
2. `content-visibility: auto` 매 long page virtualization.
|
||||
3. `will-change: transform` 매 layer promotion hint.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
|
||||
- **과거 데이터와의 충돌:** 없음
|
||||
- **정책 변화:** 없음
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
### Critical CSS inline
|
||||
```html
|
||||
<head>
|
||||
<style>
|
||||
/* above-the-fold only */
|
||||
.hero { font-size: 3rem; color: #111; }
|
||||
</style>
|
||||
<link rel="preload" href="/main.css" as="style" onload="this.rel='stylesheet'">
|
||||
</head>
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### content-visibility virtualization
|
||||
```css
|
||||
article.long-section {
|
||||
content-visibility: auto;
|
||||
contain-intrinsic-size: 0 1000px; /* placeholder size */
|
||||
}
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Composite-only animation (avoid layout/paint)
|
||||
```css
|
||||
.menu { transform: translateX(-100%); transition: transform 200ms ease; }
|
||||
.menu.open { transform: translateX(0); }
|
||||
/* GPU composites; main thread free */
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Avoid layout thrashing
|
||||
```javascript
|
||||
// BAD: read-write-read-write triggers sync layout each iter
|
||||
for (const el of items) {
|
||||
el.style.width = el.offsetWidth + 10 + 'px';
|
||||
}
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
// GOOD: batch reads, then batch writes
|
||||
const widths = items.map(el => el.offsetWidth);
|
||||
items.forEach((el, i) => { el.style.width = widths[i] + 10 + 'px'; });
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### CSS Containment
|
||||
```css
|
||||
.card {
|
||||
contain: layout style paint;
|
||||
/* descendant changes can't affect outside */
|
||||
}
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### Render-blocking analysis
|
||||
```javascript
|
||||
// Find render-blocking resources via PerformanceObserver
|
||||
new PerformanceObserver((list) => {
|
||||
for (const entry of list.getEntries()) {
|
||||
if (entry.renderBlockingStatus === 'blocking') {
|
||||
console.warn('blocking:', entry.name);
|
||||
}
|
||||
}
|
||||
}).observe({ type: 'resource', buffered: true });
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| First-paint 단축 | Critical CSS inline + async/defer JS |
|
||||
| Long scrollable page | `content-visibility: auto` |
|
||||
| Smooth animation | Composite-only (transform/opacity) + `will-change` |
|
||||
| Widget isolation | `contain: layout paint` |
|
||||
| Hidden tab UI | `display: none` (full skip) vs `visibility: hidden` (preserve space) |
|
||||
|
||||
**기본값**: composite-only animations, defer non-critical CSS/JS, contain on widgets.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Browser-Rendering]] · [[Critical-Rendering-Path]]
|
||||
- 변형: [[LayoutNG]] · [[RenderingNG]]
|
||||
- 응용: [[Web-Performance]] · [[Core-Web-Vitals]]
|
||||
- Adjacent: [[Reflow_and_Repaint]] · [[CSSOM]] · [[DOM]] · [[Compositor]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: performance audit explanations, CSS-perf debugging.
|
||||
**언제 X**: production profiling은 매 real Chrome DevTools / Lighthouse / WebPageTest 사용 — LLM의 매 verification은 X.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Layout thrashing**: read/write 매 interleave → forced synchronous layout.
|
||||
- **`top`/`left` animation**: triggers layout per frame; use `transform`.
|
||||
- **거대 inline `<style>`**: matched HTML cache의 invalidation. Critical only.
|
||||
- **`will-change` overuse**: 매 모든 element 에 적용 → memory blow-up.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (web.dev rendering performance, Chromium RenderingNG docs, MDN CRP).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — full rewrite covering DOM/CSSOM merge, blocking, modern RenderingNG |
|
||||
|
||||
Reference in New Issue
Block a user