From f8b4ae03af85b0d4c3a10fc80490d4e11f447038 Mon Sep 17 00:00:00 2001 From: abe33 Date: Tue, 2 Dec 2014 14:38:52 +0100 Subject: [PATCH] :bug: Fix missing decorations caused by shadow root --- lib/minimap-render-view.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/minimap-render-view.coffee b/lib/minimap-render-view.coffee index 54646f21..6c3f6f7d 100644 --- a/lib/minimap-render-view.coffee +++ b/lib/minimap-render-view.coffee @@ -386,7 +386,7 @@ class MinimapRenderView extends ScrollView # # Returns a {String}. retrieveDecorationColorFromDom: (decoration) -> - @retrieveStyleFromDom(decoration.getProperties().scope.split(/\s+/), 'background-color') + @retrieveStyleFromDom(decoration.getProperties().scope.split(/\s+/), 'background-color', false) # Internal: This function insert a dummy element in the DOM to compute # its style, return the specified property, and remove the element @@ -396,8 +396,8 @@ class MinimapRenderView extends ScrollView # property - The property {String} name. # # Returns a {String} of the property value. - retrieveStyleFromDom: (scopes, property) -> - @ensureDummyNodeExistence() + retrieveStyleFromDom: (scopes, property, shadowRoot=true) -> + @ensureDummyNodeExistence(shadowRoot) parent = @dummyNode for scope in scopes @@ -415,11 +415,14 @@ class MinimapRenderView extends ScrollView # Internal: Creates a DOM node container for all the operations that # need to read styles properties from DOM. - ensureDummyNodeExistence: -> + ensureDummyNodeExistence: (shadowRoot) -> unless @dummyNode? @dummyNode = document.createElement('span') @dummyNode.style.visibility = 'hidden' + if shadowRoot @editorView.shadowRoot.appendChild(@dummyNode) + else + @editorView.appendChild(@dummyNode) # Internal: Converts a `rgb(...)` color into a `rgba(...)` color # with the specified opacity.