| 2153 | directionAgnosticVisual += getDirectionAgnosticTransform(); |
| 2154 | // If we have a scrollable parent, try to move the content offset if needed |
| 2155 | auto parent = getParent(); |
| 2156 | auto parentFrame = parent->getCalculatedFrame(); |
| 2157 | auto& parentScrollState = parent->_scrollState; |
| 2158 | if (parentScrollState != nullptr) { |
| 2159 | // What's the current occlusion in this scroll view |
| 2160 | auto directionAgnosticContentOffset = parentScrollState->getDirectionAgnosticContentOffset(); |
| 2161 | directionAgnosticVisual -= directionAgnosticContentOffset; |
| 2162 | // Compute the displacement needed to fit the frame into the scroll content viewport |
| 2163 | auto directionAgnosticDisplacement = Point(0, 0); |
| 2164 | if (directionAgnosticVisual.x < 0) { |
| 2165 | directionAgnosticDisplacement.x = directionAgnosticVisual.x; |
| 2166 | } else if (directionAgnosticVisual.x + size.width > parentFrame.width) { |
| 2167 | directionAgnosticDisplacement.x = directionAgnosticVisual.x + size.width - parentFrame.width; |
| 2168 | } |
| 2169 | if (directionAgnosticVisual.y < 0) { |
| 2170 | directionAgnosticDisplacement.y = directionAgnosticVisual.y; |