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

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: Patch rebased and applied several refactoring and code clean up. Created 3 years, 11 months 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 19 matching lines...) Expand all
30 #include "core/layout/OrderIterator.h" 30 #include "core/layout/OrderIterator.h"
31 #include "core/style/GridPositionsResolver.h" 31 #include "core/style/GridPositionsResolver.h"
32 #include <memory> 32 #include <memory>
33 33
34 namespace blink { 34 namespace blink {
35 35
36 struct ContentAlignmentData; 36 struct ContentAlignmentData;
37 struct GridArea; 37 struct GridArea;
38 struct GridSpan; 38 struct GridSpan;
39 class GridTrack; 39 class GridTrack;
40 class BaselineGroup;
40 41
41 enum TrackSizeComputationPhase { 42 enum TrackSizeComputationPhase {
42 ResolveIntrinsicMinimums, 43 ResolveIntrinsicMinimums,
43 ResolveContentBasedMinimums, 44 ResolveContentBasedMinimums,
44 ResolveMaxContentMinimums, 45 ResolveMaxContentMinimums,
45 ResolveIntrinsicMaximums, 46 ResolveIntrinsicMaximums,
46 ResolveMaxContentMaximums, 47 ResolveMaxContentMaximums,
47 MaximizeTracks, 48 MaximizeTracks,
48 }; 49 };
49 enum GridAxisPosition { GridAxisStart, GridAxisEnd, GridAxisCenter }; 50 enum GridAxisPosition { GridAxisStart, GridAxisEnd, GridAxisCenter };
51 enum GridAxis { GridRowAxis, GridColumnAxis };
svillar 2017/01/19 09:41:25 We already have ForRows, ForColumns. Adding anothe
50 52
51 class LayoutGrid final : public LayoutBlock { 53 class LayoutGrid final : public LayoutBlock {
52 public: 54 public:
53 explicit LayoutGrid(Element*); 55 explicit LayoutGrid(Element*);
54 ~LayoutGrid() override; 56 ~LayoutGrid() override;
55 57
56 static LayoutGrid* createAnonymous(Document*); 58 static LayoutGrid* createAnonymous(Document*);
57 const char* name() const override { return "LayoutGrid"; } 59 const char* name() const override { return "LayoutGrid"; }
58 60
59 void layoutBlock(bool relayoutChildren) override; 61 void layoutBlock(bool relayoutChildren) override;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&); 313 void updateAutoMarginsInColumnAxisIfNeeded(LayoutBox&);
312 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&); 314 void updateAutoMarginsInRowAxisIfNeeded(LayoutBox&);
313 315
314 int baselinePosition( 316 int baselinePosition(
315 FontBaseline, 317 FontBaseline,
316 bool firstLine, 318 bool firstLine,
317 LineDirectionMode, 319 LineDirectionMode,
318 LinePositionMode = PositionOnContainingLine) const override; 320 LinePositionMode = PositionOnContainingLine) const override;
319 int firstLineBoxBaseline() const override; 321 int firstLineBoxBaseline() const override;
320 int inlineBlockBaseline(LineDirectionMode) const override; 322 int inlineBlockBaseline(LineDirectionMode) const override;
321 bool isInlineBaselineAlignedChild(const LayoutBox* child) const; 323
324 bool isHorizontalGridAxis(GridAxis) const;
325 bool isParallelToBlockAxisForChild(const LayoutBox&, GridAxis) const;
326 bool isDescentBaselineForChild(const LayoutBox&, GridAxis) const;
327 bool isBaselineAlignmentForChild(const LayoutBox&,
328 GridAxis = GridColumnAxis) const;
329 const BaselineGroup& getBaselineGroupForChild(const LayoutBox&,
330 const GridSizingData&,
331 GridAxis) const;
332
333 LayoutUnit marginOverForChild(const LayoutBox&, GridAxis) const;
334 LayoutUnit logicalAscentForChild(const LayoutBox&, GridAxis) const;
335 LayoutUnit ascentForChild(const LayoutBox&, GridAxis) const;
336 LayoutUnit descentForChild(const LayoutBox&,
337 LayoutUnit ascent,
338 GridAxis) const;
339
340 void computeBaselineAlignmentContext(GridSizingData&) const;
341 void updateBaselineAlignmentContextIfNeeded(LayoutBox&,
342 GridSizingData&,
343 GridAxis) const;
344
345 LayoutUnit columnAxisBaselineOffsetForChild(const LayoutBox&,
346 const GridSizingData&) const;
347 LayoutUnit rowAxisBaselineOffsetForChild(const LayoutBox&,
348 const GridSizingData&) const;
322 349
323 #if ENABLE(ASSERT) 350 #if ENABLE(ASSERT)
324 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, 351 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection,
325 GridSizingData&) const; 352 GridSizingData&) const;
326 #endif 353 #endif
327 354
328 LayoutUnit gridGapForDirection(GridTrackSizingDirection, 355 LayoutUnit gridGapForDirection(GridTrackSizingDirection,
329 SizingOperation) const; 356 SizingOperation) const;
330 LayoutUnit guttersSize(const Grid&, 357 LayoutUnit guttersSize(const Grid&,
331 GridTrackSizingDirection, 358 GridTrackSizingDirection,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 LayoutUnit m_maxContentHeight{-1}; 463 LayoutUnit m_maxContentHeight{-1};
437 464
438 Optional<bool> m_hasDefiniteLogicalHeight; 465 Optional<bool> m_hasDefiniteLogicalHeight;
439 }; 466 };
440 467
441 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); 468 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid());
442 469
443 } // namespace blink 470 } // namespace blink
444 471
445 #endif // LayoutGrid_h 472 #endif // LayoutGrid_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698