/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/351564777): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_FLEX_FLEXIBLE_BOX_ALGORITHM_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_FLEX_FLEXIBLE_BOX_ALGORITHM_H_ #include "base/check_op.h" #include "third_party/blink/renderer/core/layout/baseline_utils.h" #include "third_party/blink/renderer/core/layout/block_node.h" #include "third_party/blink/renderer/core/layout/geometry/flex_offset.h" #include "third_party/blink/renderer/core/layout/layout_result.h" #include "third_party/blink/renderer/core/layout/min_max_sizes.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/geometry/physical_direction.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { class FlexItem; class FlexLayoutAlgorithm; class FlexLine; class FlexibleBoxAlgorithm; struct MinMaxSizes; struct NGFlexLine; enum FlexSign { … }; FlexItemVector; class FlexItem { … }; class FlexItemVectorView { … }; class FlexLine { … }; // This class implements the CSS Flexbox layout algorithm: // https://drafts.csswg.org/css-flexbox/ // // Expected usage is as follows: // FlexibleBoxAlgorithm algorithm(Style(), MainAxisLength()); // for (each child) { // algorithm.emplace_back(...caller must compute these values...) // } // LayoutUnit cross_axis_offset = border + padding; // while ((FlexLine* line = algorithm.ComputenextLine(LogicalWidth()))) { // // Compute main axis size, using sum_hypothetical_main_size if // // indefinite // line->SetContainerMainInnerSize(MainAxisSize( // line->sum_hypothetical_main_size)); // line->FreezeInflexibleItems(); // while (!current_line->ResolveFlexibleLengths()) { continue; } // // Now, lay out the items, forcing their main axis size to // // item.flexed_content_size // LayoutUnit main_axis_offset = border + padding + scrollbar; // line->ComputeLineItemsPosition(main_axis_offset, cross_axis_offset); // } // The final position of each flex item is in item.offset class CORE_EXPORT FlexibleBoxAlgorithm { … }; } // namespace blink WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(…) #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_FLEX_FLEXIBLE_BOX_ALGORITHM_H_