Draw glyphs after selection background

When multiple lines of text are selected, TextSelectionPainter will
draw selections over each other, hiding the previous line with the
selection background of the current line.  This patch changes
TextSelectionPainter so that glyphs are drawn only after the entire
background is drawn.

https://bugs.freedesktop.org/show_bug.cgi?id=65989
TextOutputDev: Move TextSelection class from TextSelectionPainter to TextSelectionVisitor

So that it can be used by other TextSelectionVisitor implementations.
Also renamed it as TextWordSelection since it contains a word selection.
TextOutputDev: simplify the text selection dumper

Build a list of lines of words and don't try to format the text when
detecting tables, simply add the words and lines in the right order.
TextOutputDev: add a method to TextPage to get the selection as a list of words

Returns a list of lines of words.
glib: Use TextPage::getSelectionWords to build text layout and attributes

This way we can make sure that the list of words used in
poppler_page_get_text_layout and poppler_page_get_text_attributes is the
same that the one used in poppler_page_get_text. This fixes the mismatch
between the number of characters in the text returned by
poppler_page_get_text and the number of characters returned by
poppler_page_get_text_layout in some documents.