Example #1
0
 def _getBoundingRectFromOffset(self, offset):
     formatFieldStart, formatFieldEnd = self._getUnitOffsets(
         textInfos.UNIT_FORMATFIELD, offset)
     # The format field starts at the first character.
     for field in reversed(
             self._getFieldsInRange(formatFieldStart,
                                    formatFieldStart + 1)):
         if not (isinstance(field, textInfos.FieldCommand)
                 and field.command == "formatChange"):
             # This is no format field.
             continue
         attrs = field.field
         ia2TextStartOffset = attrs.get("ia2TextStartOffset")
         if ia2TextStartOffset is None:
             # No ia2TextStartOffset specified, most likely a format field that doesn't originate from IA2Text.
             continue
         ia2TextStartOffset += attrs.get("strippedCharsFromStart", 0)
         relOffset = offset - formatFieldStart + ia2TextStartOffset
         obj = self._getNVDAObjectFromOffset(offset)
         if not hasattr(obj, "IAccessibleTextObject"):
             raise LookupError(
                 "Object doesn't have an IAccessibleTextObject")
         return IA2TextTextInfo._getBoundingRectFromOffsetInObject(
             obj, relOffset)
     return super(Gecko_ia2_TextInfo,
                  self)._getBoundingRectFromOffset(offset)
Example #2
0
	def _getBoundingRectFromOffset(self,offset):
		formatFieldStart, formatFieldEnd = self._getUnitOffsets(self.UNIT_FORMATFIELD, offset)
		# The format field starts at the first character.
		for field in reversed(self._getFieldsInRange(formatFieldStart, formatFieldStart+1)):
			if not (isinstance(field, textInfos.FieldCommand) and field.command == "formatChange"):
				# This is no format field.
				continue
			attrs = field.field
			ia2TextStartOffset = attrs.get("ia2TextStartOffset")
			if ia2TextStartOffset is None:
				# No ia2TextStartOffset specified, most likely a format field that doesn't originate from IA2Text.
				continue
			ia2TextStartOffset += attrs.get("strippedCharsFromStart", 0)
			relOffset = offset - formatFieldStart + ia2TextStartOffset
			obj = self._getNVDAObjectFromOffset(offset)
			if not hasattr(obj, "IAccessibleTextObject"):
				raise LookupError("Object doesn't have an IAccessibleTextObject")
			return IA2TextTextInfo._getBoundingRectFromOffsetInObject(obj, relOffset)
		return super(Gecko_ia2_TextInfo, self)._getBoundingRectFromOffset(offset)