recalculateStyle method

void recalculateStyle({
  1. bool rebuildNested = false,
  2. bool forceRecalculate = false,
})

Implementation

void recalculateStyle({bool rebuildNested = false, bool forceRecalculate = false}) {
  if (renderBoxModel != null || forceRecalculate || renderStyle.display == CSSDisplay.none) {
    if (enableWebFProfileTracking) {
      WebFProfiler.instance.startTrackUICommandStep('$this.recalculateStyle');
    }
    // Diff style.
    CSSStyleDeclaration newStyle = CSSStyleDeclaration();
    applyStyle(newStyle);
    var hasInheritedPendingProperty = false;
    if (style.merge(newStyle)) {
      hasInheritedPendingProperty = style.hasInheritedPendingProperty;
      if (!ownerDocument.controller.shouldBlockingFlushingResolvedStyleProperties) {
        style.flushPendingProperties();
      }
    }

    if (rebuildNested || hasInheritedPendingProperty) {
      // Update children style.
      children.forEach((Element child) {
        child.recalculateStyle(rebuildNested: rebuildNested);
      });
    }
    if (enableWebFProfileTracking) {
      WebFProfiler.instance.finishTrackUICommandStep();
    }
  }
}