Bug 755971 - Switch to using the padding rect size for scrollWidth and scrollHeight, and update tests to continue passing. r=bz, gavin

This commit is contained in:
Kartikaya Gupta 2012-06-21 09:36:57 -04:00
parent d51481e42b
commit e3e8c3d4e0
6 changed files with 19 additions and 26 deletions

View File

@ -3051,13 +3051,13 @@
if (doPosition) {
this.setAttribute("positionpinnedtabs", "true");
let scrollButtonWidth = this.mTabstrip._scrollButtonDown.scrollWidth;
let scrollButtonWidth = this.mTabstrip._scrollButtonDown.getBoundingClientRect().width;
let paddingStart = this.mTabstrip.scrollboxPaddingStart;
let width = 0;
for (let i = numPinned - 1; i >= 0; i--) {
let tab = this.childNodes[i];
width += tab.scrollWidth;
width += tab.getBoundingClientRect().width;
tab.style.MozMarginStart = - (width + scrollButtonWidth + paddingStart) + "px";
}

View File

@ -2159,10 +2159,7 @@ nsGenericElement::GetScrollHeight()
nsIScrollableFrame* sf = GetScrollFrame();
if (!sf) {
nsRect rcFrame;
nsCOMPtr<nsIContent> parent;
GetOffsetRect(rcFrame, getter_AddRefs(parent));
return rcFrame.height;
return GetPaddingRectSize().height;
}
nscoord height = sf->GetScrollRange().height + sf->GetScrollPortRect().height;
@ -2185,10 +2182,7 @@ nsGenericElement::GetScrollWidth()
nsIScrollableFrame* sf = GetScrollFrame();
if (!sf) {
nsRect rcFrame;
nsCOMPtr<nsIContent> parent;
GetOffsetRect(rcFrame, getter_AddRefs(parent));
return rcFrame.width;
return GetPaddingRectSize().width;
}
nscoord width = sf->GetScrollRange().width + sf->GetScrollPortRect().width;

View File

@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=320799
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=320799">Mozilla Bug 320799</a>
<p id="display">
<select id="s" style="width: 100px">
<select id="s" style="width: 100px; -moz-box-sizing: padding-box">
<option>This is a test, it really is a test I tell you</option>
</select>
<select id="s2">

View File

@ -41,13 +41,13 @@ function t3(id,c,o,s,pid) {
function run_test() {
t3('span1',[0,0,20,20],[12,12,20,20],[0,0,20,20],'td1');
t3('td1' ,[1,1,69,44],[16,16,71,46],[0,0,71,46],'table1');
t3('td1' ,[1,1,69,44],[16,16,71,46],[0,0,69,46],'table1');
t3('tr1' ,[0,0,71,46],[16,16,71,46],[0,0,71,44],'table1');
t3('span2',[10,0,20,20],[27,12,30,20],[0,0,30,20],'td2');
t3('table1',[9,9,85,113],[10,10,103,131],[0,0,103,50],'body');
t3('span2',[10,0,20,20],[27,12,30,20],[0,0,20,20],'td2');
t3('table1',[9,9,85,113],[10,10,103,131],[0,0,85,50],'body');
t3('div1',[10,10,-1,131],[0,0,-1,151],[0,0,-1,85],'body');
t3('span2b',[10,0,20,20],[25,-1,30,20],[0,0,30,20],'body');
t3('span2b',[10,0,20,20],[25,-1,30,20],[0,0,20,20],'body');
// XXX not sure how to make reliable cross-platform tests for replaced-inline, inline
// t3('span2c',[10,2,18,2],[25,-1,30,6],[0,0,30,20],'body');
// t3('span2d',[0,0,0,0],[25,-1,10,19],[0,0,10,20],'body');
@ -60,24 +60,24 @@ function run_test() {
t3('div3',[10,10,-1,40],[0,151,-1,60],[0,0,-1,70],'body');
t3('span5' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td5');
t3('td5' ,[7,7,22,22],[2,2,36,36],[0,0,36,36],'table5');
t3('td5' ,[7,7,22,22],[2,2,36,36],[0,0,22,36],'table5');
t3('tr5' ,[0,0,36,36],[2,2,36,36],[0,0,36,22],'table5');
t3('span6' ,[0,0,20,20],[20,58,20,20],[0,0,20,20],'div5');
t3('table5',[0,0,40,78],[0,0,40,78],[0,0,40,78],'div5');
t3('div5',[10,10,-1,78],[0,211,-1,98],[0,0,-1,70],'body');
t3('span7' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td7');
t3('td7' ,[1,1,37,22],[9,9,39,24],[0,0,39,22],'table7');
t3('td7' ,[1,1,37,22],[9,9,39,24],[0,0,37,22],'table7');
t3('tr7' ,[0,0,39,24],[9,9,39,24],[0,0,39,22],'table7');
t3('span8' ,[0,0,20,20],[26,37,20,20],[0,0,20,20],'table7');
t3('table7',[7,7,43,54],[10,319,57,68],[0,0,57,50],'body');
t3('table7',[7,7,43,54],[10,319,57,68],[0,0,43,50],'body');
t3('div7',[10,10,-1,68],[0,309,-1,88],[0,0,-1,70],'body');
t3('span9' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td9');
t3('td9' ,[1,1,22,22],[15,15,24,24],[0,0,24,24],'table9');
t3('td9' ,[1,1,22,22],[15,15,24,24],[0,0,22,24],'table9');
t3('tr9' ,[0,0,24,24],[15,15,24,24],[0,0,24,22],'table9');
t3('span10' ,[0,0,20,20],[17,43,20,20],[0,0,20,20],'table9');
t3('table9',[13,13,28,34],[10,407,54,60],[0,0,54,50],'body');
t3('table9',[13,13,28,34],[10,407,54,60],[0,0,28,50],'body');
t3('div9',[10,10,-1,0],[0,397,-1,20],[0,0,-1,70],'body');
t3('span11' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td11');

View File

@ -68,9 +68,9 @@ function run_test() {
// without hard-coding the scrollbar width?
t3('div1',[20,20,-1,-1],[10,10,200,160],[0,0,230,20],'body');
t3('abs1',[20,20,-1,-1],[500,170,200,160],[0,0,230,20],'body');
t3('table1',[20,20,266,266],[10,170,306,306],[0,0,306,20],'body');
t3('table1',[20,20,266,266],[10,170,306,306],[0,0,266,20],'body');
t3('table2',[0,0,206,206],[0,0,206,206],[0,0,206,20],'table2parent');
t3('table3',[10,10,208,208],[0,0,228,228],[0,0,228,228],'table3parent');
t3('table3',[10,10,208,208],[0,0,228,228],[0,0,208,228],'table3parent');
t3('table3parent',[0,0,228,228],[300,100,228,228],[0,0,228,228],'body');
}
</script>
@ -106,4 +106,4 @@ run_test();
</pre>
</body>
</html>
</html>

View File

@ -71,9 +71,8 @@ function testElement(element)
clientHeight = paddingTop + height + paddingBottom - scrollbarHeight;
}
else {
// XXXndeakin note that Mozilla adds borders here, although the spec does not
scrollWidth = paddingLeft + width + paddingRight + borderLeft + borderRight;
scrollHeight = paddingTop + height + paddingBottom + borderTop + borderBottom;
scrollWidth = paddingLeft + width + paddingRight;
scrollHeight = paddingTop + height + paddingBottom;
clientWidth = paddingLeft + width + paddingRight;
clientHeight = paddingTop + height + paddingBottom;
}