Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Remove shadow DOM from atom-text-editor #12903

Merged
merged 38 commits into from Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
56a6510
Start on removing shadow DOM
Sep 22, 2016
b71b412
Transform deprecated shadow DOM selectors
Sep 22, 2016
853130f
Rewrite TokenizedBufferIterator in js
Sep 27, 2016
2d553fa
Return scopes prepended with `--syntax` from `TokenizedBufferIterator`
Sep 28, 2016
93512ba
Add deprecated syntax selectors
Oct 3, 2016
ad39693
:art:
Oct 3, 2016
712e91b
Convert StyleManager to JavaScript
Oct 3, 2016
7174b54
Convert style-manager-spec to JavaScript
Oct 3, 2016
92a3c2f
Use a more accurate list for deprecated-syntax-selectors.js
Oct 4, 2016
80fc448
Transform deprecated shadow DOM selectors in StyleManager
Oct 4, 2016
895dbdf
Add StyleManager.prototype.{onDidUpdateDeprecations,getDeprecations}
Oct 4, 2016
f8a89ed
Add backward compatible classes to TextEditorComponent's root node
Oct 4, 2016
0f6e018
Throw an error if there is any deprecation in a spec
Oct 4, 2016
8280fa9
Rewrite LinesTileComponent in JavaScript
Oct 5, 2016
3147a2c
Fix wrong variable name causing style.width to be constantly re-assigned
Oct 5, 2016
35e45ef
Improve selector deprecation message
Oct 6, 2016
9c5bdda
Reimplement block decorations without the shadow DOM
Oct 6, 2016
ae942b8
Put back missing comment that was accidentally deleted with decaf
Oct 6, 2016
e94ea55
:art:
Oct 6, 2016
91df848
Keep a backward compatible DOM structure for `atom-text-editor` contents
Oct 6, 2016
abef1f2
Exclude `folded` from deprecated syntax selectors
Oct 6, 2016
51e186b
Delete leftover ::shadow pseudo-selectors
Oct 6, 2016
1091b0e
Fix decorations flashing more than once
Oct 6, 2016
4db895c
Transform also more complex `atom-text-editor` selectors
Oct 6, 2016
07d56b2
Cache style sheet deprecated selectors transformations in StyleManager
Oct 6, 2016
901b0b1
Fix failing tests
Oct 7, 2016
d48c1e9
Tweak wording in TextEditorElement spec
Oct 7, 2016
e4274e5
Include Atom version in deprecation message
Oct 7, 2016
4df74be
Merge branch 'master' into as-deprecate-shadow-dom
Oct 17, 2016
be82d40
:arrow_up: Upgrade core packages to suppress deprecations
Oct 17, 2016
a6999e4
Fix lint errors
Oct 17, 2016
883bb15
Don't trigger a blur event when focusing the same editor twice
Oct 17, 2016
c6832d5
Add TextEditorElement.lightDOM to make package specs backward compatible
Oct 17, 2016
fd7f5ae
Fix tests
Oct 17, 2016
1466bca
:arrow_up: apm
Oct 17, 2016
7a12876
:arrow_up: package-generator
Oct 17, 2016
dffaa6f
:arrow_up: command-palette
Oct 17, 2016
a629e91
Merge branch 'master' into as-deprecate-shadow-dom
Oct 18, 2016
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
2 changes: 1 addition & 1 deletion apm/package.json
Expand Up @@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "1.12.5"
"atom-package-manager": "1.13.0"
}
}
4 changes: 2 additions & 2 deletions dot-atom/styles.less
Expand Up @@ -26,7 +26,7 @@ atom-text-editor {
// background-color: hsl(180, 24%, 12%);
}

// To style other content in the text editor's shadow DOM, use the ::shadow expression
atom-text-editor::shadow .cursor {
// style UI elements inside atom-text-editor
atom-text-editor .cursor {
// border-color: red;
}
50 changes: 26 additions & 24 deletions package.json
Expand Up @@ -47,6 +47,8 @@
"nslog": "^3",
"oniguruma": "6.1.0",
"pathwatcher": "~6.5",
"postcss": "5.2.4",
"postcss-selector-parser": "2.2.1",
"property-accessors": "^1.1.3",
"random-words": "0.0.1",
"resolve": "^1.1.6",
Expand All @@ -67,18 +69,18 @@
"yargs": "^3.23.0"
},
"packageDependencies": {
"atom-dark-syntax": "0.27.0",
"atom-dark-ui": "0.52.0",
"atom-light-syntax": "0.28.0",
"atom-light-ui": "0.45.0",
"base16-tomorrow-dark-theme": "1.3.0",
"base16-tomorrow-light-theme": "1.3.0",
"one-dark-ui": "1.6.2",
"one-light-ui": "1.6.2",
"one-dark-syntax": "1.5.0",
"one-light-syntax": "1.5.0",
"solarized-dark-syntax": "1.0.5",
"solarized-light-syntax": "1.0.5",
"atom-dark-syntax": "0.28.0",
"atom-dark-ui": "0.53.0",
"atom-light-syntax": "0.29.0",
"atom-light-ui": "0.46.0",
"base16-tomorrow-dark-theme": "1.4.0",
"base16-tomorrow-light-theme": "1.4.0",
"one-dark-ui": "1.7.0",
"one-light-ui": "1.7.0",
"one-dark-syntax": "1.6.0",
"one-light-syntax": "1.6.0",
"solarized-dark-syntax": "1.1.0",
"solarized-light-syntax": "1.1.0",
"about": "1.7.0",
"archive-view": "0.62.0",
"autocomplete-atom-api": "0.10.0",
Expand All @@ -87,43 +89,43 @@
"autocomplete-plus": "2.33.1",
"autocomplete-snippets": "1.11.0",
"autoflow": "0.27.0",
"autosave": "0.23.1",
"autosave": "0.23.2",
"background-tips": "0.26.1",
"bookmarks": "0.42.0",
"bookmarks": "0.43.1",
"bracket-matcher": "0.82.2",
"command-palette": "0.39.0",
"deprecation-cop": "0.54.1",
"command-palette": "0.39.1",
"deprecation-cop": "0.55.1",
"dev-live-reload": "0.47.0",
"encoding-selector": "0.22.0",
"exception-reporting": "0.40.0",
"find-and-replace": "0.202.1",
"find-and-replace": "0.203.0",
"fuzzy-finder": "1.4.0",
"git-diff": "1.1.0",
"git-diff": "1.2.0",
"go-to-line": "0.31.0",
"grammar-selector": "0.48.2",
"image-view": "0.60.0",
"incompatible-packages": "0.26.1",
"keybinding-resolver": "0.35.0",
"line-ending-selector": "0.5.0",
"link": "0.31.2",
"markdown-preview": "0.158.8",
"markdown-preview": "0.159.0",
"metrics": "1.0.0",
"notifications": "0.65.1",
"open-on-github": "1.2.1",
"package-generator": "1.0.1",
"settings-view": "0.243.1",
"package-generator": "1.0.2",
"settings-view": "0.244.0",
"snippets": "1.0.3",
"spell-check": "0.68.4",
"spell-check": "0.68.5",
"status-bar": "1.6.0",
"styleguide": "0.47.2",
"styleguide": "0.47.3",
"symbols-view": "0.113.1",
"tabs": "0.103.0",
"timecop": "0.33.2",
"tree-view": "0.210.0",
"update-package-dependencies": "0.10.0",
"welcome": "0.35.1",
"whitespace": "0.35.0",
"wrap-guide": "0.38.2",
"wrap-guide": "0.39.0",
"language-c": "0.54.0",
"language-clojure": "0.22.1",
"language-coffee-script": "0.48.0",
Expand Down
39 changes: 1 addition & 38 deletions spec/atom-reporter.coffee
Expand Up @@ -97,7 +97,7 @@ class AtomReporter
if @failedCount is 1
@message.textContent = "#{@failedCount} failure"
else
@message.textConent = "#{@failedCount} failures"
@message.textContent = "#{@failedCount} failures"

reportSuiteResults: (suite) ->

Expand All @@ -110,42 +110,6 @@ class AtomReporter
reportSpecStarting: (spec) ->
@specStarted(spec)

addDeprecations: (spec) ->
deprecations = grim.getDeprecations()
@deprecationCount += deprecations.length
@deprecations.style.display = '' if @deprecationCount > 0
if @deprecationCount is 1
@deprecationStatus.textContent = "1 deprecation"
else
@deprecationStatus.textContent = "#{@deprecationCount} deprecations"

for deprecation in deprecations
@deprecationList.appendChild(@buildDeprecationElement(spec, deprecation))

grim.clearDeprecations()

buildDeprecationElement: (spec, deprecation) ->
div = document.createElement('div')
div.className = 'padded'
div.innerHTML = """
<div class="result-message fail deprecation-message">
#{marked(deprecation.message)}
</div>
"""

for stack in deprecation.getStacks()
fullStack = stack.map ({functionName, location}) ->
if functionName is '<unknown>'
" at #{location}"
else
" at #{functionName} (#{location})"
pre = document.createElement('pre')
pre.className = 'stack-trace padded'
pre.textContent = formatStackTrace(spec, deprecation.message, fullStack.join('\n'))
div.appendChild(pre)

div

handleEvents: ->
listen document, 'click', '.spec-toggle', (event) ->
specFailures = event.currentTarget.parentElement.querySelector('.spec-failures')
Expand Down Expand Up @@ -273,7 +237,6 @@ class AtomReporter
specView = new SpecResultView(spec)
specView.attach()
@failedCount++
@addDeprecations(spec)

class SuiteResultView
constructor: (@suite) ->
Expand Down
4 changes: 2 additions & 2 deletions spec/lines-yardstick-spec.coffee
Expand Up @@ -70,7 +70,7 @@ describe "LinesYardstick", ->
font-size: 12px;
font-family: monospace;
}
.function {
.syntax--function {
font-size: 16px
}
"""
Expand Down Expand Up @@ -144,7 +144,7 @@ describe "LinesYardstick", ->
font-size: 12px;
font-family: monospace;
}
.function {
.syntax--function {
font-size: 16px
}
"""
Expand Down
30 changes: 22 additions & 8 deletions spec/spec-helper.coffee
Expand Up @@ -105,10 +105,10 @@ beforeEach ->
addCustomMatchers(this)

afterEach ->
ensureNoDeprecatedFunctionCalls()
ensureNoDeprecatedStylesheets()
atom.reset()

document.getElementById('jasmine-content').innerHTML = '' unless window.debugContent

warnIfLeakingPathSubscriptions()
waits(0) # yield to ui thread to make screen update more frequently

Expand All @@ -118,8 +118,9 @@ warnIfLeakingPathSubscriptions = ->
console.error("WARNING: Leaking subscriptions for paths: " + watchedPaths.join(", "))
pathwatcher.closeAllWatchers()

ensureNoDeprecatedFunctionsCalled = ->
deprecations = Grim.getDeprecations()
ensureNoDeprecatedFunctionCalls = ->
deprecations = _.clone(Grim.getDeprecations())
Grim.clearDeprecations()
if deprecations.length > 0
originalPrepareStackTrace = Error.prepareStackTrace
Error.prepareStackTrace = (error, stack) ->
Expand All @@ -136,9 +137,19 @@ ensureNoDeprecatedFunctionsCalled = ->
error = new Error("Deprecated function(s) #{deprecations.map(({originName}) -> originName).join ', '}) were called.")
error.stack
Error.prepareStackTrace = originalPrepareStackTrace

throw error

ensureNoDeprecatedStylesheets = ->
deprecations = _.clone(atom.styles.getDeprecations())
atom.styles.clearDeprecations()
for sourcePath, deprecation of deprecations
title =
if sourcePath isnt 'undefined'
"Deprecated stylesheet at '#{sourcePath}':"
else
"Deprecated stylesheet:"
throw new Error("#{title}\n#{deprecation.message}")

emitObject = jasmine.StringPrettyPrinter.prototype.emitObject
jasmine.StringPrettyPrinter.prototype.emitObject = (obj) ->
if obj.inspect
Expand All @@ -154,12 +165,15 @@ jasmine.attachToDOM = (element) ->
jasmineContent = document.querySelector('#jasmine-content')
jasmineContent.appendChild(element) unless jasmineContent.contains(element)

deprecationsSnapshot = null
grimDeprecationsSnapshot = null
stylesDeprecationsSnapshot = null
jasmine.snapshotDeprecations = ->
deprecationsSnapshot = _.clone(Grim.deprecations)
grimDeprecationsSnapshot = _.clone(Grim.deprecations)
stylesDeprecationsSnapshot = _.clone(atom.styles.deprecationsBySourcePath)

jasmine.restoreDeprecationsSnapshot = ->
Grim.deprecations = deprecationsSnapshot
Grim.deprecations = grimDeprecationsSnapshot
atom.styles.deprecationsBySourcePath = stylesDeprecationsSnapshot

jasmine.useRealClock = ->
jasmine.unspy(window, 'setTimeout')
Expand Down
68 changes: 0 additions & 68 deletions spec/style-manager-spec.coffee

This file was deleted.