Merge to XFA: Do hit tests against Annots in reverse order.
authorLei Zhang <thestig@chromium.org>
Sat, 28 Feb 2015 03:58:08 +0000 (19:58 -0800)
committerLei Zhang <thestig@chromium.org>
Sat, 28 Feb 2015 03:58:08 +0000 (19:58 -0800)
Original Review URL: https://codereview.chromium.org/952423002

(cherry picked from commit 944ccad72d028ed5e37f53c5c8c0888866905bc3)

Review URL: https://codereview.chromium.org/970523002

core/src/fpdfdoc/doc_link.cpp

index c27333e..964b84e 100644 (file)
@@ -56,7 +56,7 @@ CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLO
         return NULL;
     }
     int size = pPageLinkList->GetSize();
-    for (int i = 0; i < size; i ++) {
+    for (int i = size - 1; i >= 0; --i) {
         CPDF_Link Link = (CPDF_Dictionary*)pPageLinkList->GetAt(i);
         CPDF_Rect rect = Link.GetRect();
         if (rect.Contains(pdf_x, pdf_y)) {