setRenderStyleProperty method
void
setRenderStyleProperty(
- String name,
- dynamic value
)
Implementation
void setRenderStyleProperty(String name, value) {
if (renderStyle.target.disposed) return;
bool uiCommandTracked = false;
if (enableWebFProfileTracking) {
if (!WebFProfiler.instance.currentPipeline.containsActiveUICommand()) {
WebFProfiler.instance.startTrackUICommand();
uiCommandTracked = true;
}
WebFProfiler.instance.startTrackUICommandStep('$this.setRenderStyleProperty[$name]');
}
dynamic oldValue;
switch(name) {
case DISPLAY:
case OVERFLOW_X:
case OVERFLOW_Y:
case POSITION:
oldValue = renderStyle.getProperty(name);
break;
}
renderStyle.setProperty(name, value);
switch (name) {
case DISPLAY:
assert(oldValue != null);
if (value != oldValue) {
_updateRenderBoxModelWithDisplay();
}
break;
case OVERFLOW_X:
assert(oldValue != null);
CSSOverflowType oldEffectiveOverflowY = oldValue;
updateRenderBoxModel();
updateRenderBoxModelWithOverflowX(_handleScroll);
// Change overflowX may affect effectiveOverflowY.
// https://drafts.csswg.org/css-overflow/#overflow-properties
CSSOverflowType effectiveOverflowY = renderStyle.effectiveOverflowY;
if (effectiveOverflowY != oldEffectiveOverflowY) {
updateRenderBoxModelWithOverflowY(_handleScroll);
}
updateOverflowRenderBox();
break;
case OVERFLOW_Y:
assert(oldValue != null);
CSSOverflowType oldEffectiveOverflowX = oldValue;
updateRenderBoxModel();
updateRenderBoxModelWithOverflowY(_handleScroll);
// Change overflowY may affect the effectiveOverflowX.
// https://drafts.csswg.org/css-overflow/#overflow-properties
CSSOverflowType effectiveOverflowX = renderStyle.effectiveOverflowX;
if (effectiveOverflowX != oldEffectiveOverflowX) {
updateRenderBoxModelWithOverflowX(_handleScroll);
}
updateOverflowRenderBox();
break;
case POSITION:
assert(oldValue != null);
_updateRenderBoxModelWithPosition(oldValue);
break;
case COLOR:
_updateColorRelativePropertyWithColor(this);
break;
case FONT_SIZE:
_updateFontRelativeLengthWithFontSize();
break;
case TRANSFORM:
updateRenderBoxModel();
break;
}
if (enableWebFProfileTracking) {
WebFProfiler.instance.finishTrackUICommandStep();
if (uiCommandTracked) {
WebFProfiler.instance.finishTrackUICommand();
}
}
}