question: private Pair < String , TtmlRegion > parseRegionAttributes ( XmlPullParser xmlParser ) { String regionId = ParserUtil . getAttributeValue ( xmlParser , TtmlNode . ATTR_ID ) ; String regionOrigin = ParserUtil . getAttributeValue ( xmlParser , TtmlNode . ATTR_TTS_ORIGIN ) ; String regionExtent = ParserUtil . getAttributeValue ( xmlParser , TtmlNode . ATTR_TTS_EXTENT ) ; if ( regionOrigin == null || regionId == null ) { return null ; } float position = Cue . DIMEN_UNSET ; float line = Cue . DIMEN_UNSET ; Matcher originMatcher = PERCENTAGE_COORDINATES . matcher ( regionOrigin ) ; if ( originMatcher . matches ( ) ) { try { position = Float . parseFloat ( originMatcher . group ( 1 ) ) / 100.f ; line = Float . parseFloat ( originMatcher . group ( 2 ) ) / 100.f ; } catch ( NumberFormatException e ) { Log . w ( TAG , "Ignoring region with malformed origin: '" + regionOrigin + "'" , e ) ; position = Cue . DIMEN_UNSET ; } } float width = Cue . DIMEN_UNSET ; if ( regionExtent != null ) { Matcher extentMatcher = PERCENTAGE_COORDINATES . matcher ( regionExtent ) ; if ( extentMatcher . matches ( ) ) { try { width = Float . parseFloat ( extentMatcher . group ( 1 ) ) / 100.f ; } catch ( NumberFormatException e ) { Log . w ( TAG , "Ignoring malformed region extent: '" + regionExtent + "'" , e ) ; } } } return position != Cue . DIMEN_UNSET ? new Pair < > ( regionId , new TtmlRegion ( position , line , Cue . LINE_TYPE_FRACTION , width ) ) : null ; }
target:  Parses a region declaration. Supports origin and extent definition but only when defined in terms of percentage of the viewport. Regions that do not correctly declare origin are ignored.