const int caret_scroller_top = caret_content_top - view->cs_scroll_pos;
const int caret_scroller_bottom = caret_content_bottom - view->cs_scroll_pos;
- if (view->cs_bringin_to_ewk ||
+ if ((prefer_bringin && isCollapsed && view->cs_bringin_to_ewk) ||
(caret_scroller_top <= view->cs_rttb_height + caret_padding) ||
(caret_scroller_bottom >= view->cs_height - caret_padding)) {
int new_scroll_pos = 0;
- if (view->cs_bringin_to_ewk) {
- new_scroll_pos = view->cs_edge_scroll_pos;
- } else if (caret_scroller_top <= view->cs_rttb_height + caret_padding) {
+
+ if (caret_scroller_top <= view->cs_rttb_height + caret_padding) {
new_scroll_pos = caret_content_top - view->cs_rttb_height - caret_padding;
- } else {
+ } else if (caret_scroller_bottom >= view->cs_height - caret_padding) {
new_scroll_pos = caret_content_bottom - view->cs_height + caret_padding;
+ } else {
+ new_scroll_pos = view->cs_edge_scroll_pos;
}
if ((view->cs_scroll_pos >= view->cs_edge_scroll_pos) &&