@@ -4212,7 +4212,9 @@ SocialCalc.RenderContext = function(sheetobj) {
4212
4212
this . cellskip = { } ; // if present, coord of cell covering this cell
4213
4213
this . coordToCR = { } ; // for cells starting spans, coordToCR[coord]={row:row, col:col}
4214
4214
this . colwidth = [ ] ; // precomputed column widths, taking into account defaults
4215
+ this . rowheight = [ ] ; // precomputed row height, taking into account defaults
4215
4216
this . totalwidth = 0 ; // precomputed total table width
4217
+ this . totalheight = 0 ; // precomputed total table height
4216
4218
4217
4219
this . rowpanes = [ ] ; // for each pane, {first: firstrow, last: lastrow}
4218
4220
this . colpanes = [ ] ; // for each pane, {first: firstrow, last: lastrow}
@@ -4324,6 +4326,7 @@ SocialCalc.RenderContext = function(sheetobj) {
4324
4326
SocialCalc . RenderContext . prototype . PrecomputeSheetFontsAndLayouts = function ( ) { SocialCalc . PrecomputeSheetFontsAndLayouts ( this ) ; } ;
4325
4327
SocialCalc . RenderContext . prototype . CalculateCellSkipData = function ( ) { SocialCalc . CalculateCellSkipData ( this ) ; } ;
4326
4328
SocialCalc . RenderContext . prototype . CalculateColWidthData = function ( ) { SocialCalc . CalculateColWidthData ( this ) ; } ;
4329
+ SocialCalc . RenderContext . prototype . CalculateRowHeightData = function ( ) { SocialCalc . CalculateRowHeightData ( this ) ; } ;
4327
4330
SocialCalc . RenderContext . prototype . SetRowPaneFirstLast = function ( panenum , first , last ) { this . rowpanes [ panenum ] = { first :first , last :last } ; } ;
4328
4331
SocialCalc . RenderContext . prototype . SetColPaneFirstLast = function ( panenum , first , last ) { this . colpanes [ panenum ] = { first :first , last :last } ; } ;
4329
4332
SocialCalc . RenderContext . prototype . CoordInPane = function ( coord , rowpane , colpane ) { return SocialCalc . CoordInPane ( this , coord , rowpane , colpane ) ; } ;
@@ -4464,6 +4467,28 @@ SocialCalc.CalculateColWidthData = function(context) {
4464
4467
4465
4468
}
4466
4469
4470
+ SocialCalc . CalculateRowHeightData = function ( context ) {
4471
+ var rownum , rowheight , totalheight ;
4472
+ var sheetobj = context . sheetobj ;
4473
+
4474
+ // Calculate row height data
4475
+ totalheight = context . showRCHeaders ? context . pixelsPerRow : 0 ;
4476
+ for ( rowpane = 0 ; rowpane < context . rowpanes . length ; rowpane ++ ) {
4477
+ for ( rownum = context . rowpanes [ rowpane ] . first ; rownum <= context . rowpanes [ rowpane ] . last ; rownum ++ ) {
4478
+ if ( sheetobj . rowattribs . hide [ rownum ] === "yes" ) {
4479
+ context . rowheight [ rownum ] = 0 ;
4480
+ } else {
4481
+ rowheight = sheetobj . rowattribs . height [ rownum ] || sheetobj . attribs . defaultrowheight || SocialCalc . Constants . defaultAssumedRowHeight ;
4482
+ if ( rowheight === "blank" || rowheight === "auto" ) rowheight = "" ;
4483
+ context . rowheight [ rownum ] = rowheight + "" ;
4484
+ totalheight += ( rowheight && ( ( rowheight - 0 ) > 0 ) ) ? ( rowheight - 0 ) : 10 ;
4485
+ }
4486
+ }
4487
+ }
4488
+ context . totalheight = totalheight ;
4489
+
4490
+ }
4491
+
4467
4492
SocialCalc . InitializeTable = function ( context , tableobj ) {
4468
4493
4469
4494
/*
@@ -4527,6 +4552,7 @@ SocialCalc.RenderSheet = function(context, oldtable, linkstyle) {
4527
4552
}
4528
4553
4529
4554
context . CalculateColWidthData ( ) ; // always make sure col width values are up to date
4555
+ context . CalculateRowHeightData ( ) ;
4530
4556
4531
4557
// make the table element and fill it in
4532
4558
@@ -4579,6 +4605,7 @@ SocialCalc.RenderRow = function(context, rownum, rowpane, linkstyle) {
4579
4605
if ( context . classnames ) newcol . className = context . classnames . rowname ;
4580
4606
if ( context . explicitStyles ) newcol . style . cssText = context . explicitStyles . rowname ;
4581
4607
newcol . width = context . rownamewidth ;
4608
+ newcol . height = context . rowheight [ rownum ] ;
4582
4609
newcol . style . verticalAlign = "top" ; // to get around Safari making top of centered row number be
4583
4610
// considered top of row (and can't get <row> position in Safari)
4584
4611
newcol . innerHTML = rownum + "" ;
@@ -4592,6 +4619,9 @@ SocialCalc.RenderRow = function(context, rownum, rowpane, linkstyle) {
4592
4619
var unhide = document . createElement ( "div" ) ;
4593
4620
if ( context . classnames ) unhide . className = context . classnames . unhidetop ;
4594
4621
if ( context . explicitStyles ) unhide . style . cssText = context . explicitStyles . unhidetop ;
4622
+ var fixPosition = ( ( context . rowheight [ rownum ] - 0 ) - SocialCalc . Constants . defaultAssumedRowHeight ) ;
4623
+ fixPosition = ( fixPosition === 0 ) ? 4 : fixPosition ;
4624
+ unhide . style . bottom = '-' + fixPosition + 'px' ;
4595
4625
context . rowunhidetop [ rownum ] = unhide ;
4596
4626
container . appendChild ( unhide ) ;
4597
4627
newcol . appendChild ( container ) ;
0 commit comments