From 84b6888d629ad6c025e192ec81f34e130b4bd0ca Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 6 Aug 2014 17:19:25 +1200 Subject: [PATCH] Bug 1048752. Part 8: Remove mCaretAspectRatio. r=tn mCaretAspectRatio doesn't need to be stored. We can recompute it whenever we need it. --HG-- extra : rebase_source : 065a6996e920800edf5cbcc7f072f0439ef84553 --- layout/base/nsCaret.cpp | 8 ++------ layout/base/nsCaret.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 39dec45a9b03..a5c9c3bd3702 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -139,11 +139,6 @@ nsresult nsCaret::Init(nsIPresShell *inPresShell) mPresShell = do_GetWeakReference(inPresShell); // the presshell owns us, so no addref NS_ASSERTION(mPresShell, "Hey, pres shell should support weak refs"); - // XXX we should just do this LookAndFeel consultation every time - // we need these values. - mCaretAspectRatio = - LookAndFeel::GetFloat(LookAndFeel::eFloatID_CaretAspectRatio, 0.0f); - mBlinkRate = static_cast( LookAndFeel::GetInt(LookAndFeel::eIntID_CaretBlinkTime, mBlinkRate)); mShowDuringSelection = @@ -195,7 +190,8 @@ DrawCJKCaret(nsIFrame* aFrame, int32_t aOffset) nsCaret::Metrics nsCaret::ComputeMetrics(nsIFrame* aFrame, int32_t aOffset, nscoord aCaretHeight) { // Compute nominal sizes in appunits - nscoord caretWidth = (aCaretHeight * mCaretAspectRatio) + + nscoord caretWidth = + (aCaretHeight * LookAndFeel::GetFloat(LookAndFeel::eFloatID_CaretAspectRatio, 0.0f)) + nsPresContext::CSSPixelsToAppUnits( LookAndFeel::GetInt(LookAndFeel::eIntID_CaretWidth, 1)); diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h index 5cd397bf2684..759c9fc81dd4 100644 --- a/layout/base/nsCaret.h +++ b/layout/base/nsCaret.h @@ -202,7 +202,6 @@ protected: // XXX these fields should go away and the values be acquired as needed, // probably by ComputeMetrics. uint32_t mBlinkRate; // time for one cyle (on then off), in milliseconds - float mCaretAspectRatio; // caret width/height aspect ratio bool mVisible; // is the caret blinking