The site http://arngren.net is a rich environment for finding layout bugs. The
site includes various bugs with the current FLB code discovers. It also has
some bugs FLB doesn't yet seem to detect.
Here are the suggestions for new detectors:
TextOverlapsText
TextInadvertentlyWrapping
I've attached a document with some screenshots that highlight the problems for
the arngren.net web site.
Here are some initial thoughts on ways to detect both problems, these ideas are
half-baked and would need to be refined :)
How to detect TextOverlapsText:
- Identify each segment of text (I assume each would be contained in a distinct
WebElement).
- For each segment, calculate the x,y offset of the 4 points of the rectangle
that contains the text (top left, top right, bottom left, bottom right)
- For each rectangle determine if it overlaps another text rectangle.
I'm limiting the formula to text that is horizontal or vertical.
How to detect TextInadvertentlyWrapping:
I've several ideas related to this:
1. length of the text on each line. If the last line of text has only a few
characters e.g. 1 or 2, and there is no preceding new line character - flag as
a possible 'InadvertentWrap'. This may generate various false positives, so
would need to be checked against a body of sample real-world web content.
2. dimensions of the text area as text size is incremented and decremented. For
single words or short phrases, they generally are 1 line high. The relative
height of each text area should remain roughly constant as the text size is
increased or decreased. When the height dimension changes disproportionately
perhaps the number of lines needed to display the text has changed. Sometimes
this is the correct behaviour and to be expected. Other times, for instance
with the http://arngren.net web site, the height dimension sometimes decreases
relatively (compared to the rest of the text elements) while the overall
dimension increases. I suspect we'd need to apply a combined algorithm that
uses idea 1 (number of characters on last line) with varying the text size.
I'm sure these suggested algorithms have flaws in them and wouldn't be
sufficiently accurate to provide a good signal to noise ratio (noise coming
from false positives, etc). However they might stimulate ideas so you can
devise better algorithms :)
PS: I cannot submit this 'issue' as a feature enhancement in the UI. So please
change it to a feature enhancement if you have permission to do so.
Julian Harty
-
Original issue reported on code.google.com by julianharty on 6 May 2012 at 10:10
Original issue reported on code.google.com by
julianharty
on 6 May 2012 at 10:10Attachments: