summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_annot.cpp
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-08-29 17:15:08 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-29 17:15:08 -0700
commit35512aa7e4acc3ceb9c6aef5d61eebfb4ae802af (patch)
tree18ad1447ba8a7d06f304e1418616d919eadbbf8c /core/fpdfdoc/cpdf_annot.cpp
parent07f5fd57682700bcbba20f01d52a806676fd02ff (diff)
downloadpdfium-35512aa7e4acc3ceb9c6aef5d61eebfb4ae802af.tar.xz
Display content of the annotation when mouse hover.
Each annotation has its contents, and users should be able to see the contents. In this patch, PDFium creates a Popup annotation for each annotation and stores the author and the content. When a user mouse hover on the annotation, PDFium draws the corresponding Popup annotation and displays the content. Also, roll DEPS for testing/corpus to 5867fa6. BUG=62625 Review-Url: https://codereview.chromium.org/2273893002
Diffstat (limited to 'core/fpdfdoc/cpdf_annot.cpp')
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 10360eaf68..e79acab7a0 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -21,7 +21,9 @@
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument)
: m_pAnnotDict(pDict),
m_pDocument(pDocument),
- m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")) {
+ m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")),
+ m_bOpenState(false),
+ m_pPopupAnnot(nullptr) {
GenerateAPIfNeeded();
}
@@ -36,6 +38,8 @@ void CPDF_Annot::GenerateAPIfNeeded() {
CPVT_GenerateAP::GenerateHighlightAP(m_pDocument, m_pAnnotDict);
else if (m_sSubtype == "Ink")
CPVT_GenerateAP::GenerateInkAP(m_pDocument, m_pAnnotDict);
+ else if (m_sSubtype == "Popup")
+ CPVT_GenerateAP::GeneratePopupAP(m_pDocument, m_pAnnotDict);
else if (m_sSubtype == "Square")
CPVT_GenerateAP::GenerateSquareAP(m_pDocument, m_pAnnotDict);
else if (m_sSubtype == "Squiggly")
@@ -152,6 +156,9 @@ FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
if (IsAnnotationHidden(m_pAnnotDict))
return FALSE;
+ if (m_sSubtype == "Popup" && !m_bOpenState)
+ return FALSE;
+
// It might happen that by the time this annotation instance was created,
// it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided
// to not "generate" its AP.