blob: e9b125362a0e21fa7251102477ec94adea909c8c [file] [log] [blame]
// Copyright 2016 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 "core/layout/ng/ng_fragment.h"
#include "core/layout/ng/geometry/ng_logical_size.h"
namespace blink {
LayoutUnit NGFragment::InlineSize() const {
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->Size().width
: physical_fragment_->Size().height;
}
LayoutUnit NGFragment::BlockSize() const {
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->Size().height
: physical_fragment_->Size().width;
}
NGLogicalSize NGFragment::Size() const {
return physical_fragment_->Size().ConvertToLogical(
static_cast<NGWritingMode>(writing_mode_));
}
LayoutUnit NGFragment::InlineOffset() const {
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->Offset().left
: physical_fragment_->Offset().top;
}
LayoutUnit NGFragment::BlockOffset() const {
return writing_mode_ == kHorizontalTopBottom
? physical_fragment_->Offset().top
: physical_fragment_->Offset().left;
}
NGPhysicalFragment::NGFragmentType NGFragment::Type() const {
return physical_fragment_->Type();
}
} // namespace blink