updateRenderOverflow method
void
updateRenderOverflow(
- Element element
inherited
Implementation
void updateRenderOverflow(Element element) {
ScrollListener scrollListener = element.elementDelegate.handleScroll;
CSSStyleDeclaration style = element.style;
RenderBoxModel renderBoxModel = element.renderBoxModel!;
RenderStyle renderStyle = renderBoxModel.renderStyle;
renderStyle.updateOverflow(style);
if (renderBoxModel is RenderRecyclerLayout) {
// Recycler layout not need repaintBoundary and scroll/pointer listeners,
// ignoring overflowX or overflowY sets, which handle it self.
renderBoxModel.clipX = renderBoxModel.clipY = false;
renderBoxModel.scrollOffsetX = renderBoxModel.axis == Axis.horizontal
? renderBoxModel.scrollable.position : null;
renderBoxModel.scrollOffsetY = renderBoxModel.axis == Axis.vertical
? renderBoxModel.scrollable.position : null;
} else {
CSSOverflowType overflowX = renderStyle.overflowX;
CSSOverflowType overflowY = renderStyle.overflowY;
bool shouldRepaintSelf = false;
switch(overflowX) {
case CSSOverflowType.hidden:
_scrollableX = null;
renderBoxModel.clipX = true;
// Overflow hidden can be scrolled programmatically.
renderBoxModel.enableScrollX = true;
break;
case CSSOverflowType.clip:
_scrollableX = null;
renderBoxModel.clipX = true;
// Overflow clip can't scrolled programmatically.
renderBoxModel.enableScrollX = false;
break;
case CSSOverflowType.auto:
case CSSOverflowType.scroll:
_scrollableX = KrakenScrollable(axisDirection: AxisDirection.right, scrollListener: scrollListener);
shouldRepaintSelf = true;
renderBoxModel.clipX = true;
renderBoxModel.enableScrollX = true;
renderBoxModel.scrollOffsetX = _scrollableX!.position;
break;
case CSSOverflowType.visible:
default:
_scrollableX = null;
renderBoxModel.clipX = false;
renderBoxModel.enableScrollX = false;
break;
}
switch(overflowY) {
case CSSOverflowType.hidden:
_scrollableY = null;
renderBoxModel.clipY = true;
renderBoxModel.enableScrollY = true;
break;
case CSSOverflowType.clip:
_scrollableY = null;
renderBoxModel.clipY = true;
renderBoxModel.enableScrollY = false;
break;
case CSSOverflowType.auto:
case CSSOverflowType.scroll:
_scrollableY = KrakenScrollable(axisDirection: AxisDirection.down, scrollListener: scrollListener);
shouldRepaintSelf = true;
renderBoxModel.clipY = true;
renderBoxModel.enableScrollY = true;
renderBoxModel.scrollOffsetY = _scrollableY!.position;
break;
case CSSOverflowType.visible:
default:
_scrollableY = null;
renderBoxModel.clipY = false;
renderBoxModel.enableScrollY = false;
break;
}
renderBoxModel.scrollListener = scrollListener;
renderBoxModel.pointerListener = _pointerListener;
if (renderBoxModel is RenderLayoutBox) {
if (shouldRepaintSelf) {
_upgradeToSelfRepaint(element);
} else {
_downgradeToParentRepaint(element);
}
}
}
}