Closed Bug 307646 Opened 19 years ago Closed 6 years ago

non-HTML and non-XUL element has wrong box model

Categories

(Other Applications :: DOM Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: surkov, Unassigned)

Details

(Keywords: helpwanted)

Attachments

(1 file, 3 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050821 Firefox/1.6a1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050821 Firefox/1.6a1 XUL document contains element of some custom namespace. When I watch element in DOM Inspector then x, y, width and height parameters of its box model has value 'undefined'. Since thease properties can be specified by css rules then properties shouldn't be undefined. Example you can see in bug 307627.ceht Reproducible: Always
This is not a layout issue. It's a DOM inspector issue. See http://lxr.mozilla.org/seamonkey/source/extensions/inspector/resources/content/viewers/boxModel/boxModel.js the showPositionStats and showDimensionStats functions. Inspector assumes that anything that's not a XUL element is an HTML element.
Assignee: nobody → dom-inspector
Status: UNCONFIRMED → NEW
Component: Layout → DOM Inspector
Ever confirmed: true
Keywords: helpwanted
OS: Windows 2000 → All
Product: Core → Other Applications
QA Contact: layout → timeless
Hardware: PC → All
Summary: Element of unknown for mozilla namespace has wrong box model → non-HTML and non-XUL element has wrong box model
(In reply to comment #1) > This is not a layout issue. It's a DOM inspector issue. See > http://lxr.mozilla.org/seamonkey/source/extensions/inspector/resources/content/viewers/boxModel/boxModel.js > the showPositionStats and showDimensionStats functions. Inspector assumes that > anything that's not a XUL element is an HTML element. > I guess the problem has no one issue. XUL element has boxObject property and HTML element has nsIDOMNSHTMLElement interface, but I cannot find proper interface for custorm namespace element. Is there a way to obtain dimensions for custom namespace element? There are problems what can be related with the one. When custom namespace element is placed in xul document then it is not displayed (it has default value of 'display' property). When I set 'display' property on '-moz-box' then element is displayed properly. It looks strange for me. There is one more problem in bug 313857.
> Is there a way to obtain dimensions for custom namespace element? Computed style sorta does it. But "dimensions" is an ill-defined concept -- XUL box object and the HTML properties are not at all equivalent, and neither has much to do with the CSS properties of the same name. > When custom namespace element is placed in xul document then it is not displayed Box layout is so much fun. ;)
(In reply to comment #3) > > Is there a way to obtain dimensions for custom namespace element? > > Computed style sorta does it. But "dimensions" is an ill-defined concept -- > XUL box object and the HTML properties are not at all equivalent, and neither > has much to do with the CSS properties of the same name. > Do you mean getComputedStyle() method? var style = window.getComputedStyle(element, null); style.width is "auto" style.height is "auto" And more how can I get x and y, screenX and screenY coordinates?
> Do you mean getComputedStyle() method? Yes. > style.width is "auto" > style.height is "auto" Either the element is not being rendered, or you're using the wrong window. > And more how can I get x and y, screenX and screenY coordinates? You can't. They're not well-defined anyway.
Attached patch patch (obsolete) (deleted) — Splinter Review
(In reply to comment #5) > Either the element is not being rendered, or you're using the wrong window. > I guess it is not rendered. When custom namespace element should be rendered? If I specify "display: -moz-box" then width and height are defined (not 'auto' value). If "display: inline" then element has width and height as 'auto'. It is a right behaviour? > > And more how can I get x and y, screenX and screenY coordinates? > You can't. They're not well-defined anyway. Why are not they well-defined? Boris, please take a look at the patch.
> If "display: inline" then element has width and height as 'auto'. It is > a right behaviour? Ah, yes. That's correct behavior. I don't like the namespace URI detection in the patch; please use object detection instead (looking for boxObject or testing instanceof the relevant XUL interface, and testing instanceof the relevant HTML interface). The strings the patch outputs need to be localized and the English localization needs to be "not available", probably. > Why are not they well-defined? What is the "x" of some random box? What is the "screenX" of some random _element_? Consider that an element can generate multiple boxes that appear at different positions on screen.
Attached patch patch (obsolete) (deleted) — Splinter Review
Attachment #207064 - Attachment is obsolete: true
(In reply to comment #8) > > I don't like the namespace URI detection in the patch; please use object > detection instead (looking for boxObject or testing instanceof the relevant XUL > interface, and testing instanceof the relevant HTML interface). I guess fixed. The strings > the patch outputs need to be localized and the English localization needs to be > "not available", probably. There is a problem, locales contains many languages and I should add new properties file for each. But I don't know all languages :). What should I do?
You add it for the en-US locale (and whichever other locales you care to), and then the localizers handle the rest. ;) Note that you might be able to reuse an existing inspector properties file; not sure.
For what it's worth, I get: ----- The following addresses had permanent fatal errors ----- <surkov@dc.baikal.ru> (reason: 550 5.7.1 <surkov@dc.baikal.ru>... Access denied) when I try to send mail to that address.
(In reply to comment #11) > You add it for the en-US locale (and whichever other locales you care to), and > then the localizers handle the rest. ;) > Probably I should add no translated (english) string to all locale packages. If I will not do it then no-modified packages will be broken. What do you think? > Note that you might be able to reuse an existing inspector properties file; not > sure. > Yes, I want to use inspector.properties.
> If I will not do it then no-modified packages will be broken. That's fine, on trunk.
So now I get: ----- The following addresses had permanent fatal errors ----- <surkov@dc.baikal.ru> (reason: 553 5.3.0 <surkov@dc.baikal.ru>... Spam blocked - see http://spamcop.net/bl.shtml? 18.72.1.2) (where 18.72.1.2 is the IP address of the MIT SMTP server). The message I was trying to send was: Alexander Surkov wrote: > What is the "x" of some random box? > > What is the "screenX" of some random _element_? Consider that an element can > generate multiple boxes that appear at different positions on screen. > > &#1045;&#1089;&#1083;&#1080; &#1101;&#1083;&#1077;&#1084;&#1077;&#1085;&#1090; &#1075;&#1076;&#1077;-&#1090;&#1086; &#1086;&#1090;&#1086;&#1073;&#1088;&#1072;&#1078;&#1072;&#1077;&#1090;&#1089;&#1103;, &#1090;&#1086;, &#1084;&#1085;&#1077; &#1082;&#1072;&#1078;&#1077;&#1090;&#1089;&#1103;, &#1086;&#1085; &#1076;&#1086;&#1083;&#1078;&#1077;&#1085; &#1080;&#1084;&#1077;&#1090;&#1100; &#1082;&#1086;&#1086;&#1088;&#1076;&#1080;&#1085;&#1072;&#1090;&#1099;, > &#1075;&#1076;&#1077; &#1086;&#1085; &#1086;&#1090;&#1086;&#1073;&#1088;&#1072;&#1078;&#1072;&#1077;&#1090;&#1089;&#1103;. U menya tut net russkoj klaviatury.... Delo v tom, chto element mozhet odnovremenno otobrazhat'sya v neskol'kih mestah. Kakie u nego togda koordinaty? > &#1053;&#1077; &#1087;&#1086;&#1085;&#1103;&#1083; &#1089;&#1080;&#1090;&#1091;&#1072;&#1094;&#1080;&#1080;, &#1082;&#1086;&#1075;&#1076;&#1072; &#1101;&#1083;&#1077;&#1084;&#1077;&#1085;&#1090; &#1089;&#1086;&#1079;&#1076;&#1072;&#1077;&#1090; &#1085;&#1077;&#1089;&#1082;&#1086;&#1083;&#1100;&#1082;&#1086; &#1073;&#1086;&#1082;&#1089;&#1086;&#1074;. Est' neskol'ko takih situacij. > &#1048; &#1087;&#1086;&#1095;&#1077;&#1084;&#1091; &#1101;&#1090;&#1086;&#1075;&#1086; &#1085;&#1077; &#1084;&#1086;&#1075;&#1091; &#1089;&#1076;&#1077;&#1083;&#1072;&#1090;&#1100; xul &#1080; html &#1101;&#1083;&#1077;&#1084;&#1077;&#1085;&#1090;&#1099;. Mogut. Dlya HTML opredelenie koordinat takoe: "Delaj to, chto delaet IE". Dlya XUL, opredeleniya net -- lyudi kotorye napisali etot kod ne ochen' podumali. I teper' s nim ochen' trudno rabotat' v nekotoryh situaciyah.
Attached patch patch (obsolete) (deleted) — Splinter Review
Attachment #207145 - Attachment is obsolete: true
that should be "not available", not "no available"
Attached patch patch (deleted) — Splinter Review
(In reply to comment #17) > that should be "not available", not "no available" > fixed
Attachment #207232 - Attachment is obsolete: true
who can review the patch?
Assignee: dom-inspector → nobody
QA Contact: timeless → dom-inspector
Bulk close. This component is no longer supported or maintained. https://bugzilla.mozilla.org/show_bug.cgi?id=1499023
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Bulk close. This component is no longer supported or maintained. https://bugzilla.mozilla.org/show_bug.cgi?id=1499023
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: