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

Side by Side Diff: xfa/fwl/basewidget/fwl_editimp.cpp

Issue 1989203007: Work around sign compare error from commit be9b894. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fwl/basewidget/fwl_editimp.h" 7 #include "xfa/fwl/basewidget/fwl_editimp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "third_party/base/stl_util.h"
13 #include "xfa/fde/cfde_txtedtengine.h" 14 #include "xfa/fde/cfde_txtedtengine.h"
14 #include "xfa/fde/fde_gedevice.h" 15 #include "xfa/fde/fde_gedevice.h"
15 #include "xfa/fde/fde_render.h" 16 #include "xfa/fde/fde_render.h"
16 #include "xfa/fde/ifde_txtedtpage.h" 17 #include "xfa/fde/ifde_txtedtpage.h"
17 #include "xfa/fwl/basewidget/fwl_caretimp.h" 18 #include "xfa/fwl/basewidget/fwl_caretimp.h"
18 #include "xfa/fwl/basewidget/fwl_comboboximp.h" 19 #include "xfa/fwl/basewidget/fwl_comboboximp.h"
19 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" 20 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
20 #include "xfa/fwl/basewidget/ifwl_caret.h" 21 #include "xfa/fwl/basewidget/ifwl_caret.h"
21 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" 22 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
22 #include "xfa/fwl/core/cfwl_message.h" 23 #include "xfa/fwl/core/cfwl_message.h"
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 if (!CanRedo()) 773 if (!CanRedo())
773 return FALSE; 774 return FALSE;
774 return Redo(m_DoRecords[++m_iCurRecord].get()); 775 return Redo(m_DoRecords[++m_iCurRecord].get());
775 } 776 }
776 777
777 FX_BOOL CFWL_EditImp::CanUndo() { 778 FX_BOOL CFWL_EditImp::CanUndo() {
778 return m_iCurRecord >= 0; 779 return m_iCurRecord >= 0;
779 } 780 }
780 781
781 FX_BOOL CFWL_EditImp::CanRedo() { 782 FX_BOOL CFWL_EditImp::CanRedo() {
782 return m_iCurRecord < m_DoRecords.size() - 1; 783 return m_iCurRecord < pdfium::CollectionSize<int32_t>(m_DoRecords) - 1;
783 } 784 }
784 785
785 FWL_Error CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { 786 FWL_Error CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
786 if (!m_pEdtEngine) 787 if (!m_pEdtEngine)
787 return FWL_Error::Indefinite; 788 return FWL_Error::Indefinite;
788 789
789 FDE_TXTEDTPARAMS* pParams = m_pEdtEngine->GetEditParams(); 790 FDE_TXTEDTPARAMS* pParams = m_pEdtEngine->GetEditParams();
790 pParams->fTabWidth = fTabWidth; 791 pParams->fTabWidth = fTabWidth;
791 pParams->bTabEquidistant = bEquidistant; 792 pParams->bTabEquidistant = bEquidistant;
792 return FWL_Error::Succeeded; 793 return FWL_Error::Succeeded;
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } 1456 }
1456 FX_BOOL CFWL_EditImp::IsContentHeightOverflow() { 1457 FX_BOOL CFWL_EditImp::IsContentHeightOverflow() {
1457 if (!m_pEdtEngine) 1458 if (!m_pEdtEngine)
1458 return FALSE; 1459 return FALSE;
1459 IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0); 1460 IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
1460 if (!pPage) 1461 if (!pPage)
1461 return FALSE; 1462 return FALSE;
1462 return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f; 1463 return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f;
1463 } 1464 }
1464 int32_t CFWL_EditImp::AddDoRecord(IFDE_TxtEdtDoRecord* pRecord) { 1465 int32_t CFWL_EditImp::AddDoRecord(IFDE_TxtEdtDoRecord* pRecord) {
1465 int32_t nCount = m_DoRecords.size(); 1466 int32_t nCount = pdfium::CollectionSize<int32_t>(m_DoRecords);
1466 if (m_iCurRecord == nCount - 1) { 1467 if (m_iCurRecord == nCount - 1) {
1467 if (nCount == m_iMaxRecord) { 1468 if (nCount == m_iMaxRecord) {
1468 m_DoRecords.pop_front(); 1469 m_DoRecords.pop_front();
1469 m_iCurRecord--; 1470 m_iCurRecord--;
1470 } 1471 }
1471 } else { 1472 } else {
1472 m_DoRecords.erase(m_DoRecords.begin() + m_iCurRecord + 1, 1473 m_DoRecords.erase(m_DoRecords.begin() + m_iCurRecord + 1,
1473 m_DoRecords.end()); 1474 m_DoRecords.end());
1474 } 1475 }
1475 1476
1476 m_DoRecords.push_back(std::unique_ptr<IFDE_TxtEdtDoRecord>(pRecord)); 1477 m_DoRecords.push_back(std::unique_ptr<IFDE_TxtEdtDoRecord>(pRecord));
1477 m_iCurRecord = m_DoRecords.size() - 1; 1478 m_iCurRecord = pdfium::CollectionSize<int32_t>(m_DoRecords) - 1;
1478 return m_iCurRecord; 1479 return m_iCurRecord;
1479 } 1480 }
1480 void CFWL_EditImp::Layout() { 1481 void CFWL_EditImp::Layout() {
1481 GetClientRect(m_rtClient); 1482 GetClientRect(m_rtClient);
1482 m_rtEngine = m_rtClient; 1483 m_rtEngine = m_rtClient;
1483 FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( 1484 FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
1484 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 1485 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
1485 if (!pfWidth) 1486 if (!pfWidth)
1486 return; 1487 return;
1487 FX_FLOAT fWidth = *pfWidth; 1488 FX_FLOAT fWidth = *pfWidth;
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 } 2187 }
2187 CFX_RectF rect; 2188 CFX_RectF rect;
2188 m_pOwner->GetWidgetRect(rect); 2189 m_pOwner->GetWidgetRect(rect);
2189 CFX_RectF rtInvalidate; 2190 CFX_RectF rtInvalidate;
2190 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); 2191 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
2191 m_pOwner->Repaint(&rtInvalidate); 2192 m_pOwner->Repaint(&rtInvalidate);
2192 } 2193 }
2193 return TRUE; 2194 return TRUE;
2194 } 2195 }
2195 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} 2196 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698