adobe/brackets — pull request #6568 by oslego (2014-01-17 13:19:57+00:00)
Title: Add test to highlight where CSSUtils.getInfoAtPos() returns invalid context on functional notation values

A recent change to CodeMirror (I assume) causes `CSSUtils.getInfoAtPos()` to return invalid context when putting the cursor inside the parentheses of CSS functional notation values. Two tests added; one works, one fails.

Example:
This works: polygon(0 0, 100px 100px);
This fails: polygon(nonzero, 0 0, 100px, 100px);

`CSSUtils.getInfoAtPos()` used to work on both cases a few weeks ago. [A recent change to CSSUtils.js]
(https://github.com/adobe/brackets/commit/d6eacd631f0b1385d38fcdf9775927757cca46b8) brought updates to the internal methods used for `getInfoAtPos()`, perhaps to sync with CodeMirror API updates.

I tracked down the issue to a undefined context got from CodeMirror when focusing the cursor inside the functional value notation __only when__ the value contains a modifier, for example: polygon(__n|onzero__, 0 0)

function getInfoAtPos(editor, constPos) {
...
ctx = TokenUtils.getInitialContext(editor._codeMirror, pos) // undefined

I have tried debugging CodeMirror for a few hours, but it has proved beyond my understanding.
Can someone please help me look into this issue?

The result I'm looking for is a correct CSS info object from `CSSUtils.getInfoAtPos()` when querying the functional notation value both with and without the modifier. I suspect this issue may also affect gradients - linear and radial - which can use modifiers such as "top", "left", "right" and so forth.