orca r4413 - in branches/gnome-2-24: . src/orca
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4413 - in branches/gnome-2-24: . src/orca
- Date: Thu, 8 Jan 2009 17:31:58 +0000 (UTC)
Author: wwalker
Date: Thu Jan 8 17:31:58 2009
New Revision: 4413
URL: http://svn.gnome.org/viewvc/orca?rev=4413&view=rev
Log:
Fix for bug #563171 - src/orca/flat_review.py:getZonesFromText should clip zones based on what text is visible
Modified:
branches/gnome-2-24/ChangeLog
branches/gnome-2-24/src/orca/flat_review.py
Modified: branches/gnome-2-24/src/orca/flat_review.py
==============================================================================
--- branches/gnome-2-24/src/orca/flat_review.py (original)
+++ branches/gnome-2-24/src/orca/flat_review.py Thu Jan 8 17:31:58 2009
@@ -859,10 +859,45 @@
else:
zones = []
- length = text.characterCount
-
offset = 0
lastEndOffset = -1
+ upperMax = lowerMax = text.characterCount
+ upperMid = lowerMid = upperMax /2
+ upperMin = lowerMin = 0
+ upperY = lowerY = 0
+ oldMid = 0
+
+ # performing binary search to locate first line inside clipped area
+ while oldMid != upperMid:
+ oldMid = upperMid
+ [x, y, width, height] = text.getRangeExtents(upperMid,
+ upperMid+1,
+ 0)
+ upperY = y
+ if y > cliprect.y:
+ upperMax = upperMid
+ else:
+ upperMin = upperMid
+ upperMid = (upperMax - upperMin) /2 + upperMin
+
+ # performing binary search to locate last line inside clipped area
+ oldMid = 0
+ limit = cliprect.y+cliprect.height
+ while oldMid != lowerMid:
+ oldMid = lowerMid
+ [x, y, width, height] = text.getRangeExtents(lowerMid,
+ lowerMid+1,
+ 0)
+ lowerY = y
+ if y > limit:
+ lowerMax = lowerMid
+ else:
+ lowerMin = lowerMid
+ lowerMid = (lowerMax - lowerMin) /2 + lowerMin
+
+ # finding out the zones
+ offset = upperMin
+ length = lowerMax
while offset < length:
[string, startOffset, endOffset] = text.getTextAtOffset(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]