flutter_flutter/engine/core/rendering/RenderCustomLayout.cpp
Ojan Vafai fc1dff4288 Expose minContentWidth/maxContentWidth and a callback for computing them.
This exposes the last hooks needed to implement flexbox layout. For now,
I didn't worry too much about the exact API we're exposing since this will
all change with the upcoming redesign (e.g. https://codereview.chromium.org/1093633002).

minContentWidth == the width if the element were to wrap at every wrapping point (not including border/padding)

maxContentWidth == the width if the element were to only wrap at hard wrapping points (e.g. \n inside a whitespace: pre).

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1101793003
2015-04-24 13:14:41 -07:00

43 lines
984 B
C++

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/config.h"
#include "sky/engine/core/rendering/RenderCustomLayout.h"
#include "sky/engine/core/rendering/RenderLayer.h"
#include "sky/engine/core/layout/LayoutCallback.h"
namespace blink {
RenderCustomLayout::RenderCustomLayout(ContainerNode* node)
: RenderBlock(node)
{
}
RenderCustomLayout::~RenderCustomLayout()
{
}
void RenderCustomLayout::computePreferredLogicalWidths()
{
ASSERT(node()->isElementNode());
toElement(node())->intrinsicWidthsComputer()->handleEvent();
clearPreferredLogicalWidthsDirty();
}
void RenderCustomLayout::layout()
{
ASSERT(node()->isElementNode());
toElement(node())->layoutManager()->handleEvent();
clearNeedsLayout();
}
const char* RenderCustomLayout::renderName() const
{
return "RenderCustomLayout";
}
} // namespace blink