Commit Graph

19438 Commits

Author SHA1 Message Date
Nathan Sobo
84d1101903 Upgrade package-generator to fix specs with shadow DOM 2014-11-04 16:37:26 -07:00
Nathan Sobo
6f3c53a17a Only cancel focus events if the editor is or contains the related target 2014-11-04 16:37:26 -07:00
Nathan Sobo
dd17e8f018 Replace focusout event handlers on hiddenInput shim with blur handlers
The focusout event doesn’t seem to work for elements in the shadow DOM.
Other people seem to share this experience:

https://code.google.com/p/chromium/issues/detail?id=378163#c7
2014-11-04 16:37:26 -07:00
Nathan Sobo
cf3f1aa2eb Don’t handle text editor focus when it already has focus 2014-11-04 16:37:26 -07:00
Nathan Sobo
adaf1829da Determine focus using document.activeElement instead of component state 2014-11-04 16:37:26 -07:00
Nathan Sobo
7863db480e Override jQuery.contains instead of jQuery.fn.position
Turns out the problems with position inside the shadow DOM are due to
the fact that elements in the light DOM don’t claim to contain elements
from a shadow DOM, causing jQuery.fn.offset to bail out early and
misreport positions inside the editor.
2014-11-04 16:37:26 -07:00
Nathan Sobo
5cc243ec11 Inject both underlayer and overlayer via shadow DOM insertion points 2014-11-04 16:37:25 -07:00
Nathan Sobo
2e46cf9b8d Refefine $.fn.position in terms of offsetTop/Left to work w/ shadow DOM
The default implementation of position seems to barf when things are in
the shadow DOM. This seems to be a suitable replacement that doesn’t.
2014-11-04 16:37:25 -07:00
Nathan Sobo
5e8655fa60 Don’t use :focus selector to store previously focused element 2014-11-04 16:37:25 -07:00
Nathan Sobo
c64a4b7ca9 Fallback to light DOM in TextEditorView::find if nothing found in shadow 2014-11-04 16:37:25 -07:00
Nathan Sobo
bda1429293 Trigger ‘blur’ on select list editor instead of ‘focusut’ on its input 2014-11-04 16:37:25 -07:00
Nathan Sobo
eb19989ecd Handle focus at the host element level
Detecting focus and blur at the level of the input is creating problems
when we blur and then immediately refocus. This is simpler.
2014-11-04 16:37:25 -07:00
Nathan Sobo
62c0db11ee Define enter as ‘core:confirm’ in select-list mini editors
We were leaving this to packages to define, and they were getting it
wrong by selecting into the ‘input’ which is now in shadow.
2014-11-04 16:37:25 -07:00
Nathan Sobo
8aeabe5fe5 Listen for ‘blur’ on mini editor of select list rather than ‘focusout’
The focusout handler on the mini editor’s hidden input wasn’t being
triggered, but we can listen for blur directly on the editor now that
the shadow DOM abstracts the focus.
2014-11-04 16:37:25 -07:00
Nathan Sobo
ab846a2495 Put views appended via appendToLinesView in the light DOM
This adds an insertion point to the lines div via a <content> tag,
allowing immediate children of the editor tag to be positioned relative
to the lines div but still be styled via global CSS.
2014-11-04 16:37:24 -07:00
Nathan Sobo
7202908780 Split editor stylesheet into light and shadow DOM versions
This prevents the need for a :host pseudo-class in the editor CSS which
breaks linting. It also fits selectors targeting the host element in a
more intuitive spot in the cascade.
2014-11-04 16:37:24 -07:00
Nathan Sobo
c4cfac5615 Use event capture for pane focus/blur events
Focusin/focusout don’t seem to bubble properly across shadow DOM
boundaries, so capturing is a more reliable alternative.
2014-11-04 16:37:24 -07:00
Nathan Sobo
866f2d9a76 Fix appendToLinesView 2014-11-04 16:37:24 -07:00
Nathan Sobo
3b455c00d3 Proxy TextEditorView::find calls to the root inside the shadow DOM 2014-11-04 16:37:24 -07:00
Nathan Sobo
1f777addd9 Sample font styling when font config values change
We previously could do it whenever stylesheets changed, but these values
end up getting assigned to the global stylesheet for cascading reasons
and we’re only watching the local stylesheet. We poll the host elements
DOM properties, but forcing a sync poll when the config values change
makes behavior synchronous for specs and more responsive when changing
these values.
2014-11-04 16:37:24 -07:00
Nathan Sobo
58744f6b7b Account for shadow DOM when asserting on focus 2014-11-04 16:37:24 -07:00
Nathan Sobo
7badd9ba25 Don’t rely on :focus selector for toHaveFocus matcher
:focus doesn’t work properly when focus is inside the shadow DOM of
an element, but document.activeElement does.
2014-11-04 16:37:23 -07:00
Nathan Sobo
e8d7058383 Go back to the plain “theme” group for theme stylesheets 2014-11-04 16:37:23 -07:00
Nathan Sobo
42fc54f716 Protect against stylesheets changing while detached 2014-11-04 16:37:23 -07:00
Nathan Sobo
c11675dca1 Don’t recycle the same composite disposable for stylesheet activation 2014-11-04 16:37:23 -07:00
Nathan Sobo
cdb62812d2 Don’t use syntax themes in spec because they are inserted in shadow DOM 2014-11-04 16:37:23 -07:00
Nathan Sobo
2d3d64f399 Call reloadStylesheets instead of reloadStylesheet in spec 2014-11-04 16:37:23 -07:00
Nathan Sobo
2321aa2bee Get SpacePen outlet shims from inside shadow DOM 2014-11-04 16:37:23 -07:00
Nathan Sobo
fa733c85ad Fix setEditorHeightInLines shim now that we’ve dropped .react class 2014-11-04 16:37:23 -07:00
Nathan Sobo
158bbef38f Account for shadow dom when asserting active element 2014-11-04 16:37:22 -07:00
Nathan Sobo
b2bc09c13d Apply stylesheets with atom-editor-context in text editor specs 2014-11-04 16:37:22 -07:00
Nathan Sobo
268fceb073 Specify border-box sizing for the cursor to fix specs 2014-11-04 16:37:22 -07:00
Nathan Sobo
5be21d6743 Avoid traversing through shadow root on mousewheel events 2014-11-04 16:37:22 -07:00
Nathan Sobo
5d3602d37b Get node once to attach event handlers 2014-11-04 16:37:22 -07:00
Nathan Sobo
b86f6870c5 Use native event handlers instead of React
React event handlers don’t work because of the shadow DOM
2014-11-04 16:37:22 -07:00
Nathan Sobo
2ab5fa405c Apply mini and is-focused class to both editor host element and root
This preserves existing theming behavior
2014-11-04 16:37:22 -07:00
Nathan Sobo
5f4fb23057 Initialize atom-styles element in editor shadow dom before measuring 2014-11-04 16:37:22 -07:00
Nathan Sobo
22f6268116 Assign StylesElement::context on attachment 2014-11-04 16:37:21 -07:00
Nathan Sobo
65f40d6f7b Move font styling to host element so font preferences work 2014-11-04 16:37:21 -07:00
Nathan Sobo
596987fbce Fix sourcePath on text editor stylesheet loading 2014-11-04 16:37:21 -07:00
Nathan Sobo
2b218d2e01 Only update atom-styles children on context attribute change if attached 2014-11-04 16:37:21 -07:00
Nathan Sobo
582066915b Apply syntax theme stylesheets in text editor shadow DOM via atom.styles 2014-11-04 16:37:21 -07:00
Nathan Sobo
1a98cb7070 Use atom.styles to activate stylesheets in packages 2014-11-04 16:37:21 -07:00
Nathan Sobo
c2d0b6d4f5 Load editor stylesheet in shadow root with style manager context param 2014-11-04 16:37:21 -07:00
Nathan Sobo
2affff30ff Handle events with native handlers to avoid shadow DOM issues with React 2014-11-04 16:37:21 -07:00
Nathan Sobo
3b6189e94b Create WeakMap on element creation to support ‘context’ attribute change 2014-11-04 16:37:21 -07:00
Nathan Sobo
4e8e5a84c4 Support context attribute in <atom-styles> 2014-11-04 16:37:20 -07:00
Nathan Sobo
087387e633 Style mini editor font sizes on atom-text-editor host element
…instead of via the shadow DOM. We always honor the computed font
styles of the host element.
2014-11-04 16:37:20 -07:00
Nathan Sobo
769c6c52bb Make atom-text-editor have “display: block” 2014-11-04 16:37:20 -07:00
Nathan Sobo
963c92eb4e Hack: Add editor stylesheets to atom-text-editor shadow root 2014-11-04 16:37:20 -07:00