| Summary: | Text of content proposals is often cropped | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Sabine Neubauer <neubauer> | ||||||
| Component: | JFace | Assignee: | Project Inbox <rap-inbox> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | ivan, rsternberg | ||||||
| Version: | 1.4 | ||||||||
| Target Milestone: | 1.5 M1 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 330461 | ||||||||
| Attachments: |
|
||||||||
|
Description
Sabine Neubauer
Created attachment 198066 [details]
Project for reproducing the problem
Created attachment 198067 [details]
Screenshot showing the cropped proposals
Reproducible with CVS HEAD. The problem was in the private method Table#max. In case of TableItems with the same text length this method leads to wrong measured item, because the actual item text width is not taken into account. The fix is to compare the items by actual text width instead of text length. Not possible to create JUnit test as this method rely on actual text size determination values (not the estimated one). Changes are in CVS HEAD. I patched the Table#max method in my used RAP bundles based on RAP 1.4 RC2 and retested the issue.
First all seemed to be fine, but if the proposals text contains a sequence of spaces, the behavior is strange. First the proposals are not cropped, than the table get refreshed and the proposals are cropped. The problem only occurs if the spaces are within the text. Leading spaces seem to be no problem.
In order to reproduce this, you have to adapt the SampleView of the attached project. By replacing the line:
String itemText = "item " + UUID.randomUUID().toString();
with
String itemText = "item " + UUID.randomUUID().toString();
I have checked this with InternetExplorer 8 and Firefox 3.6
The problem is in TextSizeUtilFacadeImpl#createItemParamFragment method. Here *only* leading and trailing spaces are escaped, before sending the string to the client for actual size measurement. I remember that this was done due to some problems in the past with wrapped text measurement. Ralf, do you remember exactly why the multiple spaces in the middle of the string are not escaped? If this is not a problem anymore we could replace: --- textToMeasure = EncodingUtil.escapeLeadingTrailingSpaces( textToMeasure ); --- with: --- textToMeasure = EncodingUtil.replaceWhiteSpaces( textToMeasure ); --- (In reply to comment #6) > If this is not a problem anymore we could replace: > --- > textToMeasure = EncodingUtil.escapeLeadingTrailingSpaces( textToMeasure ); > --- > with: > --- > textToMeasure = EncodingUtil.replaceWhiteSpaces( textToMeasure ); > --- What's the current state of this issue? Will it be possible to fix it for RAP 1.4 SR2? (In reply to comment #6) > The problem is in TextSizeUtilFacadeImpl#createItemParamFragment method. Here > *only* leading and trailing spaces are escaped, before sending the string to the > client for actual size measurement. I remember that this was done due to some > problems in the past with wrapped text measurement. Ralf, do you remember > exactly why the multiple spaces in the middle of the string are not escaped? If we'd escape them, i.e. turning them into nbsp's, then text would not wrap anymore. Years ago we discussed replacing them by a sequence of spaces and nbsp's, so that the browser would not trim the spaces but still is able to wrap texts. But even with this approach, there are issues. At any rate, we should have a specific bug for the TSD issue. In the context of supporting alternative clients the whitespace replacement will have to go to the client, doesn't it? We should not render entities to native clients. (In reply to comment #7) > What's the current state of this issue? Will it be possible to fix it for RAP > 1.4 SR2? I'm sorry, but since this is not one of our current priorities, I cannot make any commitments here. If you need a fix quickly, check out our professional support: http://eclipse.org/rap/support/professional-services/ (In reply to comment #8) > In the context of supporting alternative clients the whitespace replacement > will have to go to the client, doesn't it? We should not render entities > to native clients. With the migration of TSD to the protocol all escaping are performed on the client. I've opened a separate bug 371360 for the TSD issue. I will close this one as fixed as the initial bug in the Table has been fixed. |