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

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

Issue 2539713004: Update layout location documentation to reflect renames. (Closed)
Patch Set: 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 LayoutInline classes and subclasses:
Xianzhu 2016/11/29 23:36:29 s/LayoutInline/InlineBox/
wkorman 2016/12/01 18:53:48 Done.
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. If the containing block is
Xianzhu 2016/11/29 23:36:29 The last sentence should apply to LayoutBox only.
wkorman 2016/12/01 18:53:48 Done.
233 not passed to the method, looking it up requires walking up the layout tree,
234 which can be expensive.
235
236 `location()` returns the location of a box or inline in the "physical
237 coordinates with flipped block-flow direction" coordinate space. `(0,0)` is the
238 top-left corner of the containing block for `writing-mode` in normal blocks
239 direction (`horizontal-tb` and `vertical-lr`), and is the top-right corner of
240 the containing block for `writing-mode` in flipped block-flow direction
241 (`vertical-rl`).
231 242
232 Note there are two primary similar, but slightly different, methods regarding 243 Note there are two primary similar, but slightly different, methods regarding
233 finding the containing block for an element: 244 finding the containing block for an element:
234 245
235 * `LayoutObject::container()` returns the containing block for an element as 246 * `LayoutObject::container()` returns the containing block for an element as
236 defined by CSS. 247 defined by CSS.
237 * `LayoutObject::containingBlock()` which returns the enclosing non-anonymous 248 * `LayoutObject::containingBlock()` which returns the enclosing non-anonymous
238 block for an element. If the containing block is a relatively positioned inline, 249 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 250 it returns that inline's enclosing non-anonymous block. This is the one used by
240 `topLeftLocation()`. 251 `topLeftLocation()`.
Xianzhu 2016/11/29 23:36:29 => physicalLocation()
wkorman 2016/12/01 18:53:48 Done.
241 252
242 There are other containing block methods in `LayoutObject` for special purposes 253 There are other containing block methods in `LayoutObject` for special purposes
243 such as fixed position, absolute position, and paint invalidation. Code will 254 such as fixed position, absolute position, and paint invalidation. Code will
244 sometimes just refer to the 'containing' element, which is an unfortunately 255 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 256 ambiguous term. Paying close attention to which method was used to obtain the
246 containing element is important. 257 containing element is important.
247 258
248 More complex web platform features such as tables, flexbox, and multicol are 259 More complex web platform features such as tables, flexbox, and multicol are
249 typically implemented atop these primitives, along with checks such as 260 typically implemented atop these primitives, along with checks such as
250 `isFlippedBlocksWritingMode()`, `isLeftToRightDirection()`, and 261 `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 307 left-to-right or right-to-left block flow. Geometry is transposed for vertical
297 writing mode. See calls to `transposed{Rect,Point,Size}()`. 308 writing mode. See calls to `transposed{Rect,Point,Size}()`.
298 * `direction`/`dir`: "inline base direction" of a box. One of `ltr` or 309 * `direction`/`dir`: "inline base direction" of a box. One of `ltr` or
299 `rtl`. See calls to `isLeftToRightDirection()`. 310 `rtl`. See calls to `isLeftToRightDirection()`.
300 * `text-orientation`: orientation of text in a line. Only relevant for vertical 311 * `text-orientation`: orientation of text in a line. Only relevant for vertical
301 modes. 312 modes.
302 * orthogonal flow: when a box has a writing mode perpendicular to its containing 313 * orthogonal flow: when a box has a writing mode perpendicular to its containing
303 block. This can lead to complex cases. See 314 block. This can lead to complex cases. See
304 [specification](https://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows) 315 [specification](https://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows)
305 for more. 316 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