summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-05-10 20:26:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-10 20:26:35 +0000
commit5ad45e2f68bb796c562302e9fc2d963c279334c7 (patch)
tree946625dbb27ee8db4eb633832594a8f88d467c71 /fxjs
parent660843f9ea0e75b4efc78d17bbc5661c2d3ea2be (diff)
downloadpdfium-5ad45e2f68bb796c562302e9fc2d963c279334c7.tar.xz
Cleanup formcalc method generationchromium/3427
This CL simplifies the FormCalc method call generation when converted to JavaScript. Currently we output the same chunk of code to run the given method on an array or object per method call. This CL pulls out the common execution code to a pfm_method_runner function which is used instead. An embedder test has been added to verify that method invocation from formcalc works correctly. Bug: chromium:814848 Change-Id: I1ec052eab051053fedcb464d57e0e15228b8c5a2 Reviewed-on: https://pdfium-review.googlesource.com/32372 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_formcalc_context_embeddertest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/fxjs/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/cfxjse_formcalc_context_embeddertest.cpp
index d48d5cc445..a7efc14d20 100644
--- a/fxjs/cfxjse_formcalc_context_embeddertest.cpp
+++ b/fxjs/cfxjse_formcalc_context_embeddertest.cpp
@@ -1444,3 +1444,14 @@ TEST_F(CFXJSE_FormCalcContextEmbedderTest, InvalidFunctions) {
EXPECT_FALSE(ExecuteSilenceFailure(tests[i]));
}
}
+
+TEST_F(CFXJSE_FormCalcContextEmbedderTest, MethodCall) {
+ ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
+
+ const char test[] = {"$form.form1.TextField11.getAttribute(\"h\")"};
+ EXPECT_TRUE(Execute(test));
+
+ CFXJSE_Value* value = GetValue();
+ EXPECT_TRUE(value->IsString());
+ EXPECT_STREQ("12.7mm", value->ToString().c_str());
+}