-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support all combinations of GetRectsForRange styles #6591
Conversation
third_party/txt/src/txt/paragraph.cc
Outdated
std::map<size_t, std::vector<Paragraph::TextBox>> line_boxes; | ||
|
||
// Per-line min and max top/bottom edges over all runs in a given line. | ||
std::vector<SkScalar> min_tops; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the value type of the line_boxes map to be a struct that hold the line's TextBoxes and its min/max_top/bottom values
third_party/txt/src/txt/paragraph.cc
Outdated
// Check to see if we are finished. | ||
if (run.code_units.start >= end) { | ||
// We continue to store metrics of one additional line if available. | ||
if (run.line_number <= max_line + 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to avoid processing runs outside the selected range if possible.
It looks like the additional line's runs are needed in order to find the amount of spacing between lines. Can this be calculated and stored during layout?
third_party/txt/src/txt/paragraph.cc
Outdated
} else if (rect_height_style == | ||
RectHeightStyle::kIncludeLineSpacingMiddle) { | ||
SkScalar adjusted_bottom = | ||
kv.first >= line_ranges_.size() - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: the ternary expressions used to calculate the adjusted_top/bottom values duplicate the non-adjusted values. This would be simpler as:
SkScalar adjusted_bottom = line_baselines_[kv.first] + line_max_descent_[kv.first];
if (kv.first < line_ranges_.size() - 1) {
adjusted_botom += (line_max_spacings_[kv.first + 1] - line_max_ascent_[kv.first + 1]) / 2;
}
third_party/txt/src/txt/paragraph.h
Outdated
double max_right_; | ||
double min_left_; | ||
|
||
struct LineBoxMetrics { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be declared locally within Paragraph::GetRectsForRange
third_party/txt/src/txt/paragraph.cc
Outdated
for (const Paragraph::TextBox& box : kv.second.boxes) { | ||
SkScalar adjusted_bottom = | ||
kv.first >= line_ranges_.size() - 1 | ||
? line_baselines_[kv.first] + line_max_descent_[kv.first] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ternary operator here (similar to the change made to adjusted_bottom
above)
flutter/engine@4c79e42...2586e94 git log 4c79e42..2586e94 --no-merges --oneline 2586e94 Support all combinations of GetRectsForRange styles (flutter/engine#6591) e78f86e Fix mac builds. Only Linux and Windows require default GL proc resolvers. (flutter/engine#6641) 52e48ab Fix Windows embedding. Appears that flutter#6523 or flutter#6525 introduced a bug for embedder scenarios causing the window native library to be incorrectly initialized and thus incapable of correctly resolving GL functions. This change fixes that. (flutter/engine#6624) c9197e4 Roll src/third_party/skia 25837bf17019..b46c4d0925ad (6 commits) (flutter/engine#6640) 324c21a Roll src/third_party/skia 1b07dffd979d..25837bf17019 (1 commits) (flutter/engine#6639) 5dfbc0a Roll src/third_party/skia e023ae7c5540..1b07dffd979d (1 commits) (flutter/engine#6638) 4a18dff Roll src/third_party/skia ff1aeb953faf..e023ae7c5540 (1 commits) (flutter/engine#6637) 427915e Allow FlutterViewController to specify whether its FlutterView is opaque (flutter/engine#6570) 20c805c Ensure that Scene::toImage renders texture backed images. (flutter/engine#6636) 25d0507 Roll buildtools to 5a9e1b3a0b84a2871f20f85fde665e54a894ba72 (flutter/engine#6633) 4f17d7e Roll src/third_party/skia 327955b1ba19..ff1aeb953faf (13 commits) (flutter/engine#6635) cdd592f Reland 'Pass null instead of 'none' locale' (flutter/engine#6632) 2cd8920 Roll src/third_party/skia b1a002e850e1..327955b1ba19 (12 commits) (flutter/engine#6631) edfe024 13771 - iOS dictation bug (flutter/engine#6607) cadf440 Roll src/third_party/skia b9998cdceec7..b1a002e850e1 (13 commits) (flutter/engine#6626) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@4c79e42...2586e94 git log 4c79e42..2586e94 --no-merges --oneline 2586e94 Support all combinations of GetRectsForRange styles (flutter/engine#6591) e78f86e Fix mac builds. Only Linux and Windows require default GL proc resolvers. (flutter/engine#6641) 52e48ab Fix Windows embedding. Appears that #6523 or #6525 introduced a bug for embedder scenarios causing the window native library to be incorrectly initialized and thus incapable of correctly resolving GL functions. This change fixes that. (flutter/engine#6624) c9197e4 Roll src/third_party/skia 25837bf17019..b46c4d0925ad (6 commits) (flutter/engine#6640) 324c21a Roll src/third_party/skia 1b07dffd979d..25837bf17019 (1 commits) (flutter/engine#6639) 5dfbc0a Roll src/third_party/skia e023ae7c5540..1b07dffd979d (1 commits) (flutter/engine#6638) 4a18dff Roll src/third_party/skia ff1aeb953faf..e023ae7c5540 (1 commits) (flutter/engine#6637) 427915e Allow FlutterViewController to specify whether its FlutterView is opaque (flutter/engine#6570) 20c805c Ensure that Scene::toImage renders texture backed images. (flutter/engine#6636) 25d0507 Roll buildtools to 5a9e1b3a0b84a2871f20f85fde665e54a894ba72 (flutter/engine#6633) 4f17d7e Roll src/third_party/skia 327955b1ba19..ff1aeb953faf (13 commits) (flutter/engine#6635) cdd592f Reland 'Pass null instead of 'none' locale' (flutter/engine#6632) 2cd8920 Roll src/third_party/skia b1a002e850e1..327955b1ba19 (12 commits) (flutter/engine#6631) edfe024 13771 - iOS dictation bug (flutter/engine#6607) cadf440 Roll src/third_party/skia b9998cdceec7..b1a002e850e1 (13 commits) (flutter/engine#6626) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@4c79e42...2586e94 git log 4c79e42..2586e94 --no-merges --oneline 2586e94 Support all combinations of GetRectsForRange styles (flutter/engine#6591) e78f86e Fix mac builds. Only Linux and Windows require default GL proc resolvers. (flutter/engine#6641) 52e48ab Fix Windows embedding. Appears that flutter#6523 or flutter#6525 introduced a bug for embedder scenarios causing the window native library to be incorrectly initialized and thus incapable of correctly resolving GL functions. This change fixes that. (flutter/engine#6624) c9197e4 Roll src/third_party/skia 25837bf17019..b46c4d0925ad (6 commits) (flutter/engine#6640) 324c21a Roll src/third_party/skia 1b07dffd979d..25837bf17019 (1 commits) (flutter/engine#6639) 5dfbc0a Roll src/third_party/skia e023ae7c5540..1b07dffd979d (1 commits) (flutter/engine#6638) 4a18dff Roll src/third_party/skia ff1aeb953faf..e023ae7c5540 (1 commits) (flutter/engine#6637) 427915e Allow FlutterViewController to specify whether its FlutterView is opaque (flutter/engine#6570) 20c805c Ensure that Scene::toImage renders texture backed images. (flutter/engine#6636) 25d0507 Roll buildtools to 5a9e1b3a0b84a2871f20f85fde665e54a894ba72 (flutter/engine#6633) 4f17d7e Roll src/third_party/skia 327955b1ba19..ff1aeb953faf (13 commits) (flutter/engine#6635) cdd592f Reland &flutter#39;Pass null instead of &flutter#39;none&flutter#39; locale&flutter#39; (flutter/engine#6632) 2cd8920 Roll src/third_party/skia b1a002e850e1..327955b1ba19 (12 commits) (flutter/engine#6631) edfe024 13771 - iOS dictation bug (flutter/engine#6607) cadf440 Roll src/third_party/skia b9998cdceec7..b1a002e850e1 (13 commits) (flutter/engine#6626) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC&flutter#39;d on the roll, and stop the roller if necessary.
This PR defines two engine-side enums, RectHeightStyle and RectWidthStyle which are used to specify the type of rects GetRectsForRange will return.
This feature is not yet enabled in the framework and currently defaults to Tight bounds on both height and width to maintain compatibility. It will be enabled in a separate (near) future PR.