Refactoring text layer builder and converting text layer builder to a class

This work is needed for cleaning up the text layer and for separating the text layer builder from the PDF find controller. This PR consists of four commits for easier reviewing.

The first commit:
- fixes code style and properly names functions;
- moves constants to the top of the file;
- reduces unnecessary `typeof` usage;
- caches loop variables;
- reduces unnecessary `in` usage;
- uses strict equalities where possible;
- removes an old TODO;
- uses more descriptive variable names;
- removes the `highlightDiv` and `appendText` functions as `appendText` was just a direct call to `appendTextToDiv` and `highlightDiv` has been inlined because in code it is clear what is does, so this saves some function calls.

The second commit:
- converts the text layer builder to a class.

The third commit:
- refactors PDFFindController in the text layer builder, thereby removing the last `typeof` in this file.

The fourth commit:
- updates the text selection example to remove unnecessary includes.