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

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

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now Created 3 years, 9 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NGAbsoluteUtils_h 5 #ifndef NGAbsoluteUtils_h
6 #define NGAbsoluteUtils_h 6 #define NGAbsoluteUtils_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_units.h" 9 #include "core/layout/ng/geometry/ng_box_strut.h"
10 #include "core/layout/ng/geometry/ng_physical_size.h"
11 #include "core/layout/ng/geometry/ng_static_position.h"
12 #include "core/layout/ng/ng_min_max_content_size.h"
10 #include "platform/LayoutUnit.h" 13 #include "platform/LayoutUnit.h"
11 #include "wtf/Optional.h" 14 #include "wtf/Optional.h"
12 15
13 namespace blink { 16 namespace blink {
14 17
15 class ComputedStyle; 18 class ComputedStyle;
16 class NGConstraintSpace; 19 class NGConstraintSpace;
17 20
18 struct CORE_EXPORT NGAbsolutePhysicalPosition { 21 struct CORE_EXPORT NGAbsolutePhysicalPosition {
19 NGPhysicalBoxStrut inset; 22 NGPhysicalBoxStrut inset;
20 NGPhysicalSize size; 23 NGPhysicalSize size;
21 String ToString() const; 24 String ToString() const;
22 }; 25 };
23 26
24 // The following routines implement absolute size resolution algorithm. 27 // The following routines implement absolute size resolution algorithm.
25 // https://www.w3.org/TR/css-position-3/#abs-non-replaced-width 28 // https://www.w3.org/TR/css-position-3/#abs-non-replaced-width
26 // 29 //
27 // The size is computed as NGAbsolutePhysicalPosition. 30 // The size is computed as NGAbsolutePhysicalPosition.
28 // It needs to be computed in 4 stages: 31 // It needs to be computed in 4 stages:
29 // 1. If AbsoluteNeedsChildInlineSize compute estimated inline_size using 32 // 1. If AbsoluteNeedsChildInlineSize compute estimated inline_size using
30 // MinAndMaxContentSizes.ShrinkToFit. 33 // MinMaxContentSize.ShrinkToFit.
31 // 2. Compute part of PhysicalPosition that depends upon child inline size 34 // 2. Compute part of PhysicalPosition that depends upon child inline size
32 // with ComputePartialAbsoluteWithChildInlineSize. 35 // with ComputePartialAbsoluteWithChildInlineSize.
33 // 3. If AbsoluteNeedsChildBlockSize compute estimated block_size by 36 // 3. If AbsoluteNeedsChildBlockSize compute estimated block_size by
34 // performing layout with the inline_size calculated from (2). 37 // performing layout with the inline_size calculated from (2).
35 // 4. Compute full PhysicalPosition by filling it in with parts that depend 38 // 4. Compute full PhysicalPosition by filling it in with parts that depend
36 // upon child's block_size. 39 // upon child's block_size.
37 40
38 // True if ComputePartialAbsoluteWithChildInlineSize will need 41 // True if ComputePartialAbsoluteWithChildInlineSize will need
39 // estimated inline size. 42 // estimated inline size.
40 CORE_EXPORT bool AbsoluteNeedsChildInlineSize(const ComputedStyle&); 43 CORE_EXPORT bool AbsoluteNeedsChildInlineSize(const ComputedStyle&);
41 44
42 // True if ComputeFullAbsoluteWithChildBlockSize will need 45 // True if ComputeFullAbsoluteWithChildBlockSize will need
43 // estimated block size. 46 // estimated block size.
44 CORE_EXPORT bool AbsoluteNeedsChildBlockSize(const ComputedStyle&); 47 CORE_EXPORT bool AbsoluteNeedsChildBlockSize(const ComputedStyle&);
45 48
46 // Compute part of position that depends on child's inline_size 49 // Compute part of position that depends on child's inline_size
47 // returns partially filled position. 50 // returns partially filled position.
48 CORE_EXPORT NGAbsolutePhysicalPosition 51 CORE_EXPORT NGAbsolutePhysicalPosition
49 ComputePartialAbsoluteWithChildInlineSize( 52 ComputePartialAbsoluteWithChildInlineSize(
50 const NGConstraintSpace& space, 53 const NGConstraintSpace& space,
51 const ComputedStyle& style, 54 const ComputedStyle& style,
52 const NGStaticPosition&, 55 const NGStaticPosition&,
53 const Optional<MinAndMaxContentSizes>& child_minmax); 56 const Optional<MinMaxContentSize>& child_minmax);
54 57
55 // Compute rest of NGPhysicalRect that depends on child's block_size. 58 // Compute rest of NGPhysicalRect that depends on child's block_size.
56 CORE_EXPORT void ComputeFullAbsoluteWithChildBlockSize( 59 CORE_EXPORT void ComputeFullAbsoluteWithChildBlockSize(
57 const NGConstraintSpace& space, 60 const NGConstraintSpace& space,
58 const ComputedStyle& style, 61 const ComputedStyle& style,
59 const NGStaticPosition&, 62 const NGStaticPosition&,
60 const Optional<LayoutUnit>& child_block_size, 63 const Optional<LayoutUnit>& child_block_size,
61 NGAbsolutePhysicalPosition* position); 64 NGAbsolutePhysicalPosition* position);
62 65
63 // TODO(atotic) Absolute coordinates for replaced elements 66 // TODO(atotic) Absolute coordinates for replaced elements
64 // ComputeAbsoluteReplaced. 67 // ComputeAbsoluteReplaced.
65 // https://www.w3.org/TR/css-position-3/#abs-replaced-width 68 // https://www.w3.org/TR/css-position-3/#abs-replaced-width
66 } // namespace blink 69 } // namespace blink
67 70
68 #endif // NGAbsoluteUtils_h 71 #endif // NGAbsoluteUtils_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698