[orca] Use intersection() rather than the now-redundant clip()



commit 62388d8152cb829d185bea7043a63a015fb66257
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Aug 31 11:27:35 2016 -0400

    Use intersection() rather than the now-redundant clip()

 src/orca/flat_review.py |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/src/orca/flat_review.py b/src/orca/flat_review.py
index eb991c6..d141e41 100644
--- a/src/orca/flat_review.py
+++ b/src/orca/flat_review.py
@@ -566,23 +566,6 @@ class Context:
         #
         self.targetCharInfo = None
 
-    def clip(self,
-             ax, ay, awidth, aheight,
-             bx, by, bwidth, bheight):
-        """Clips region 'a' by region 'b' and returns the new region as
-        a list: [x, y, width, height].
-        """
-
-        x = max(ax, bx)
-        x2 = min(ax + awidth, bx + bwidth)
-        width = x2 - x
-
-        y = max(ay, by)
-        y2 = min(ay + aheight, by + bheight)
-        height = y2 - y
-
-        return [x, y, width, height]
-
     def splitTextIntoZones(self, accessible, string, startOffset, cliprect):
         """Traverses the string, splitting it up into separate zones if the
         string contains the EMBEDDED_OBJECT_CHARACTER, which is used by apps
@@ -628,7 +611,8 @@ class Context:
                     substringStartOffset, substringEndOffset, 0)
                 if self.script.utilities.containsRegion(extents, cliprect):
                     anyVisible = True
-                    clipping = self.clip(*extents, *cliprect)
+                    clipping = self.script.utilities.intersection(extents, cliprect)
+
 
                     # [[[TODO: WDW - HACK it would be nice to clip the
                     # the text by what is really showing on the screen,
@@ -895,7 +879,7 @@ class Context:
         else:
             zones = self.getZonesFromText(accessible, cliprect)
 
-        clipping = self.clip(*extents, *cliprect)
+        clipping = self.script.utilities.intersection(extents, cliprect)
         if not zones and role in [pyatspi.ROLE_SCROLL_BAR,
                                   pyatspi.ROLE_SLIDER,
                                   pyatspi.ROLE_PROGRESS_BAR]:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]