| OLD | NEW |
| 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 "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 case XFA_LAYOUTMODEL_W: | 110 case XFA_LAYOUTMODEL_W: |
| 111 measure.Set(rtRect.width, XFA_UNIT_Pt); | 111 measure.Set(rtRect.width, XFA_UNIT_Pt); |
| 112 break; | 112 break; |
| 113 case XFA_LAYOUTMODEL_X: | 113 case XFA_LAYOUTMODEL_X: |
| 114 measure.Set(rtRect.left, XFA_UNIT_Pt); | 114 measure.Set(rtRect.left, XFA_UNIT_Pt); |
| 115 break; | 115 break; |
| 116 case XFA_LAYOUTMODEL_Y: | 116 case XFA_LAYOUTMODEL_Y: |
| 117 measure.Set(rtRect.top, XFA_UNIT_Pt); | 117 measure.Set(rtRect.top, XFA_UNIT_Pt); |
| 118 break; | 118 break; |
| 119 } | 119 } |
| 120 XFA_UNIT unit = measure.GetUnit(wsUnit); | 120 XFA_UNIT unit = measure.GetUnit(wsUnit.AsWideStringC()); |
| 121 FX_FLOAT fValue = measure.ToUnit(unit); | 121 FX_FLOAT fValue = measure.ToUnit(unit); |
| 122 fValue = FXSYS_round(fValue * 1000) / 1000.0f; | 122 fValue = FXSYS_round(fValue * 1000) / 1000.0f; |
| 123 if (hValue) { | 123 if (hValue) { |
| 124 FXJSE_Value_SetFloat(hValue, fValue); | 124 FXJSE_Value_SetFloat(hValue, fValue); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( | 127 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( |
| 128 CFXJSE_Arguments* pArguments) { | 128 CFXJSE_Arguments* pArguments) { |
| 129 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); | 129 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); |
| 130 } | 130 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 549 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
| 550 if (!pLayoutItem) { | 550 if (!pLayoutItem) { |
| 551 FXJSE_Value_SetInteger(hValue, -1); | 551 FXJSE_Value_SetInteger(hValue, -1); |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 554 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
| 555 if (hValue) { | 555 if (hValue) { |
| 556 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); | 556 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); |
| 557 } | 557 } |
| 558 } | 558 } |
| OLD | NEW |