(Kind of) fix treatment of strange dir values

We don't really want <span dir="auto"> to be treated as a language
annotation. So only consider spans language annotations if they
either have a lang attribute, or a dir attribute that's specifically
set to ltr or rtl.

Also fix a bug where not having a lang attribute set would cause
the LanguageInputWidget to crash.

Bug: 70731
Change-Id: Ib41560526e7dcab1b4ab9813eea67dbe821a4001
Merge "(Kind of) fix treatment of strange dir values"