mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
4e59508a8e
Summary: This diff extends the ParagraphAttribute class to store the value of the includeFontPadding prop. Note that this is an Android only prop, I'm not creating android blocks to improve "cleanliness" of the code. changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric Reviewed By: shergin Differential Revision: D21446738 fbshipit-source-id: 0543e86aa18ce10f7a56bbaafe111cce0179ea86
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "ParagraphAttributes.h"
|
|
|
|
#include <react/attributedstring/conversions.h>
|
|
#include <react/debug/debugStringConvertibleUtils.h>
|
|
#include <react/graphics/conversions.h>
|
|
#include <react/utils/FloatComparison.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const {
|
|
return std::tie(
|
|
maximumNumberOfLines,
|
|
ellipsizeMode,
|
|
textBreakStrategy,
|
|
adjustsFontSizeToFit,
|
|
includeFontPadding) ==
|
|
std::tie(
|
|
rhs.maximumNumberOfLines,
|
|
rhs.ellipsizeMode,
|
|
rhs.textBreakStrategy,
|
|
rhs.adjustsFontSizeToFit,
|
|
rhs.includeFontPadding) &&
|
|
floatEquality(minimumFontSize, rhs.minimumFontSize) &&
|
|
floatEquality(maximumFontSize, rhs.maximumFontSize);
|
|
}
|
|
|
|
bool ParagraphAttributes::operator!=(const ParagraphAttributes &rhs) const {
|
|
return !(*this == rhs);
|
|
}
|
|
|
|
#pragma mark - DebugStringConvertible
|
|
|
|
#if RN_DEBUG_STRING_CONVERTIBLE
|
|
SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
|
|
return {
|
|
debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines),
|
|
debugStringConvertibleItem("ellipsizeMode", ellipsizeMode),
|
|
debugStringConvertibleItem("textBreakStrategy", textBreakStrategy),
|
|
debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
|
|
debugStringConvertibleItem("minimumFontSize", minimumFontSize),
|
|
debugStringConvertibleItem("maximumFontSize", maximumFontSize),
|
|
debugStringConvertibleItem("includeFontPadding", includeFontPadding)};
|
|
}
|
|
#endif
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|