Closed Bug 88243 Opened 23 years ago Closed 23 years ago

text is not correctly layouted (problems with TABLE WIDTH=)

Categories

(Core :: DOM: HTML Parser, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED
mozilla0.9.4

People

(Reporter: ezh, Assigned: harishd)

References

()

Details

(Whiteboard: [fix in hand])

Attachments

(7 files)

Look at the bottom of this page. Starting at * BAD POINTS text is alligned not
as it should.

Also look at here http://forum.spylog.ru/
And here http://www.virusbtn.com/100/vb100sum.html

BTW I bet I alredy filled a bug for it, but couldn't find it. :(
Sorry for the <td> remark. I have it now:

<table WIDTH=50%" BORDER=0 ALIGN="CENTER" CELLSPACING=2>

The " sign after 50% makes Mozilla understand the text as WIDTH=50. To make it
evcen stranger, if you write <table "WIDTH=50%">  the effect is identical. Other
browsers show the one " case correct while ignoring the "" enclosd WIDTH completely.
In the first URL (http://forum.spylog.ru) is is the following line 
<table width= cellspacing=0 cellpadding=0 border=0>
that causes trouble. Take note of the width= attribute with no value. It seems
Mozilla gives it a random value. An uninitiated variable? or the value of an
earlier WIDTH attribute?
Summary: text is not correctly layouted → text is not correctly layouted (problems with TABLE WIDTH=)
Bug 88342 about http://msdn.microsoft.com is identical. I'm not sure which
should be duped against which.
I meant bug 88242. Sorry.
*** Bug 88242 has been marked as a duplicate of this bug. ***
Sounds like the parser is bungling this? harishd, could you take a look? You can 
assign it back to me if it's a core layout problem.
Assignee: karnaze → harishd
Component: Layout → Parser
QA Contact: petersen → bsharma
It seems this is a dup. Forget my remarks about %50 read as 50. It seems in all
the testcases width is read as 0, after all.

*** This bug has been marked as a duplicate of 75250 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
This not a exact duplicate so I reopen it. The first issues look like

"width=50%"  
the string tmp at
http://lxr.mozilla.org/mozilla/source/content/html/content/src/nsGenericHTMLElement.cpp#2419
is 50%"

if I change the width spec to "width="50%" the tmp string will be 50%.
If we decide to support that kind of loosy html then parser should not return a
" in the value string.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
IMO, the problem is

PRBool
nsGenericHTMLElement::ParseValueOrPercentOrProportional(...)
{
  nsAutoString tmp(aString);
  tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
  PRInt32 ec, val = tmp.ToInteger(&ec);
......
  if (tmp.Length() && tmp.Last() == '%') {/* XXX not 100% compatible with
ebina's code */   <<<<<<<< ----- HERE ------ <<<<<<<<<
Status: REOPENED → ASSIGNED
r = bernd, i had the same idea , but I was as afraid as you about performance
issues  
*** Bug 44485 has been marked as a duplicate of this bug. ***
Whiteboard: [fix in hand]
Target Milestone: --- → mozilla0.9.3
Moving to more realistic target - m0.9.4!
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Priority: -- → P3
sr=vidur
http://www.hp.com/ - look at the left bottom. The same issue or a new one?
Hold up a sec.  Does this patch only apply to quirks mode?  The width attribute 
is CDATA and as such should NOT be stripped of whitespace in strict mode (see 
my comments in bug 42287).
Christopher: How do you propose to parse WIDTH=50%" in strict mode? Presently it
is parsed as WIDTH="0". I understand the strict way would be to ignore it, due to
the lack of the first " character (making it equal to WIDTH="100%"). If so, the
present behavior is wrong.

I'm shooting from the hip on this (I returned Goldfarb to the library :-), but 
I think you are correct: "attribute value delimiters" have to occur in matched 
pairs.  So <table width='50%">, <table width="50%> and <table width=50%"> 
should all (I think) be equivalent to <table>.  I'll let you know more 
definitively once I've looked over the SGML Handbook again (or would a member 
of the viewing audience care to oblige? :-)
I don't think Goldfarbs SGML handbook has an answer to this question that is
relevant to HTML, SGML is very strict about how attributes (and everything else)
is parsed, any of the above would simply be parsing errors in SGML, but since
there is no concept of parsing errors in HTML :-) we'll haveto go with common
practice.
Also in strict (or "standards") mode?
Johnny: in quirks mode, we can do whatever we need to support the problem.  (I
assume it's been complained about or this patch wouldn't be appearing.)  My
point is that in strict mode, we should parse this like SGML, get a busted
attribute we don't understand, and silently ignore it, which would produce a
different result than our current behavior (see the latest testcase).  The
reason I'm fussing with Goldfarb is to get a better idea of exactly what is
considered "broken".

As for my earlier tests, I provide the strictly parsed interpretation:
<table width='50%">
<table width="50%>
Tag isn't closed, rest of document interpreted as part of attribute value,
disappears.  An Evangelism bug is filed. :-)

<table width=50%">
attributes containing % signs, etc. need to be quoted.  Attribute not
understood-should drop silently.  This is the case we're currently dealing with.
This seems to be my problem too... BUG 92721

It is my opinion that this behavior is generated inside of the
CAttributeToken::Consume function 
at http://lxr.mozilla.org/seamonkey/source/htmlparser/src/nsHTMLTokens.cpp#1608

I worked around the problem by including a |PRUnichar('"')|  [which is a double
quote inside single quotes] at nsHTMLTokens.cpp#43 but am still not convinced
this is the best approach.  I offer it up here so that others may experiment.  

I will continue to work through the logic of this and get back to you with my
findings.
Fix landed on 08/07/01. Marking FIXED.

FYI: If there are other issues please track it down with a new bug.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
Verified on 2001-08-08-Trunk build on WinNT.

The above url has the same problem as described.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Bindu: could you tell me why you reopened the bug?
The fix was to correct cases like <TABLE WIDTH="80%    ">.

Try attachment (id=41542). Marking FIXED again. 
Status: REOPENED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
I fully agree with closing this bug. 

The chip-online URL is just a case of totally bad HTML which got here by
accident. I'll attach a simplified testcase. The narrow column is the result of
putting two 200 pixel wide tables inside a 448 wide table. The thing would not
happen if aditionally the two table did not have an unnecessary <td
colspan="3"></td> element and if the absurd <li> (without a <ul>) element were
not added to make it completely non-standard. Mozilla gave it interpretation if
the absurd code which by accident was different from the interpretations of
other browsers. If it is a bug it should be IMHO filed under Evangelsm.
Verifying FIXED (WindowsME 2001080804 trunk build)

See above for my comments on the remaining bad URL.
Status: RESOLVED → VERIFIED
*** Bug 54288 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: