| 1160 | case SimplifiedScrollDirectionLeftToRight: |
| 1161 | return contentSize.width - frame.width - directionDependentContentOffset.x; |
| 1162 | case SimplifiedScrollDirectionRightToLeft: |
| 1163 | return directionDependentContentOffset.x; |
| 1164 | } |
| 1165 | } |
| 1166 | return 0; |
| 1167 | } |
| 1168 | |
| 1169 | bool ViewNode::canScroll(const Point& parentDirectionDependentVisual, ScrollDirection scrollDirection) { |
| 1170 | auto frame = getCalculatedFrame(); |
| 1171 | if (!frame.contains(parentDirectionDependentVisual)) { |
| 1172 | return false; |
| 1173 | } |
| 1174 | |
| 1175 | auto simplifiedScrollDirection = simplifyScrollDirection(scrollDirection); |
| 1176 | |
| 1177 | // manually declared always scrollable elements |
| 1178 | if (_flags[kCanAlwaysScrollHorizontal] && (simplifiedScrollDirection == SimplifiedScrollDirectionLeftToRight || |
| 1179 | simplifiedScrollDirection == SimplifiedScrollDirectionRightToLeft)) { |
| 1180 | return true; |
| 1181 | } |
| 1182 | if (_flags[kCanAlwaysScrollVertical] && (simplifiedScrollDirection == SimplifiedScrollDirectionTopToBottom || |
| 1183 | simplifiedScrollDirection == SimplifiedScrollDirectionBottomToTop)) { |
| 1184 | return true; |
| 1185 | } |
| 1186 | |
| 1187 | if (getCanScrollDistance(scrollDirection) > 0) { |
| 1188 | return true; |
| 1189 | } |
| 1190 | Point selfDirectionDependentVisual = convertParentVisualToSelfVisual(parentDirectionDependentVisual); |
| 1191 | for (ViewNode* childViewNode : *this) { |
| 1192 | if (childViewNode->canScroll(selfDirectionDependentVisual, scrollDirection)) { |
| 1193 | return true; |