| Summary: | Error in CSS shorthand expansion. | ||
|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | Yang Liu <yliu000> |
| Component: | wst.css | Assignee: | Sarika Sinha <sarika.sinha> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Nick Sandonato <nsand.dev> |
| Severity: | major | ||
| Priority: | P3 | CC: | thatnitind |
| Version: | 1.0 | Keywords: | helpwanted |
| Target Milestone: | 3.2 M4 | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | |||
thanks very much for your clear test case and analysis. We'll take a look .. I think there's another bug somewhere involving that sharedDocument (I think ... if that's the one that a class variable). no time this release, unless a case can be made this is blocking some usecase. reassigning to you Nick, since you've handled some other CSS items ... maybe you'd know if a dup, or something, even though it's marked as 'helpwanted'. Looks like it has been fixed indirectly by #124835. |
To reproduce the bug, I created a simple HTML file "a.html", and the content is as following: <div style="border: solid red">a</div> Then I try to get the individual border styles, and use a program like the following: --------------------------------------------------------------------- StructuredTextEditor sse = (StructuredTextEditor) _targetEditor; IDOMModel model = (IDOMModel) sse.getModel(); IDOMElement ele = (IDOMElement) model.getDocument().getDocumentElement(); CSSQueryTraverser traverser = new CSSQueryTraverser(); traverser.setElement(ele, null); ICSSStyleDeclaration decl = traverser.getDeclaration(); StringBuffer buffer = new StringBuffer(); buffer.append("decl.getPropertyCSSValue(\"border-left-style\"): " + decl.getPropertyValue("border-left-style") + "\n"); buffer.append("decl.getPropertyCSSValue(\"border-right-style\"): " + decl.getPropertyValue("border-right-style") + "\n"); buffer.append("decl.getPropertyCSSValue(\"border-top-style\"): " + decl.getPropertyValue("border-top-style") + "\n"); buffer.append("decl.getPropertyCSSValue(\"border-bottom-style\"): " + decl.getPropertyValue("border-bottom-style") + "\n"); System.out.println(buffer); -------------------------------------------------------------------- The output is like following: decl.getPropertyCSSValue("border-left-style"): solid decl.getPropertyCSSValue("border-right-style"): null decl.getPropertyCSSValue("border-top-style"): solid decl.getPropertyCSSValue("border-bottom-style"): solid -------------------------------------------------------------------- Notice that for the "border-right-style" the result is "null"! If I remove the "red" to change the HTML source to: <div style="border: solid">a</div> The output will be: decl.getPropertyCSSValue("border-left-style"): null decl.getPropertyCSSValue("border-right-style"): null decl.getPropertyCSSValue("border-top-style"): null decl.getPropertyCSSValue("border-bottom-style"): solid **************************************************************************** After some investigation, I believe the problem is relation to the usage of "CSSStyleDeclItemImpl.java#sharedStructuredDocument". "sharedStructuredDocument" is shared, but seemed something wrong with it. If I comment out line 234 of CSSStyleDeclItemImpl to disable sharing, then everything works fine. // if (sharedStructuredDocument == null) { IDocumentLoader loader = new CSSDocumentLoader(); sharedStructuredDocument = (IStructuredDocument) loader.createNewStructuredDocument(); ((CSSSourceParser) sharedStructuredDocument.getParser()).setParserMode(CSSSourceParser.MODE_DECLARATION_VALUE); // }