Do hit tests against Annots in reverse order.
authorLei Zhang <thestig@chromium.org>
Sat, 28 Feb 2015 00:29:50 +0000 (16:29 -0800)
committerLei Zhang <thestig@chromium.org>
Sat, 28 Feb 2015 00:29:50 +0000 (16:29 -0800)
BUG=chromium:445408
R=jun_fang@foxitsoftware.com

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

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)) {