Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Sandonato2014-06-12 11:20:29 -0400
committerNick Sandonato2014-06-12 11:20:29 -0400
commitab62207dca46f543d8d8a57cdcd26cc65ce669d8 (patch)
tree0c11f50cd4b65fc9a1ab32cd38a4094887560727
parentd10b51dd9b6a6ea783df1c2535d5a81c73858070 (diff)
downloadwebtools.sourceediting-R3_2_5_patches.tar.gz
webtools.sourceediting-R3_2_5_patches.tar.xz
webtools.sourceediting-R3_2_5_patches.zip
[436412] backport Bug 428374: [formatting] unknown regions remove inline css text to WTP 3.2.5v201406121520R3_2_5_patches
-rw-r--r--bundles/org.eclipse.wst.css.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java27
-rw-r--r--features/org.eclipse.wst.web_core.feature.patch/buildnotes_org.eclipse.wst.web_core.feature.patch.html2
-rw-r--r--features/org.eclipse.wst.web_core.feature.patch/feature.properties1
-rw-r--r--features/org.eclipse.wst.web_core.feature.patch/feature.xml6
5 files changed, 36 insertions, 2 deletions
diff --git a/bundles/org.eclipse.wst.css.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.css.core/META-INF/MANIFEST.MF
index a47b5edc0b..68970e3e95 100644
--- a/bundles/org.eclipse.wst.css.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.css.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.css.core; singleton:=true
-Bundle-Version: 1.1.403.qualifier
+Bundle-Version: 1.1.404.qualifier
Bundle-Activator: org.eclipse.wst.css.core.internal.CSSCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
index 8ceb1387a3..8dc5665fad 100644
--- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -487,6 +487,7 @@ public abstract class AbstractCSSSourceFormatter implements CSSSourceGenerator {
*/
protected final void formatChildren(ICSSNode node, StringBuffer source) {
ICSSNode child = node.getFirstChild();
+ ICSSNode last = null;
boolean first = true;
while (child != null) {
// append child
@@ -499,10 +500,34 @@ public abstract class AbstractCSSSourceFormatter implements CSSSourceGenerator {
formatBefore(node, child, new String(childSource), source, null);
}
source.append(childSource);
+ last = child;
// append between children
child = child.getNextSibling();
first = false;
}
+ // This handles the case where the last child doesn't align with the end of the parent node, likely malformed content
+ if (node instanceof IndexedRegion && last instanceof IndexedRegion && (node.getOwnerDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE)) {
+ IndexedRegion parent = (IndexedRegion) node;
+ IndexedRegion lastChild = (IndexedRegion) last;
+ if (lastChild.getEndOffset() < parent.getEndOffset()) {
+ // Find the region at the end offset of the last child
+ IStructuredDocumentRegion region = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(lastChild.getEndOffset());
+ ITextRegionList regions = region != null ? region.getRegions() : null;
+ if (regions != null) {
+ Iterator it = regions.iterator();
+ while (it.hasNext()) {
+ ITextRegion token = (ITextRegion) it.next();
+ if (token.getType() == CSSRegionContexts.CSS_UNKNOWN) {
+ // Found something that won't be consumed. Append the regions that remain in the node to the source
+ do {
+ source.append(region.getFullText());
+ } while ((region = region.getNext()) != null && region.getEndOffset() <= parent.getEndOffset());
+ break;
+ }
+ }
+ }
+ }
+ }
}
/**
diff --git a/features/org.eclipse.wst.web_core.feature.patch/buildnotes_org.eclipse.wst.web_core.feature.patch.html b/features/org.eclipse.wst.web_core.feature.patch/buildnotes_org.eclipse.wst.web_core.feature.patch.html
index 1937c845e0..bd85441715 100644
--- a/features/org.eclipse.wst.web_core.feature.patch/buildnotes_org.eclipse.wst.web_core.feature.patch.html
+++ b/features/org.eclipse.wst.web_core.feature.patch/buildnotes_org.eclipse.wst.web_core.feature.patch.html
@@ -17,5 +17,7 @@
<p>Bug <a href="https://bugs.eclipse.org/368737">368737</a>. Allow adopters to add @Remote and @Local annotations to EJB class when creating a session EJB</p>
<p>Bug <a href="https://bugs.eclipse.org/368749">368749</a>. Allow to change the default package for interfaces when creating new session EJBs</p>
<p>Bug <a href="https://bugs.eclipse.org/371019">371019</a>. Incorrect validation of resource across web projects</p>
+<h3>org.eclipse.wst.css.core</h3>
+<p>Bug <a href="https://bugs.eclipse.org/371019">436412</a>. backport Bug 428374 - [formatting] unknown regions remove inline css text to WTP 3.2.5</p>
</body>
</html> \ No newline at end of file
diff --git a/features/org.eclipse.wst.web_core.feature.patch/feature.properties b/features/org.eclipse.wst.web_core.feature.patch/feature.properties
index db6eb8020d..be0b284d56 100644
--- a/features/org.eclipse.wst.web_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.web_core.feature.patch/feature.properties
@@ -31,6 +31,7 @@ Bug https://bugs.eclipse.org/367856 [validation] Track javascript dependencies f
Bug https://bugs.eclipse.org/368737 Allow adopters to add @Remote and @Local annotations to EJB class when creating a session EJB\n\
Bug https://bugs.eclipse.org/368749 Allow to change the default package for interfaces when creating new session EJBs\n\
Bug https://bugs.eclipse.org/371019 Incorrect validation of resource across web projects\n\
+Bug https://bugs.eclipse.org/436412 backport Bug 428374 - [formatting] unknown regions remove inline css text to WTP 3.2.5\n\
\n\
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
diff --git a/features/org.eclipse.wst.web_core.feature.patch/feature.xml b/features/org.eclipse.wst.web_core.feature.patch/feature.xml
index 356c2207be..bcedf2c7fb 100644
--- a/features/org.eclipse.wst.web_core.feature.patch/feature.xml
+++ b/features/org.eclipse.wst.web_core.feature.patch/feature.xml
@@ -33,5 +33,11 @@
install-size="0"
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.wst.css.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
</feature>

Back to the top