mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Rename "margins" to "indents"
The name "margin" conflicts with another meaning, so we're making the name in the public api "idents" and the code consistent in naming. Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
This commit is contained in:
parent
dc7bc6e39e
commit
bb86b433f9
@ -44,20 +44,20 @@ class LineWidths {
|
||||
mFirstWidthLineCount = firstWidthLineCount;
|
||||
mRestWidth = restWidth;
|
||||
}
|
||||
void setMargins(const std::vector<float>& margins) {
|
||||
mMargins = margins;
|
||||
void setIndents(const std::vector<float>& indents) {
|
||||
mIndents = indents;
|
||||
}
|
||||
bool isConstant() const {
|
||||
// technically mFirstWidthLineCount == 0 would count too, but doesn't actually happen
|
||||
return mRestWidth == mFirstWidth && mMargins.empty();
|
||||
return mRestWidth == mFirstWidth && mIndents.empty();
|
||||
}
|
||||
float getLineWidth(int line) const {
|
||||
float width = (line < mFirstWidthLineCount) ? mFirstWidth : mRestWidth;
|
||||
if (!mMargins.empty()) {
|
||||
if ((size_t)line < mMargins.size()) {
|
||||
width -= mMargins[line];
|
||||
if (!mIndents.empty()) {
|
||||
if ((size_t)line < mIndents.size()) {
|
||||
width -= mIndents[line];
|
||||
} else {
|
||||
width -= mMargins.back();
|
||||
width -= mIndents.back();
|
||||
}
|
||||
}
|
||||
return width;
|
||||
@ -66,7 +66,7 @@ class LineWidths {
|
||||
float mFirstWidth;
|
||||
int mFirstWidthLineCount;
|
||||
float mRestWidth;
|
||||
std::vector<float> mMargins;
|
||||
std::vector<float> mIndents;
|
||||
};
|
||||
|
||||
class TabStops {
|
||||
@ -132,7 +132,7 @@ class LineBreaker {
|
||||
|
||||
void setLineWidths(float firstWidth, int firstWidthLineCount, float restWidth);
|
||||
|
||||
void setMargins(const std::vector<float>& margins);
|
||||
void setIndents(const std::vector<float>& indents);
|
||||
|
||||
void setTabStops(const int* stops, size_t nStops, int tabWidth) {
|
||||
mTabStops.set(stops, nStops, tabWidth);
|
||||
|
||||
@ -79,8 +79,8 @@ void LineBreaker::setLineWidths(float firstWidth, int firstWidthLineCount, float
|
||||
}
|
||||
|
||||
|
||||
void LineBreaker::setMargins(const std::vector<float>& margins) {
|
||||
mLineWidths.setMargins(margins);
|
||||
void LineBreaker::setIndents(const std::vector<float>& indents) {
|
||||
mLineWidths.setIndents(indents);
|
||||
}
|
||||
|
||||
// This function determines whether a character is a space that disappears at end of line.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user