<commit_before>@import '../core/style/variables';
@import '../core/style/elevation';
@import '../core/style/layout-common';
@import '../../cdk/a11y/a11y';

$mat-drawer-content-z-index: 1;
$mat-drawer-side-drawer-z-index: 2;
$mat-drawer-backdrop-z-index: 3;
$mat-drawer-over-drawer-z-index: 4;

// stylelint-disable max-line-length
// Mixin that creates a new stacking context.
// see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
// stylelint-enable
@mixin mat-drawer-stacking-context($z-index:1) {
  position: relative;

  // Use a z-index to create a new stacking context. (We can't use transform because it breaks fixed
  // positioning inside of the transformed element).
  z-index: $z-index;
}

.mat-drawer-container {
  // We need a stacking context here so that the backdrop and drawers are clipped to the
  // MatDrawerContainer. This creates a new z-index stack so we use low numbered z-indices.
  // We create another stacking context in the '.mat-drawer-content' and in each drawer so that
  // the application content does not get messed up with our own CSS.
  @include mat-drawer-stacking-context();

  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;

  // Need this to take up space in the layout.
  display: block;

  // Hide the drawers when they're closed.
  overflow: hidden;

  // TODO(hansl): Update this with a more robust solution.
  &[fullscreen] {
    @include mat-fill();

    &.mat-drawer-opened {
      overflow: hidden;
    }
  }
}

.mat-drawer-backdrop {
  @include mat-fill();

  display: block;

  // Because of the new stacking context, the z-index stack is new and we can use our own
  // numbers.
  z-index: $mat-drawer-backdrop-z-index;

  // We use 'visibility: hidden | visible' because 'display: none' will not animate any
  // transitions, while visibility will interpolate transitions properly.
  // see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility, the Interpolation
  // section.
  visibility: hidden;

  &.mat-drawer-shown {
    visibility: visible;
  }

  .mat-drawer-transition & {
    transition: {
      duration: $swift-ease-out-duration;
      timing-function: $swift-ease-out-timing-function;
      property: background-color, visibility;
    }
  }

  @include cdk-high-contrast {
    opacity: 0.5;
  }
}

.mat-drawer-content {
  @include mat-drawer-stacking-context($mat-drawer-content-z-index);

  display: block;
  height: 100%;
  overflow: auto;

  .mat-drawer-transition & {
    transition: {
      duration: $swift-ease-out-duration;
      timing-function: $swift-ease-out-timing-function;
      property: transform, margin-left, margin-right;
    }
  }
}

.mat-drawer {<commit_msg>perf(drawer): drawer content repainting on scroll (#7719)<commit_after>@import '../core/style/variables';
@import '../core/style/elevation';
@import '../core/style/layout-common';
@import '../core/style/vendor-prefixes';
@import '../../cdk/a11y/a11y';

$mat-drawer-content-z-index: 1;
$mat-drawer-side-drawer-z-index: 2;
$mat-drawer-backdrop-z-index: 3;
$mat-drawer-over-drawer-z-index: 4;

// stylelint-disable max-line-length
// Mixin that creates a new stacking context.
// see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
// stylelint-enable
@mixin mat-drawer-stacking-context($z-index:1) {
  position: relative;

  // Use a z-index to create a new stacking context. (We can't use transform because it breaks fixed
  // positioning inside of the transformed element).
  z-index: $z-index;
}

.mat-drawer-container {
  // We need a stacking context here so that the backdrop and drawers are clipped to the
  // MatDrawerContainer. This creates a new z-index stack so we use low numbered z-indices.
  // We create another stacking context in the '.mat-drawer-content' and in each drawer so that
  // the application content does not get messed up with our own CSS.
  @include mat-drawer-stacking-context();

  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;

  // Need this to take up space in the layout.
  display: block;

  // Hide the drawers when they're closed.
  overflow: hidden;

  // TODO(hansl): Update this with a more robust solution.
  &[fullscreen] {
    @include mat-fill();

    &.mat-drawer-opened {
      overflow: hidden;
    }
  }
}

.mat-drawer-backdrop {
  @include mat-fill();

  display: block;

  // Because of the new stacking context, the z-index stack is new and we can use our own
  // numbers.
  z-index: $mat-drawer-backdrop-z-index;

  // We use 'visibility: hidden | visible' because 'display: none' will not animate any
  // transitions, while visibility will interpolate transitions properly.
  // see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility, the Interpolation
  // section.
  visibility: hidden;

  &.mat-drawer-shown {
    visibility: visible;
  }

  .mat-drawer-transition & {
    transition: {
      duration: $swift-ease-out-duration;
      timing-function: $swift-ease-out-timing-function;
      property: background-color, visibility;
    }
  }

  @include cdk-high-contrast {
    opacity: 0.5;
  }
}

.mat-drawer-content {
  // `backface-visibility` prevents the element from repainting on scroll. This is the
  // equivalent of using `translateZ(0)`, but it doesn't create a new stacking context.
  @include backface-visibility(hidden);
  @include mat-drawer-stacking-context($mat-drawer-content-z-index);

  display: block;
  height: 100%;
  overflow: auto;

  .mat-drawer-transition & {
    transition: {
      duration: $swift-ease-out-duration;
      timing-function: $swift-ease-out-timing-function;
      property: transform, margin-left, margin-right;
    }
  }
}

.mat-drawer {
{'fraction_non_alphanumeric': 0.13099374565670605, 'fraction_numerical': 0.0057331480194579565, 'mean_word_length': 3.1777939042089987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3715827', 'n_tokens_mistral': 1956, 'n_tokens_neox': 1851, 'n_words': 511}