Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: fpdfsdk/javascript/Field.cpp

Issue 1841173002: Rename GetElementValue() to GetDirectObject{By,At}(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use "At" for arrays. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/Field.h" 7 #include "fpdfsdk/javascript/Field.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 if (vp.GetType() == CJS_Value::VT_number) { 951 if (vp.GetType() == CJS_Value::VT_number) {
952 int iSelecting = 0; 952 int iSelecting = 0;
953 vp >> iSelecting; 953 vp >> iSelecting;
954 array.push_back(iSelecting); 954 array.push_back(iSelecting);
955 } else if (vp.IsArrayObject()) { 955 } else if (vp.IsArrayObject()) {
956 CJS_Array SelArray(pRuntime); 956 CJS_Array SelArray(pRuntime);
957 CJS_Value SelValue(pRuntime); 957 CJS_Value SelValue(pRuntime);
958 int iSelecting; 958 int iSelecting;
959 vp >> SelArray; 959 vp >> SelArray;
960 for (int i = 0, sz = SelArray.GetLength(); i < sz; i++) { 960 for (int i = 0, sz = SelArray.GetLength(); i < sz; i++) {
961 SelArray.GetElement(i, SelValue); 961 SelArray.GetObjectBy(i, SelValue);
962 iSelecting = SelValue.ToInt(); 962 iSelecting = SelValue.ToInt();
963 array.push_back(iSelecting); 963 array.push_back(iSelecting);
964 } 964 }
965 } 965 }
966 966
967 if (m_bDelay) { 967 if (m_bDelay) {
968 AddDelay_WordArray(FP_CURRENTVALUEINDICES, array); 968 AddDelay_WordArray(FP_CURRENTVALUEINDICES, array);
969 } else { 969 } else {
970 Field::SetCurrentValueIndices(m_pDocument, m_FieldName, 970 Field::SetCurrentValueIndices(m_pDocument, m_FieldName,
971 m_nFormControlIndex, array); 971 m_nFormControlIndex, array);
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 CJS_Value Lower_Righty(pRuntime); 2076 CJS_Value Lower_Righty(pRuntime);
2077 2077
2078 if (vp.IsSetting()) { 2078 if (vp.IsSetting()) {
2079 if (!m_bCanSet) 2079 if (!m_bCanSet)
2080 return FALSE; 2080 return FALSE;
2081 if (!vp.IsArrayObject()) 2081 if (!vp.IsArrayObject())
2082 return FALSE; 2082 return FALSE;
2083 2083
2084 CJS_Array rcArray(pRuntime); 2084 CJS_Array rcArray(pRuntime);
2085 vp >> rcArray; 2085 vp >> rcArray;
2086 rcArray.GetElement(0, Upper_Leftx); 2086 rcArray.GetObjectBy(0, Upper_Leftx);
2087 rcArray.GetElement(1, Upper_Lefty); 2087 rcArray.GetObjectBy(1, Upper_Lefty);
2088 rcArray.GetElement(2, Lower_Rightx); 2088 rcArray.GetObjectBy(2, Lower_Rightx);
2089 rcArray.GetElement(3, Lower_Righty); 2089 rcArray.GetObjectBy(3, Lower_Righty);
2090 2090
2091 FX_FLOAT pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f}; 2091 FX_FLOAT pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f};
2092 pArray[0] = (FX_FLOAT)Upper_Leftx.ToInt(); 2092 pArray[0] = (FX_FLOAT)Upper_Leftx.ToInt();
2093 pArray[1] = (FX_FLOAT)Lower_Righty.ToInt(); 2093 pArray[1] = (FX_FLOAT)Lower_Righty.ToInt();
2094 pArray[2] = (FX_FLOAT)Lower_Rightx.ToInt(); 2094 pArray[2] = (FX_FLOAT)Lower_Rightx.ToInt();
2095 pArray[3] = (FX_FLOAT)Upper_Lefty.ToInt(); 2095 pArray[3] = (FX_FLOAT)Upper_Lefty.ToInt();
2096 2096
2097 CFX_FloatRect crRect(pArray); 2097 CFX_FloatRect crRect(pArray);
2098 if (m_bDelay) { 2098 if (m_bDelay) {
2099 AddDelay_Rect(FP_RECT, crRect); 2099 AddDelay_Rect(FP_RECT, crRect);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 if (vp.IsSetting()) { 2707 if (vp.IsSetting()) {
2708 if (!m_bCanSet) 2708 if (!m_bCanSet)
2709 return FALSE; 2709 return FALSE;
2710 2710
2711 std::vector<CFX_WideString> strArray; 2711 std::vector<CFX_WideString> strArray;
2712 if (vp.IsArrayObject()) { 2712 if (vp.IsArrayObject()) {
2713 CJS_Array ValueArray(pRuntime); 2713 CJS_Array ValueArray(pRuntime);
2714 vp.ConvertToArray(ValueArray); 2714 vp.ConvertToArray(ValueArray);
2715 for (int i = 0, sz = ValueArray.GetLength(); i < sz; i++) { 2715 for (int i = 0, sz = ValueArray.GetLength(); i < sz; i++) {
2716 CJS_Value ElementValue(pRuntime); 2716 CJS_Value ElementValue(pRuntime);
2717 ValueArray.GetElement(i, ElementValue); 2717 ValueArray.GetObjectBy(i, ElementValue);
2718 strArray.push_back(ElementValue.ToCFXWideString()); 2718 strArray.push_back(ElementValue.ToCFXWideString());
2719 } 2719 }
2720 } else { 2720 } else {
2721 CFX_WideString swValue; 2721 CFX_WideString swValue;
2722 vp >> swValue; 2722 vp >> swValue;
2723 strArray.push_back(swValue); 2723 strArray.push_back(swValue);
2724 } 2724 }
2725 2725
2726 if (m_bDelay) { 2726 if (m_bDelay) {
2727 AddDelay_WideStringArray(FP_VALUE, strArray); 2727 AddDelay_WideStringArray(FP_VALUE, strArray);
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 } 3552 }
3553 } 3553 }
3554 3554
3555 void Field::AddField(CPDFSDK_Document* pDocument, 3555 void Field::AddField(CPDFSDK_Document* pDocument,
3556 int nPageIndex, 3556 int nPageIndex,
3557 int nFieldType, 3557 int nFieldType,
3558 const CFX_WideString& sName, 3558 const CFX_WideString& sName,
3559 const CFX_FloatRect& rcCoords) { 3559 const CFX_FloatRect& rcCoords) {
3560 // Not supported. 3560 // Not supported.
3561 } 3561 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698