orca r4150 - in trunk: . src/orca src/orca/scripts/toolkits/Gecko
- From: joanied svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4150 - in trunk: . src/orca src/orca/scripts/toolkits/Gecko
- Date: Wed, 3 Sep 2008 23:27:21 +0000 (UTC)
Author: joanied
Date: Wed Sep 3 23:27:21 2008
New Revision: 4150
URL: http://svn.gnome.org/viewvc/orca?rev=4150&view=rev
Log:
* src/orca/scripts/toolkits/Gecko/script.py:
src/orca/braille.py:
Work on bug #541605 - updateBraille() can take an unreasonable
amount of time with certain pages in Firefox 3.
Modified:
trunk/ChangeLog
trunk/src/orca/braille.py
trunk/src/orca/scripts/toolkits/Gecko/script.py
Modified: trunk/src/orca/braille.py
==============================================================================
--- trunk/src/orca/braille.py (original)
+++ trunk/src/orca/braille.py Wed Sep 3 23:27:21 2008
@@ -577,7 +577,9 @@
n = 0
while n < nLinks:
link = hyperText.getLink(n)
- if self.lineOffset <= link.startIndex:
+ if link.startIndex > lineEndOffset:
+ break
+ elif self.lineOffset <= link.startIndex:
for i in xrange(link.startIndex, link.endIndex):
try:
regionMask[i] |= linkIndicator
Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py (original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py Wed Sep 3 23:27:21 2008
@@ -179,6 +179,12 @@
self.currentLineContents = None
self._nextLineContents = None
+ # For really large objects, a call to getAttributes can take up to
+ # two seconds! This is a Firefox bug. We'll try to improve things
+ # by storing attributes.
+ #
+ self._currentAttrs = {}
+
# Last focused frame. We are only interested in frame focused events
# when it is a different frame, so here we store the last frame
# that recieved state-changed:focused.
@@ -1921,6 +1927,7 @@
self._previousLineContents = None
self.currentLineContents = None
self._nextLineContents = None
+ self._currentAttrs = {}
def presentLine(self, obj, offset):
"""Presents the current line in speech and in braille.
@@ -4641,6 +4648,35 @@
return string, caretOffset, startOffset
+ def getTextAttributes(self, acc, offset, get_defaults=False):
+ """Get the text attributes run for a given offset in a given accessible
+
+ Arguments:
+ - acc: An accessible.
+ - offset: Offset in the accessible's text for which to retrieve the
+ attributes.
+ - get_defaults: Get the default attributes as well as the unique ones.
+ Default is True
+
+ Returns a dictionary of attributes, a start offset where the attributes
+ begin, and an end offset. Returns ({}, 0, 0) if the accessible does not
+ supprt the text attribute.
+ """
+
+ # For really large objects, a call to getAttributes can take up to
+ # two seconds! This is a Firefox bug. We'll try to improve things
+ # by storing attributes.
+ #
+ attrsForObj = self._currentAttrs.get(hash(acc)) or {}
+ if attrsForObj.has_key(offset):
+ return attrsForObj.get(offset)
+
+ attrs = \
+ default.Script.getTextAttributes(self, acc, offset, get_defaults)
+ self._currentAttrs[hash(acc)] = {offset:attrs}
+
+ return attrs
+
def getCaretContext(self, includeNonText=True):
"""Returns the current [obj, caretOffset] if defined. If not,
it returns the first [obj, caretOffset] found by an in order
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]