Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Rendering performance optimizations, promote-layer mixin #429

Merged
merged 5 commits into from Sep 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions assets/timber.scss.liquid
Expand Up @@ -243,6 +243,14 @@ $socialIconFontStack: 'icons';
}
}

/*============================================================================
Layer promotion mixin for creating smoother animations with higher FPS.
==============================================================================*/
@mixin promote-layer($properties: transform) {
-webkit-transform: translateZ(0); // translateZ hack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way/need to add an IE solution to this? I've never really thought about it until now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it comes to the rendering optimization game IE's pretty much left out of the conversation since, as far as I know, they have never (historically) offered these kind of tools to developers, nor any insight into how their rendering engine actually works. However, the beauty of the standardized will-change property, as opposed to translateZ, is it's not implementation specific, and so any rendering optimization that IE does build should be based off of this property, making this code "future-proof".

will-change: $properties; // spec
}

/*============================================================================
Dependency-free breakpoint mixin
- Based on http://blog.grayghostvisuals.com/sass/sass-media-query-mixin/
Expand Down Expand Up @@ -2047,9 +2055,11 @@ label.error {
==============================================================================*/
.js-drawer-open {
overflow: hidden;
height: 100%;
}

.drawer {
@include promote-layer();
display: none;
position: fixed;
overflow-y: auto;
Expand Down Expand Up @@ -2114,6 +2124,7 @@ label.error {
}

.is-moved-by-drawer {
@include promote-layer();
transition: $drawerTransition;

.js-drawer-open-left & {
Expand Down