Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 NGBox_h | 5 #ifndef NGBox_h |
| 6 #define NGBox_h | 6 #define NGBox_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 // TODO(layout-ng): make it private and declare a friend class to use in tests | 26 // TODO(layout-ng): make it private and declare a friend class to use in tests |
| 27 explicit NGBox(ComputedStyle*); | 27 explicit NGBox(ComputedStyle*); |
| 28 | 28 |
| 29 // Returns true when done; when this function returns false, it has to be | 29 // Returns true when done; when this function returns false, it has to be |
| 30 // called again. The out parameter will only be set when this function | 30 // called again. The out parameter will only be set when this function |
| 31 // returns true. The same constraint space has to be passed each time. | 31 // returns true. The same constraint space has to be passed each time. |
| 32 // TODO(layout-ng): Should we have a StartLayout function to avoid passing | 32 // TODO(layout-ng): Should we have a StartLayout function to avoid passing |
| 33 // the same space for each Layout iteration? | 33 // the same space for each Layout iteration? |
| 34 bool Layout(const NGConstraintSpace*, NGFragment**); | 34 bool Layout(const NGConstraintSpace*, NGFragment**); |
| 35 | |
| 36 // Computes the value of min-content and max-content for this box. | |
| 37 void ComputeMinAndMaxContentSizes(NGFragment** min_content, | |
|
eae
2016/10/31 19:30:26
Shouldn't this return rects or values? Returning a
cbiesinger
2016/10/31 19:48:37
I also prefer LayoutUnit but I thought we agreed i
Gleb Lanbin
2016/10/31 19:52:47
IMO returning std::pair<NGFragment*, NGFragment*>
ikilpatrick
2016/11/01 15:35:11
I'm ok with returning a pair of layout units if pe
atotic
2016/11/01 16:59:00
This API will call Layout() in a tight loop, which
cbiesinger
2016/11/01 19:10:04
Collective answer to all the comments:
- I dislike
| |
| 38 NGFragment** max_content); | |
| 39 | |
| 35 const ComputedStyle* Style() const; | 40 const ComputedStyle* Style() const; |
| 36 | 41 |
| 37 NGBox* NextSibling(); | 42 NGBox* NextSibling(); |
| 38 | 43 |
| 39 NGBox* FirstChild(); | 44 NGBox* FirstChild(); |
| 40 | 45 |
| 41 void SetNextSibling(NGBox*); | 46 void SetNextSibling(NGBox*); |
| 42 void SetFirstChild(NGBox*); | 47 void SetFirstChild(NGBox*); |
| 43 | 48 |
| 44 DEFINE_INLINE_VIRTUAL_TRACE() { | 49 DECLARE_VIRTUAL_TRACE(); |
| 45 visitor->trace(algorithm_); | |
| 46 visitor->trace(fragment_); | |
| 47 visitor->trace(next_sibling_); | |
| 48 visitor->trace(first_child_); | |
| 49 } | |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // This is necessary for interop between old and new trees -- after our parent | 52 // This is necessary for interop between old and new trees -- after our parent |
| 53 // positions us, it calls this function so we can store the position on the | 53 // positions us, it calls this function so we can store the position on the |
| 54 // underlying LayoutBox. | 54 // underlying LayoutBox. |
| 55 void PositionUpdated(); | 55 void PositionUpdated(); |
| 56 | 56 |
| 57 bool CanUseNewLayout(); | 57 bool CanUseNewLayout(); |
| 58 | 58 |
| 59 // After we run the layout algorithm, this function copies back the geometry | 59 // After we run the layout algorithm, this function copies back the geometry |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 70 RefPtr<ComputedStyle> style_; | 70 RefPtr<ComputedStyle> style_; |
| 71 Member<NGBox> next_sibling_; | 71 Member<NGBox> next_sibling_; |
| 72 Member<NGBox> first_child_; | 72 Member<NGBox> first_child_; |
| 73 Member<NGBlockLayoutAlgorithm> algorithm_; | 73 Member<NGBlockLayoutAlgorithm> algorithm_; |
| 74 Member<NGPhysicalFragment> fragment_; | 74 Member<NGPhysicalFragment> fragment_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace blink | 77 } // namespace blink |
| 78 | 78 |
| 79 #endif // NGBox_h | 79 #endif // NGBox_h |
| OLD | NEW |