@@ -65,8 +65,8 @@ def _getEmbedded(obj, offset) -> typing.Optional[IAccessible]:
6565
6666class MozillaCompoundTextInfo (CompoundTextInfo ):
6767
68- def _getControlFieldForObject (self , obj ):
69- controlField = super ()._getControlFieldForObject (obj )
68+ def _getControlFieldForObject (self , obj , ignoreEditableText = True ):
69+ controlField = super ()._getControlFieldForObject (obj , ignoreEditableText = ignoreEditableText )
7070 if controlField is None :
7171 return None
7272 # Set the uniqueID of the controlField if we can get one
@@ -267,13 +267,7 @@ def _iterRecursiveText(self, ti: offsets.OffsetsTextInfo, controlStack, formatCo
267267 elif isinstance (item , int ): # Embedded object.
268268 embedded : typing .Optional [IAccessible ] = _getEmbedded (ti .obj , item )
269269 notText = _getRawTextInfo (embedded ) is NVDAObjectTextInfo
270- if (
271- controlStack is not None
272- and not (
273- self ._isObjectEditableText (embedded )
274- or self ._isNamedlinkDestination (embedded )
275- )
276- ):
270+ if controlStack is not None :
277271 controlField = self ._getControlFieldForObject (embedded )
278272 controlStack .append (controlField )
279273 if controlField :
@@ -319,19 +313,16 @@ def _getText(self, withFields, formatConfig=None):
319313 ti = self ._start
320314 cannotBeStart = False
321315 while obj and obj != rootObj :
322- if not (
323- self ._isObjectEditableText (obj )
324- or self ._isNamedlinkDestination (obj )
325- ):
326- field = self ._getControlFieldForObject (obj )
316+ field = self ._getControlFieldForObject (obj )
317+ if field :
327318 if ti ._startOffset == 0 :
328319 if not cannotBeStart :
329320 field ["_startOfNode" ] = True
330321 else :
331322 # We're not at the start of this object, which also means we're not at the start of any ancestors.
332323 cannotBeStart = True
333324 fields .insert (0 , textInfos .FieldCommand ("controlStart" , field ))
334- controlStack .insert (0 , field )
325+ controlStack .insert (0 , field )
335326 ti = self ._getEmbedding (obj )
336327 if not ti :
337328 log .debugWarning (
@@ -350,7 +341,7 @@ def _getText(self, withFields, formatConfig=None):
350341 # (We already handled collapsed above.)
351342 return fields
352343 obj = self ._startObj
353- while fields [- 1 ] is not None and controlStack :
344+ while fields [- 1 ] is not None :
354345 # The end hasn't yet been reached, which means it isn't a descendant of obj.
355346 # Therefore, continue from where obj was embedded.
356347 if withFields :
@@ -363,9 +354,10 @@ def _getText(self, withFields, formatConfig=None):
363354 # range is invalid, so just return nothing.
364355 log .debugWarning ("Tried to walk up past the root. Objects probably dead." )
365356 return []
366- # This object had a control field.
367- field ["_endOfNode" ] = True
368- fields .append (textInfos .FieldCommand ("controlEnd" , None ))
357+ if field :
358+ # This object had a control field.
359+ field ["_endOfNode" ] = True
360+ fields .append (textInfos .FieldCommand ("controlEnd" , None ))
369361 ti = self ._getEmbedding (obj )
370362 if not ti :
371363 log .debugWarning (
@@ -385,11 +377,13 @@ def _getText(self, withFields, formatConfig=None):
385377 # Determine whether the range covers the end of any ancestors of endObj.
386378 obj = self ._endObj
387379 ti = self ._end
388- while obj and obj != rootObj and controlStack :
380+ while obj and obj != rootObj :
389381 field = controlStack .pop ()
390- fields .append (textInfos .FieldCommand ("controlEnd" , None ))
382+ if field :
383+ fields .append (textInfos .FieldCommand ("controlEnd" , None ))
391384 if ti .compareEndPoints (self ._makeRawTextInfo (obj , textInfos .POSITION_ALL ), "endToEnd" ) == 0 :
392- field ["_endOfNode" ] = True
385+ if field :
386+ field ["_endOfNode" ] = True
393387 else :
394388 # We're not at the end of this object, which also means we're not at the end of any ancestors.
395389 break
0 commit comments