diff options
author | tsepez <tsepez@chromium.org> | 2016-09-13 16:08:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-13 16:08:49 -0700 |
commit | 63f545c485c063831ecb58fb492f96fe5f462fd1 (patch) | |
tree | 8c57386bc84f7173b780a7e8bf79a19ec7c3231e /fpdfsdk/pdfwindow/PWL_Edit.cpp | |
parent | f86ca3884886506c999a3b521078151e7cda0bf9 (diff) | |
download | pdfium-63f545c485c063831ecb58fb492f96fe5f462fd1.tar.xz |
CFX_FloatPoint default constructor and equals operatorschromium/2860
Review-Url: https://codereview.chromium.org/2341453002
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_Edit.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index c85993b9cb..4b115d345b 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -241,16 +241,14 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << sLine; CFX_ByteTextBuf sText; - - CFX_FloatPoint ptOffset = CFX_FloatPoint(0.0f, 0.0f); - + CFX_FloatPoint ptOffset = CFX_FloatPoint(); CPVT_WordRange wrWhole = m_pEdit->GetWholeWordRange(); CPVT_WordRange wrSelect = GetSelectWordRange(); CPVT_WordRange wrVisible = - (HasFlag(PES_TEXTOVERFLOW) ? wrWhole : m_pEdit->GetVisibleWordRange()); + HasFlag(PES_TEXTOVERFLOW) ? wrWhole : m_pEdit->GetVisibleWordRange(); + CPVT_WordRange wrSelBefore(wrWhole.BeginPos, wrSelect.BeginPos); CPVT_WordRange wrSelAfter(wrSelect.EndPos, wrWhole.EndPos); - CPVT_WordRange wrTemp = CPWL_Utils::OverlapWordRange(GetSelectWordRange(), wrVisible); CFX_ByteString sEditSel = @@ -385,17 +383,17 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_FloatRect rcClip; CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); CPVT_WordRange* pRange = nullptr; - if (!HasFlag(PES_TEXTOVERFLOW)) { rcClip = GetClientRect(); pRange = &wrRange; } + CFX_SystemHandler* pSysHandler = GetSystemHandler(); CFX_Edit::DrawEdit( pDevice, pUser2Device, m_pEdit.get(), CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, m_pFormFiller); + rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); } FX_BOOL CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { @@ -445,20 +443,17 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { void CPWL_Edit::OnSetFocus() { SetEditCaret(TRUE); - if (!IsReadOnly()) { if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) pFocusHandler->OnSetFocus(this); } - m_bFocus = TRUE; } void CPWL_Edit::OnKillFocus() { ShowVScrollBar(FALSE); - m_pEdit->SelectNone(); - SetCaret(FALSE, CFX_FloatPoint(0.0f, 0.0f), CFX_FloatPoint(0.0f, 0.0f)); + SetCaret(FALSE, CFX_FloatPoint(), CFX_FloatPoint()); SetCharSet(FXFONT_ANSI_CHARSET); m_bFocus = FALSE; } @@ -510,19 +505,17 @@ CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( const CPVT_WordPlace& wpWord) { - CFX_FloatPoint pt(0.0f, 0.0f); - CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); + + CFX_FloatPoint pt; CPVT_Word word; if (pIterator->GetWord(word)) { pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent); } - pIterator->SetAt(wpOld); - return pt; } |