Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363564 - [formatting] CSS formatter breaks the style tag when it looks like it contains JSP EL
Summary: [formatting] CSS formatter breaks the style tag when it looks like it contain...
Status: REOPENED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal with 1 vote (vote)
Target Milestone: 3.6.2   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-11 05:32 EST by Radu Toader CLA
Modified: 2018-02-02 09:41 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Radu Toader CLA 2011-11-11 05:32:38 EST
Build Identifier: 20110916-0149

<style>
	#containment {
		height: ${bannerVO.realHeight}px;
		width: ${bannerVO.realWidth}px;
		background: #${bannerVO.bgColor};
		border-color: #${bannerVO.borderColor};
		border-width: ${bannerVO.borderWidth};
		border-style: solid;
		position: relative;
		background-repeat: no-repeat;	
		border-radius:${bannerVO.borderRadius}px;
		-moz-border-radius:${bannerVO.borderRadius}px;
		-webkit-border-radius: ${bannerVO.borderRadius}px;
}
</style>


after format



<style>
#containment {
	height: ${bannerVO.realHeight
}

px
;

		
width
:
 
${
bannerVO
.realWidth
}
px
;

		
background
:
 
#${
bannerVO
.bgColor
}
;
border-color
:
 
#${
bannerVO
.borderColor
}
;
border-width
:
 
${
bannerVO
.borderWidth
}
;
border-style: solid ;
		position: relative ;
		background-repeat: no-repeat ;	
		border-radius: ${bannerVO .borderRadius
	
}

px ;
		-moz-border-radius: ${bannerVO .borderRadius
	
}
px
;

		
-webkit-border-radius
:
 
${
bannerVO
.borderRadius
}
px
;


}
</style>


Reproducible: Always

Steps to Reproduce:
1. write code
2. format
Comment 1 Radu Toader CLA 2012-01-31 17:56:05 EST
Any update on this formatter Issue ?
Comment 2 Nick Sandonato CLA 2012-02-01 10:09:46 EST
(In reply to comment #1)
> Any update on this formatter Issue ?

Other than a diagnosis, not really. The JSP formatter delegates to the CSS formatter for the <style> region. Because braces of syntactic meaning in CSS, these stray ones are being mis-interpreted by the parser. We might be able to have the CSS formatter skip over these areas, but I don't think it will be quite as simple as that since these stray braces do seem to wreak havoc on the model.
Comment 3 Radu Toader CLA 2012-02-01 14:48:27 EST
Can you tell me wich class is responsible for css formatting in eclipse SDK, or how do I find the right project ?
it is obvios that :
height is a property and everything after that until ";" must be on the same line.

it doesn't matter if it has "{" , "}" 
and by the way 
in front of "{" there is a "$" and this will never be a selector from my side.

I would like to wrote that code to format correctly css, just tell me where can I find it, and then I will mail you the solution.
Comment 4 Nick Sandonato CLA 2012-02-06 15:06:13 EST
(In reply to comment #3)
> Can you tell me wich class is responsible for css formatting in eclipse SDK, or
> how do I find the right project ?
> it is obvios that :
> height is a property and everything after that until ";" must be on the same
> line.
> 
> it doesn't matter if it has "{" , "}" 
> and by the way 
> in front of "{" there is a "$" and this will never be a selector from my side.
> 
> I would like to wrote that code to format correctly css, just tell me where can
> I find it, and then I will mail you the solution.

Hi Radu,

The CSS formatters are in package org.eclipse.wst.css.core.internal.formatter, where I believe the particular formatter is StyleDeclItemFormatter. You can get the source from :pserver:anonymous@dev.eclipse.org:/cvsroot/webtools, just checkout org.eclipse.wst.css.core under HEAD.
Comment 5 Radu Toader CLA 2012-02-06 17:00:34 EST
I've found it. Thanks
I'll reply when I will have a relevant solution
Comment 7 Nitin Dahyabhai CLA 2014-01-17 18:14:19 EST
Reopening. Fix for this breaks the Web Page Editor due to the JSPedCSSTokenizer not handling the example in bug 425940 comment 2.
Comment 8 Rizwan Raza CLA 2018-02-02 09:41:30 EST
Same thing happened with me.

Before, I write CSS in my own and valid Format

@-webkit-keyframes sk-bounce { 
	0%, 100% {
		-webkit-transform: scale(0.0)
	}

	50% {
		-webkit-transform: scale(1.0)
	}
}
@keyframes sk-bounce { 
	0%, 100% {
		transform: scale(0.0);
		-webkit-transform: scale(0.0);
	}
	50% {
		transform: scale(1.0);
		-webkit-transform:scale(1.0);
	}
}


After Format (Pressing Ctrl+Shift+F)

@
-webkit-keyframes sk-bounce { 0%, 100% {
	-webkit-transform: scale(0.0)
}

50%
{
-webkit-transform


:

 

scale


(1
.0


)
}
}
@
keyframes sk-bounce { 0%, 100% {
	transform: scale(0.0);
	-webkit-transform: scale(0.0);
}
50%
{
transform


:

 

scale


(1
.0


);
-webkit-transform


:

 

scale


(1
.0


);
}
}

The CSS and Animation are also not working due to above format.