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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGrid.h

Issue 1407633003: [css-grid] Implementation of Baseline Self-Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied suggested changes. Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 const GridSizingData&) const; 265 const GridSizingData&) const;
266 LayoutUnit assumedRowsSizeForOrthogonalChild(const LayoutBox&, 266 LayoutUnit assumedRowsSizeForOrthogonalChild(const LayoutBox&,
267 SizingOperation) const; 267 SizingOperation) const;
268 268
269 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection, 269 void applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection,
270 GridSizingData&); 270 GridSizingData&);
271 271
272 void paintChildren(const PaintInfo&, const LayoutPoint&) const override; 272 void paintChildren(const PaintInfo&, const LayoutPoint&) const override;
273 273
274 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const; 274 LayoutUnit marginLogicalHeightForChild(const LayoutBox&) const;
275 LayoutUnit marginLogicalWidthForChild(const LayoutBox&) const;
275 LayoutUnit computeMarginLogicalSizeForChild(MarginDirection, 276 LayoutUnit computeMarginLogicalSizeForChild(MarginDirection,
276 const LayoutBox&) const; 277 const LayoutBox&) const;
277 LayoutUnit availableAlignmentSpaceForChildBeforeStretching( 278 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(
278 LayoutUnit gridAreaBreadthForChild, 279 LayoutUnit gridAreaBreadthForChild,
279 const LayoutBox&) const; 280 const LayoutBox&) const;
280 StyleSelfAlignmentData justifySelfForChild(const LayoutBox&) const; 281 StyleSelfAlignmentData justifySelfForChild(const LayoutBox&) const;
281 StyleSelfAlignmentData alignSelfForChild(const LayoutBox&) const; 282 StyleSelfAlignmentData alignSelfForChild(const LayoutBox&) const;
282 void applyStretchAlignmentToChildIfNeeded(LayoutBox&); 283 void applyStretchAlignmentToChildIfNeeded(LayoutBox&);
283 bool hasAutoSizeInColumnAxis(const LayoutBox& child) const { 284 bool hasAutoSizeInColumnAxis(const LayoutBox& child) const {
284 return isHorizontalWritingMode() ? child.styleRef().height().isAuto() 285 return isHorizontalWritingMode() ? child.styleRef().height().isAuto()
285 : child.styleRef().width().isAuto(); 286 : child.styleRef().width().isAuto();
286 } 287 }
287 bool hasAutoSizeInRowAxis(const LayoutBox& child) const { 288 bool hasAutoSizeInRowAxis(const LayoutBox& child) const {
288 return isHorizontalWritingMode() ? child.styleRef().width().isAuto() 289 return isHorizontalWritingMode() ? child.styleRef().width().isAuto()
289 : child.styleRef().height().isAuto(); 290 : child.styleRef().height().isAuto();
290 } 291 }
291 bool allowedToStretchChildAlongColumnAxis(const LayoutBox& child) const { 292 bool allowedToStretchChildAlongColumnAxis(const LayoutBox& child) const {
292 return alignSelfForChild(child).position() == ItemPositionStretch && 293 return alignSelfForChild(child).position() == ItemPositionStretch &&
293 hasAutoSizeInColumnAxis(child) && !hasAutoMarginsInColumnAxis(child); 294 hasAutoSizeInColumnAxis(child) && !hasAutoMarginsInColumnAxis(child);
294 } 295 }
295 bool allowedToStretchChildAlongRowAxis(const LayoutBox& child) const { 296 bool allowedToStretchChildAlongRowAxis(const LayoutBox& child) const {
296 return justifySelfForChild(child).position() == ItemPositionStretch && 297 return justifySelfForChild(child).position() == ItemPositionStretch &&
297 hasAutoSizeInRowAxis(child) && !hasAutoMarginsInRowAxis(child); 298 hasAutoSizeInRowAxis(child) && !hasAutoMarginsInRowAxis(child);
298 } 299 }
299 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const; 300 bool hasAutoMarginsInColumnAxis(const LayoutBox&) const;
300 bool hasAutoMarginsInRowAxis(const LayoutBox&) const; 301 bool hasAutoMarginsInRowAxis(const LayoutBox&) const;
301 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&); 302 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&);
302 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&); 303 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&);
304 LayoutUnit firstLineBoxBaselineForChild(const LayoutBox&) const;
305 LayoutUnit descentBaselineForChild(const LayoutBox&, LayoutUnit) const;
306 LayoutUnit updateBaselineAlignmentContextIfNeeded(LayoutBox&,
307 GridSizingData&) const;
308 LayoutUnit columnAxisBaselineOffsetForChild(const LayoutBox&,
309 const GridSizingData&) const;
310 LayoutUnit rowAxisBaselineOffsetForChild(const LayoutBox&,
311 const GridSizingData&) const;
303 312
304 int baselinePosition( 313 int baselinePosition(
305 FontBaseline, 314 FontBaseline,
306 bool firstLine, 315 bool firstLine,
307 LineDirectionMode, 316 LineDirectionMode,
308 LinePositionMode = PositionOnContainingLine) const override; 317 LinePositionMode = PositionOnContainingLine) const override;
309 int firstLineBoxBaseline() const override; 318 int firstLineBoxBaseline() const override;
310 int inlineBlockBaseline(LineDirectionMode) const override; 319 int inlineBlockBaseline(LineDirectionMode) const override;
311 bool isInlineBaselineAlignedChild(const LayoutBox* child) const; 320 bool isInlineBaselineAlignedChild(const LayoutBox& child) const;
321 bool isBlockBaselineAlignedChild(const LayoutBox& child) const;
322 bool isBaselineAlignment(const LayoutBox&) const;
312 323
313 #if ENABLE(ASSERT) 324 #if ENABLE(ASSERT)
314 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, 325 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection,
315 GridSizingData&) const; 326 GridSizingData&) const;
316 #endif 327 #endif
317 328
318 LayoutUnit gridGapForDirection(GridTrackSizingDirection, 329 LayoutUnit gridGapForDirection(GridTrackSizingDirection,
319 SizingOperation) const; 330 SizingOperation) const;
320 LayoutUnit guttersSize(GridTrackSizingDirection, 331 LayoutUnit guttersSize(GridTrackSizingDirection,
321 size_t startLine, 332 size_t startLine,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows{nullptr}; 375 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows{nullptr};
365 376
366 Optional<bool> m_hasDefiniteLogicalHeight; 377 Optional<bool> m_hasDefiniteLogicalHeight;
367 }; 378 };
368 379
369 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 380 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
370 381
371 } // namespace blink 382 } // namespace blink
372 383
373 #endif // LayoutGrid_h 384 #endif // LayoutGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698