getScrollY() returns incorrect value for large content

Given a block of text, I need to divide it into smaller ones that best fit in an HTML field (like page formatting).

What I did:

  1. Created a field (named fld) of the required size & of type HTML Area
  2. Gave it a form variable (named dp) as data provider
  3. Read the block of text from the database and placed it in dp
  4. The code looks as follows:

// assign block read from database to data provider dp here…
elements.fld.setScroll(0, 1000000); // give it an arbitrarily high Y value
if (elements.fld.getScrollY() > 0) {
// Text does not fit. Perform paging routine here…
}

  1. getScrollY() works fine except if the given block is too big (i.e. exceeds a certain arbitrary size - I noticed that it can return values as high as about 4400 but beyond that it returns 0).