Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 164627 Details for
Bug 308928
Only partition style block as CSS if dictated
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
308928.patch (text/plain), 4.52 KB, created by
Nick Sandonato
on 2010-04-12 16:47:25 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Nick Sandonato
Created:
2010-04-12 16:47:25 EDT
Size:
4.52 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.html.core >Index: src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java,v >retrieving revision 1.16 >diff -u -r1.16 StructuredTextPartitionerForHTML.java >--- src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java 26 Feb 2010 20:57:05 -0000 1.16 >+++ src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java 12 Apr 2010 20:47:08 -0000 >@@ -73,6 +73,13 @@ > return super.createPartition(offset, length, stype); > } > } >+ else if (type == IHTMLPartitions.STYLE) { >+ IStructuredDocumentRegion node = fStructuredDocument.getRegionAtCharacterOffset(offset); >+ if (node != null) { >+ String stype = getStylePartitionType(node); >+ return super.createPartition(offset, length, stype); >+ } >+ } > return super.createPartition(offset, length, type); > } > >@@ -84,6 +91,12 @@ > localType = getScriptingPartitionType(node); > } > } >+ else if (type == IHTMLPartitions.STYLE) { >+ IStructuredDocumentRegion node = fStructuredDocument.getRegionAtCharacterOffset(offset); >+ if (node != null) { >+ localType = getStylePartitionType(node); >+ } >+ } > super.setInternalPartition(offset, length, localType); > } > >@@ -136,6 +149,40 @@ > return result; > } > >+ private String getStylePartitionType(IStructuredDocumentRegion coreNode) { >+ String type = null; >+ String result = IHTMLPartitions.STYLE; >+ IStructuredDocumentRegion node = coreNode; >+ ITextRegion attrNameRegion = null; >+ while (node != null && isValidScriptingRegionType(node.getType())) { >+ node = node.getPrevious(); >+ } >+ >+ ITextRegionList regions = node.getRegions(); >+ if (regions.size() > 4 && regions.get(1).getType() == DOMRegionContext.XML_TAG_NAME) { >+ ITextRegion potentialTypeRegion = regions.get(1); >+ String potentialTypeString = node.getText(potentialTypeRegion); >+ if (potentialTypeString.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) { >+ for (int i = 0; i < regions.size(); i++) { >+ ITextRegion region = regions.get(i); >+ String regionType = region.getType(); >+ if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) >+ attrNameRegion = region; >+ else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) { >+ String attrName = node.getText(attrNameRegion); >+ if (attrName.equalsIgnoreCase(HTML40Namespace.ATTR_NAME_TYPE)) { >+ type = StringUtils.strip(node.getText(region)); >+ break; >+ } >+ attrNameRegion = null; >+ } >+ } >+ } >+ } >+ result = lookupStyleType(type); >+ return result; >+ } >+ > private boolean isValidScriptingRegionType(String type) { > return type == DOMRegionContext.BLOCK_TEXT || type == DOMRegionContext.XML_CDATA_OPEN || type == DOMRegionContext.XML_CDATA_TEXT || type == DOMRegionContext.XML_CDATA_CLOSE; > } >@@ -144,6 +191,12 @@ > fSupportedTypes = getConfiguredContentTypes(); > } > >+ private String lookupStyleType(String type) { >+ if (type == null || type.length() == 0 || "text/css".equalsIgnoreCase(type)) //$NON-NLS-1$ >+ return ICSSPartitions.STYLE; >+ return IHTMLPartitions.STYLE; >+ } >+ > private String lookupScriptType(String type) { > for (int i = 0; i < ScriptLanguageKeys.JAVASCRIPT_MIME_TYPE_KEYS.length; i++) > if (ScriptLanguageKeys.JAVASCRIPT_MIME_TYPE_KEYS[i].equalsIgnoreCase(type)) >@@ -202,7 +255,7 @@ > // return ST_SCRIPT; > return getScriptingPartitionType(fStructuredDocument.getRegionAtCharacterOffset(previousNode.getStartOffset(previousStartTagNameRegion))); > else if (name1.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE) && name2.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) >- return ICSSPartitions.STYLE; >+ return getStylePartitionType(fStructuredDocument.getRegionAtCharacterOffset(previousNode.getStartOffset(previousStartTagNameRegion))); > return super.getPartitionTypeBetween(previousNode, nextNode); > } > >@@ -218,7 +271,7 @@ > else if (tagname.equalsIgnoreCase(HTML40Namespace.ElementName.SCRIPT)) > result = IHTMLPartitions.SCRIPT; > else if (tagname.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE) || isStyleAttributeValue(region,offset)) >- result = ICSSPartitions.STYLE; >+ result = IHTMLPartitions.STYLE; > else if (region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE && isScriptAttributeValue(region, offset)) > result = IHTMLPartitions.SCRIPT_EVENTHANDLER; > else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 308928
: 164627