mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Synchronously sample font styling when global editor stylesheet changes
And don’t sample font styling in pollDOM, which we are aiming to eliminate. Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
This commit is contained in:
committed by
Thomas Johansen
parent
0560ce7f18
commit
8bb3ec1563
@@ -649,11 +649,12 @@ class TextEditorComponent
|
||||
return unless @performedInitialMeasurement
|
||||
return unless @themes.isInitialLoadComplete()
|
||||
|
||||
# This delay prevents the styling from going haywire when stylesheets are
|
||||
# reloaded in dev mode. It seems like a workaround for a browser bug, but
|
||||
# not totally sure.
|
||||
|
||||
unless @stylingChangeAnimationFrameRequested
|
||||
# Handle styling change synchronously if a global editor property such as
|
||||
# font size might have changed. Otherwise coalesce multiple style sheet changes
|
||||
# into a measurement on the next animation frame to prevent excessive thrashing.
|
||||
if styleElement.getAttribute('source-path') is 'global-text-editor-styles'
|
||||
@handleStylingChange()
|
||||
else if not @stylingChangeAnimationFrameRequested
|
||||
@stylingChangeAnimationFrameRequested = true
|
||||
requestAnimationFrame =>
|
||||
@stylingChangeAnimationFrameRequested = false
|
||||
@@ -757,7 +758,6 @@ class TextEditorComponent
|
||||
pollDOM: =>
|
||||
if @isVisible()
|
||||
@sampleBackgroundColors()
|
||||
@sampleFontStyling()
|
||||
@overlayManager?.measureOverlays()
|
||||
|
||||
# Measure explicitly-styled height and width and relay them to the model. If
|
||||
|
||||
@@ -64,7 +64,6 @@ class WorkspaceElement extends HTMLElement {
|
||||
line-height: ${this.config.get('editor.lineHeight')};
|
||||
}`
|
||||
this.styleManager.addStyleSheet(styleSheetSource, {sourcePath: 'global-text-editor-styles', priority: -1})
|
||||
this.viewRegistry.performDocumentPoll()
|
||||
}
|
||||
|
||||
initialize (model, {config, project, styleManager, viewRegistry}) {
|
||||
|
||||
Reference in New Issue
Block a user