Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Side by Side Diff: third_party/WebKit/Source/core/layout/README.md

Issue 2539713004: Update layout location documentation to reflect renames. (Closed)
Patch Set: Feedback. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/line/InlineBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # `Source/core/layout` 1 # `Source/core/layout`
2 2
3 This directory contains implementation of layout objects. It covers the 3 This directory contains implementation of layout objects. It covers the
4 following document lifecycle states: 4 following document lifecycle states:
5 5
6 * LayoutSubtreeChange (`InLayoutSubtreeChange` and `LayoutSubtreeChangeClean`) 6 * LayoutSubtreeChange (`InLayoutSubtreeChange` and `LayoutSubtreeChangeClean`)
7 * PreLayout (`InPreLayout`) 7 * PreLayout (`InPreLayout`)
8 * PerformLayout (`InPerformLayout`) 8 * PerformLayout (`InPerformLayout`)
9 * AfterPerformLayout (`AfterPerformLayout` and `LayoutClean`) 9 * AfterPerformLayout (`AfterPerformLayout` and `LayoutClean`)
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 performant code, so care should be taken to understand and document any changes 205 performant code, so care should be taken to understand and document any changes
206 to flipping logic. 206 to flipping logic.
207 207
208 Blink test coverage for features used in vertical writing modes, and 208 Blink test coverage for features used in vertical writing modes, and
209 `vertical-rl` in particular, may not be as comprehensive as for horizontal 209 `vertical-rl` in particular, may not be as comprehensive as for horizontal
210 writing mode. Keep this in mind when writing new functionality or tests by 210 writing mode. Keep this in mind when writing new functionality or tests by
211 making sure to incorporate coverage for all writing modes when appropriate. 211 making sure to incorporate coverage for all writing modes when appropriate.
212 212
213 Values are generally transformed into flipped block-flow coordinates via a set 213 Values are generally transformed into flipped block-flow coordinates via a set
214 of methods on the involved layout objects. See in particular 214 of methods on the involved layout objects. See in particular
215 `flipForWritingMode()`, `flipForWritingModeForChild()`, and `topLeftLocation()`. 215 `flipForWritingMode()`, `flipForWritingModeForChild()`.
216 216
217 `InlineBox::flipForWritingMode()` variants flip the input value within the 217 `InlineBox::flipForWritingMode()` variants flip the input value within the
218 inline box's containing block. 218 inline box's containing block.
219 219
220 `LayoutBox::flipForWritingMode()` variants flip the input value within the 220 `LayoutBox::flipForWritingMode()` variants flip the input value within the
221 referenced box. 221 referenced box.
222 222
223 `LayoutBox::flipForWritingModeForChild()` variants flip the input value within 223 `LayoutBox::flipForWritingModeForChild()` variants flip the input value within
224 the referenced box, offsetting for the specified child box's current x-position 224 the referenced box, offsetting for the specified child box's current x-position
225 and width. This is useful for a common pattern wherein we build up a point 225 and width. This is useful for a common pattern wherein we build up a point
226 location starting with the current location of the (child) box. 226 location starting with the current location of the (child) box.
227 227
228 `LayoutBox::topLeftLocation()` performs flipping as needed. If the containing 228 For `LayoutBox` and `InlineBox` classes and subclasses:
229 block is not passed to the method, looking it up requires walking up the layout 229
230 tree, which can be expensive. 230 * `physicalLocation()` returns the physical location of a box or inline in the
231 containing block. `(0,0)` is the top-left corner of the containing
232 block. Flipping is performed on the values as needed. For `LayoutBox`, if the
233 containing block is not passed to `physicalLocation()`, looking it up requires
234 walking up the layout tree, which can be
235 expensive. `InlineBox::physicalLocation()` is expensive only if the `InlineBox`
236 is in flipped block-flow writing mode.
237 * `location()` returns the location of a box or inline in the "physical
238 coordinates with flipped block-flow direction" coordinate space. `(0,0)` is the
239 top-left corner of the containing block for `writing-mode` in normal blocks
240 direction (`horizontal-tb` and `vertical-lr`), and is the top-right corner of
241 the containing block for `writing-mode` in flipped block-flow direction
242 (`vertical-rl`).
231 243
232 Note there are two primary similar, but slightly different, methods regarding 244 Note there are two primary similar, but slightly different, methods regarding
233 finding the containing block for an element: 245 finding the containing block for an element:
234 246
235 * `LayoutObject::container()` returns the containing block for an element as 247 * `LayoutObject::container()` returns the containing block for an element as
236 defined by CSS. 248 defined by CSS.
237 * `LayoutObject::containingBlock()` which returns the enclosing non-anonymous 249 * `LayoutObject::containingBlock()` which returns the enclosing non-anonymous
238 block for an element. If the containing block is a relatively positioned inline, 250 block for an element. If the containing block is a relatively positioned inline,
239 it returns that inline's enclosing non-anonymous block. This is the one used by 251 it returns that inline's enclosing non-anonymous block. This is the one used by
240 `topLeftLocation()`. 252 `physicalLocation()`.
241 253
242 There are other containing block methods in `LayoutObject` for special purposes 254 There are other containing block methods in `LayoutObject` for special purposes
243 such as fixed position, absolute position, and paint invalidation. Code will 255 such as fixed position, absolute position, and paint invalidation. Code will
244 sometimes just refer to the 'containing' element, which is an unfortunately 256 sometimes just refer to the 'containing' element, which is an unfortunately
245 ambiguous term. Paying close attention to which method was used to obtain the 257 ambiguous term. Paying close attention to which method was used to obtain the
246 containing element is important. 258 containing element is important.
247 259
248 More complex web platform features such as tables, flexbox, and multicol are 260 More complex web platform features such as tables, flexbox, and multicol are
249 typically implemented atop these primitives, along with checks such as 261 typically implemented atop these primitives, along with checks such as
250 `isFlippedBlocksWritingMode()`, `isLeftToRightDirection()`, and 262 `isFlippedBlocksWritingMode()`, `isLeftToRightDirection()`, and
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 left-to-right or right-to-left block flow. Geometry is transposed for vertical 308 left-to-right or right-to-left block flow. Geometry is transposed for vertical
297 writing mode. See calls to `transposed{Rect,Point,Size}()`. 309 writing mode. See calls to `transposed{Rect,Point,Size}()`.
298 * `direction`/`dir`: "inline base direction" of a box. One of `ltr` or 310 * `direction`/`dir`: "inline base direction" of a box. One of `ltr` or
299 `rtl`. See calls to `isLeftToRightDirection()`. 311 `rtl`. See calls to `isLeftToRightDirection()`.
300 * `text-orientation`: orientation of text in a line. Only relevant for vertical 312 * `text-orientation`: orientation of text in a line. Only relevant for vertical
301 modes. 313 modes.
302 * orthogonal flow: when a box has a writing mode perpendicular to its containing 314 * orthogonal flow: when a box has a writing mode perpendicular to its containing
303 block. This can lead to complex cases. See 315 block. This can lead to complex cases. See
304 [specification](https://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows) 316 [specification](https://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows)
305 for more. 317 for more.
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/line/InlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698