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

Side by Side Diff: xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp

Issue 2082573007: Update GetClassID to GetElementType (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@remove_script_obj_hash
Patch Set: Created 4 years, 6 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 "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" 7 #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 if (wsType == FX_WSTRC(L"pageArea")) { 217 if (wsType == FX_WSTRC(L"pageArea")) {
218 if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) { 218 if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) {
219 retArray.Add(pMasterPage); 219 retArray.Add(pMasterPage);
220 } 220 }
221 return; 221 return;
222 } 222 }
223 if (wsType == FX_WSTRC(L"contentArea")) { 223 if (wsType == FX_WSTRC(L"contentArea")) {
224 for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem; 224 for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem;
225 pItem = pItem->m_pNextSibling) { 225 pItem = pItem->m_pNextSibling) {
226 if (pItem->m_pFormNode->GetClassID() == XFA_Element::ContentArea) { 226 if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) {
227 retArray.Add(pItem->m_pFormNode); 227 retArray.Add(pItem->m_pFormNode);
228 } 228 }
229 } 229 }
230 return; 230 return;
231 } 231 }
232 std::set<CXFA_Node*> formItems; 232 std::set<CXFA_Node*> formItems;
233 if (wsType.IsEmpty()) { 233 if (wsType.IsEmpty()) {
234 if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) { 234 if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) {
235 retArray.Add(pMasterPage); 235 retArray.Add(pMasterPage);
236 } 236 }
237 for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem; 237 for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem;
238 pItem = pItem->m_pNextSibling) { 238 pItem = pItem->m_pNextSibling) {
239 if (pItem->m_pFormNode->GetClassID() == XFA_Element::ContentArea) { 239 if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) {
240 retArray.Add(pItem->m_pFormNode); 240 retArray.Add(pItem->m_pFormNode);
241 if (!bOnPageArea) { 241 if (!bOnPageArea) {
242 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, 242 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem,
243 CXFA_TraverseStrategy_ContentLayoutItem> 243 CXFA_TraverseStrategy_ContentLayoutItem>
244 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild)); 244 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild));
245 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); 245 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent();
246 pItemChild; pItemChild = iterator.MoveToNext()) { 246 pItemChild; pItemChild = iterator.MoveToNext()) {
247 if (!pItemChild->IsContentLayoutItem()) { 247 if (!pItemChild->IsContentLayoutItem()) {
248 continue; 248 continue;
249 } 249 }
250 XFA_Element eElementType = pItemChild->m_pFormNode->GetClassID(); 250 XFA_Element eElementType =
251 pItemChild->m_pFormNode->GetElementType();
251 if (eElementType != XFA_Element::Field && 252 if (eElementType != XFA_Element::Field &&
252 eElementType != XFA_Element::Draw && 253 eElementType != XFA_Element::Draw &&
253 eElementType != XFA_Element::Subform && 254 eElementType != XFA_Element::Subform &&
254 eElementType != XFA_Element::Area) { 255 eElementType != XFA_Element::Area) {
255 continue; 256 continue;
256 } 257 }
257 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) 258 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
258 continue; 259 continue;
259 260
260 formItems.insert(pItemChild->m_pFormNode); 261 formItems.insert(pItemChild->m_pFormNode);
261 retArray.Add(pItemChild->m_pFormNode); 262 retArray.Add(pItemChild->m_pFormNode);
262 } 263 }
263 } 264 }
264 } else { 265 } else {
265 if (bOnPageArea) { 266 if (bOnPageArea) {
266 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, 267 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem,
267 CXFA_TraverseStrategy_ContentLayoutItem> 268 CXFA_TraverseStrategy_ContentLayoutItem>
268 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem)); 269 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem));
269 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); 270 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent();
270 pItemChild; pItemChild = iterator.MoveToNext()) { 271 pItemChild; pItemChild = iterator.MoveToNext()) {
271 if (!pItemChild->IsContentLayoutItem()) { 272 if (!pItemChild->IsContentLayoutItem()) {
272 continue; 273 continue;
273 } 274 }
274 XFA_Element eElementType = pItemChild->m_pFormNode->GetClassID(); 275 XFA_Element eElementType =
276 pItemChild->m_pFormNode->GetElementType();
275 if (eElementType != XFA_Element::Field && 277 if (eElementType != XFA_Element::Field &&
276 eElementType != XFA_Element::Draw && 278 eElementType != XFA_Element::Draw &&
277 eElementType != XFA_Element::Subform && 279 eElementType != XFA_Element::Subform &&
278 eElementType != XFA_Element::Area) { 280 eElementType != XFA_Element::Area) {
279 continue; 281 continue;
280 } 282 }
281 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) 283 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
282 continue; 284 continue;
283 formItems.insert(pItemChild->m_pFormNode); 285 formItems.insert(pItemChild->m_pFormNode);
284 retArray.Add(pItemChild->m_pFormNode); 286 retArray.Add(pItemChild->m_pFormNode);
285 } 287 }
286 } 288 }
287 } 289 }
288 } 290 }
289 return; 291 return;
290 } 292 }
291 XFA_Element eType = XFA_Element::Unknown; 293 XFA_Element eType = XFA_Element::Unknown;
292 if (wsType == FX_WSTRC(L"field")) { 294 if (wsType == FX_WSTRC(L"field")) {
293 eType = XFA_Element::Field; 295 eType = XFA_Element::Field;
294 } else if (wsType == FX_WSTRC(L"draw")) { 296 } else if (wsType == FX_WSTRC(L"draw")) {
295 eType = XFA_Element::Draw; 297 eType = XFA_Element::Draw;
296 } else if (wsType == FX_WSTRC(L"subform")) { 298 } else if (wsType == FX_WSTRC(L"subform")) {
297 eType = XFA_Element::Subform; 299 eType = XFA_Element::Subform;
298 } else if (wsType == FX_WSTRC(L"area")) { 300 } else if (wsType == FX_WSTRC(L"area")) {
299 eType = XFA_Element::Area; 301 eType = XFA_Element::Area;
300 } 302 }
301 if (eType != XFA_Element::Unknown) { 303 if (eType != XFA_Element::Unknown) {
302 for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem; 304 for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem;
303 pItem = pItem->m_pNextSibling) { 305 pItem = pItem->m_pNextSibling) {
304 if (pItem->m_pFormNode->GetClassID() == XFA_Element::ContentArea) { 306 if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) {
305 if (!bOnPageArea) { 307 if (!bOnPageArea) {
306 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, 308 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem,
307 CXFA_TraverseStrategy_ContentLayoutItem> 309 CXFA_TraverseStrategy_ContentLayoutItem>
308 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild)); 310 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild));
309 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); 311 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent();
310 pItemChild; pItemChild = iterator.MoveToNext()) { 312 pItemChild; pItemChild = iterator.MoveToNext()) {
311 if (!pItemChild->IsContentLayoutItem()) 313 if (!pItemChild->IsContentLayoutItem())
312 continue; 314 continue;
313 if (pItemChild->m_pFormNode->GetClassID() != eType) 315 if (pItemChild->m_pFormNode->GetElementType() != eType)
314 continue; 316 continue;
315 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) 317 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
316 continue; 318 continue;
317 formItems.insert(pItemChild->m_pFormNode); 319 formItems.insert(pItemChild->m_pFormNode);
318 retArray.Add(pItemChild->m_pFormNode); 320 retArray.Add(pItemChild->m_pFormNode);
319 } 321 }
320 } 322 }
321 } else { 323 } else {
322 if (bOnPageArea) { 324 if (bOnPageArea) {
323 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, 325 CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem,
324 CXFA_TraverseStrategy_ContentLayoutItem> 326 CXFA_TraverseStrategy_ContentLayoutItem>
325 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem)); 327 iterator(static_cast<CXFA_ContentLayoutItem*>(pItem));
326 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); 328 for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent();
327 pItemChild; pItemChild = iterator.MoveToNext()) { 329 pItemChild; pItemChild = iterator.MoveToNext()) {
328 if (!pItemChild->IsContentLayoutItem()) 330 if (!pItemChild->IsContentLayoutItem())
329 continue; 331 continue;
330 if (pItemChild->m_pFormNode->GetClassID() != eType) 332 if (pItemChild->m_pFormNode->GetElementType() != eType)
331 continue; 333 continue;
332 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) 334 if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
333 continue; 335 continue;
334 formItems.insert(pItemChild->m_pFormNode); 336 formItems.insert(pItemChild->m_pFormNode);
335 retArray.Add(pItemChild->m_pFormNode); 337 retArray.Add(pItemChild->m_pFormNode);
336 } 338 }
337 } 339 }
338 } 340 }
339 } 341 }
340 return; 342 return;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 531 }
530 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); 532 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
531 if (!pLayoutItem) { 533 if (!pLayoutItem) {
532 pValue->SetInteger(-1); 534 pValue->SetInteger(-1);
533 return; 535 return;
534 } 536 }
535 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); 537 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex();
536 if (pValue) 538 if (pValue)
537 pValue->SetInteger(bAbsPage ? iPage : iPage + 1); 539 pValue->SetInteger(bAbsPage ? iPage : iPage + 1);
538 } 540 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698