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

Side by Side Diff: xfa/fde/cfde_txtedtengine.cpp

Issue 2459073002: Continue fixing FX_BOOL / int noise (Closed)
Patch Set: Created 4 years, 1 month 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/fde/cfde_txtedtengine.h" 7 #include "xfa/fde/cfde_txtedtengine.h"
8 8
9 #include "xfa/fde/cfde_txtedtbuf.h" 9 #include "xfa/fde/cfde_txtedtbuf.h"
10 #include "xfa/fde/cfde_txtedtbufiter.h" 10 #include "xfa/fde/cfde_txtedtbufiter.h"
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 return nCaret; 1332 return nCaret;
1333 } 1333 }
1334 1334
1335 FX_BOOL CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { 1335 FX_BOOL CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) {
1336 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); 1336 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
1337 const CFX_RectF& rtContent = pPage->GetContentsBox(); 1337 const CFX_RectF& rtContent = pPage->GetContentsBox();
1338 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { 1338 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
1339 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 - m_Param.fLineSpace; 1339 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 - m_Param.fLineSpace;
1340 ptCaret.y = m_fCaretPosReserve; 1340 ptCaret.y = m_fCaretPosReserve;
1341 FX_BOOL bLineReserve = 1341 FX_BOOL bLineReserve =
1342 m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve; 1342 !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve);
1343 if (ptCaret.x < rtContent.left) { 1343 if (ptCaret.x < rtContent.left) {
1344 if (bLineReserve) { 1344 if (bLineReserve) {
1345 if (m_nCaretPage == CountPages() - 1) { 1345 if (m_nCaretPage == CountPages() - 1) {
1346 return FALSE; 1346 return FALSE;
1347 } 1347 }
1348 } else { 1348 } else {
1349 if (m_nCaretPage == 0) { 1349 if (m_nCaretPage == 0) {
1350 return FALSE; 1350 return FALSE;
1351 } 1351 }
1352 } 1352 }
(...skipping 23 matching lines...) Expand all
1376 } 1376 }
1377 1377
1378 FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { 1378 FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) {
1379 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); 1379 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
1380 const CFX_RectF& rtContent = pPage->GetContentsBox(); 1380 const CFX_RectF& rtContent = pPage->GetContentsBox();
1381 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { 1381 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
1382 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace; 1382 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace;
1383 ptCaret.y = m_fCaretPosReserve; 1383 ptCaret.y = m_fCaretPosReserve;
1384 if (ptCaret.x >= rtContent.right()) { 1384 if (ptCaret.x >= rtContent.right()) {
1385 FX_BOOL bLineReserve = 1385 FX_BOOL bLineReserve =
1386 m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve; 1386 !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve);
1387 if (bLineReserve) { 1387 if (bLineReserve) {
1388 if (m_nCaretPage == 0) { 1388 if (m_nCaretPage == 0) {
1389 return FALSE; 1389 return FALSE;
1390 } 1390 }
1391 } else { 1391 } else {
1392 if (m_nCaretPage == CountPages() - 1) { 1392 if (m_nCaretPage == CountPages() - 1) {
1393 return FALSE; 1393 return FALSE;
1394 } 1394 }
1395 } 1395 }
1396 if (bLineReserve) { 1396 if (bLineReserve) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 : m_rtCaret.left; 1559 : m_rtCaret.left;
1560 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0); 1560 m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0);
1561 } 1561 }
1562 1562
1563 void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret, 1563 void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret,
1564 int32_t nPageIndex, 1564 int32_t nPageIndex,
1565 int32_t nCaret, 1565 int32_t nCaret,
1566 FX_BOOL bBefore) { 1566 FX_BOOL bBefore) {
1567 IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; 1567 IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage];
1568 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); 1568 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0);
1569 FX_BOOL bCombText = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText; 1569 FX_BOOL bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText);
1570 int32_t nIndexInpage = nCaret - pPage->GetCharStart(); 1570 int32_t nIndexInpage = nCaret - pPage->GetCharStart();
1571 if (bBefore && bCombText && nIndexInpage > 0) { 1571 if (bBefore && bCombText && nIndexInpage > 0) {
1572 nIndexInpage--; 1572 nIndexInpage--;
1573 bBefore = FALSE; 1573 bBefore = FALSE;
1574 } 1574 }
1575 int32_t nBIDILevel = pPage->GetCharRect(nIndexInpage, rtCaret, bCombText); 1575 int32_t nBIDILevel = pPage->GetCharRect(nIndexInpage, rtCaret, bCombText);
1576 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { 1576 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) {
1577 if ((!FX_IsOdd(nBIDILevel) && !bBefore) || 1577 if ((!FX_IsOdd(nBIDILevel) && !bBefore) ||
1578 (FX_IsOdd(nBIDILevel) && bBefore)) { 1578 (FX_IsOdd(nBIDILevel) && bBefore)) {
1579 rtCaret.Offset(0, rtCaret.height - 1.0f); 1579 rtCaret.Offset(0, rtCaret.height - 1.0f);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 m_SelRangePtrArr.RemoveAt(nCountRange); 1622 m_SelRangePtrArr.RemoveAt(nCountRange);
1623 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE); 1623 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE);
1624 } 1624 }
1625 ClearSelection(); 1625 ClearSelection();
1626 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); 1626 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo);
1627 m_Param.pEventSink->On_SelChanged(this); 1627 m_Param.pEventSink->On_SelChanged(this);
1628 SetCaretPos(nSelStart, TRUE); 1628 SetCaretPos(nSelStart, TRUE);
1629 return; 1629 return;
1630 } 1630 }
1631 } 1631 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698