Bug 669028 part.13 layout should use mozilla::LookAndFeel rather than nsILookAndFeel r=roc

This commit is contained in:
Masayuki Nakano 2011-09-09 11:27:13 +09:00
parent 2bc2cb55f3
commit 6c3d3da0c3
12 changed files with 136 additions and 190 deletions

View File

@ -58,7 +58,6 @@
#include "nsIPresShell.h"
#include "nsRenderingContext.h"
#include "nsPresContext.h"
#include "nsILookAndFeel.h"
#include "nsBlockFrame.h"
#include "nsISelectionController.h"
#include "nsDisplayList.h"
@ -69,6 +68,7 @@
#include "nsTextFragment.h"
#include "nsThemeConstants.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
// The bidi indicator hangs off the caret to one side, to show which
// direction the typing is in. It needs to be at least 2x2 to avoid looking like
@ -181,27 +181,18 @@ 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");
// get nsILookAndFeel from the pres context, which has one cached.
nsILookAndFeel *lookAndFeel = nsnull;
nsPresContext *presContext = inPresShell->GetPresContext();
// XXX we should just do this nsILookAndFeel consultation every time
// XXX we should just do this LookAndFeel consultation every time
// we need these values.
mCaretWidthCSSPx = 1;
mCaretAspectRatio = 0;
if (presContext && (lookAndFeel = presContext->LookAndFeel())) {
PRInt32 tempInt;
float tempFloat;
if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetric_CaretWidth, tempInt)))
mCaretWidthCSSPx = (nscoord)tempInt;
if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetricFloat_CaretAspectRatio, tempFloat)))
mCaretAspectRatio = tempFloat;
if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetric_CaretBlinkTime, tempInt)))
mBlinkRate = (PRUint32)tempInt;
if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ShowCaretDuringSelection, tempInt)))
mShowDuringSelection = tempInt ? PR_TRUE : PR_FALSE;
}
mCaretWidthCSSPx = LookAndFeel::GetInt(LookAndFeel::eIntID_CaretWidth, 1);
mCaretAspectRatio =
LookAndFeel::GetFloat(LookAndFeel::eFloatID_CaretAspectRatio, 0.0f);
mBlinkRate = static_cast<PRUint32>(
LookAndFeel::GetInt(LookAndFeel::eIntID_CaretBlinkTime, mBlinkRate));
mShowDuringSelection =
LookAndFeel::GetInt(LookAndFeel::eIntID_ShowCaretDuringSelection,
mShowDuringSelection ? 1 : 0) != 0;
// get the selection from the pres shell, and set ourselves up as a selection
// listener
@ -552,10 +543,10 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
if (GetHookRect().IsEmpty() && presContext) {
nsITheme *theme = presContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(presContext, aForFrame, NS_THEME_TEXTFIELD_CARET)) {
nsILookAndFeel* lookAndFeel = presContext->LookAndFeel();
nscolor fieldText;
if (NS_SUCCEEDED(lookAndFeel->GetColor(nsILookAndFeel::eColor__moz_fieldtext, fieldText)) &&
fieldText == foregroundColor) {
nsresult rv = LookAndFeel::GetColor(LookAndFeel::eColorID__moz_fieldtext,
&fieldText);
if (NS_SUCCEEDED(rv) && fieldText == foregroundColor) {
theme->DrawWidgetBackground(aCtx, aForFrame, NS_THEME_TEXTFIELD_CARET,
drawCaretRect, drawCaretRect);
return;

View File

@ -55,8 +55,7 @@
#include "nsIURL.h"
#include "nsIDocument.h"
#include "nsStyleContext.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
#include "mozilla/LookAndFeel.h"
#include "nsIComponentManager.h"
#include "nsIURIContentListener.h"
#include "nsIInterfaceRequestor.h"
@ -180,7 +179,6 @@ destroy_loads(const void * aKey, nsRefPtr<nsImageLoader>& aData, void* closure)
return PL_DHASH_NEXT;
}
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
#include "nsContentCID.h"
// NOTE! nsPresContext::operator new() zeroes out all members, so don't
@ -329,7 +327,6 @@ nsPresContext::~nsPresContext()
this);
NS_IF_RELEASE(mDeviceContext);
NS_IF_RELEASE(mLookAndFeel);
NS_IF_RELEASE(mLanguage);
}
@ -359,7 +356,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsPresContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument);
// NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDeviceContext); // not xpcom
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mEventManager, nsIObserver);
// NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mLookAndFeel); // a service
// NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mLanguage); // an atom
for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i)
@ -382,7 +378,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsPresContext)
NS_RELEASE(tmp->mEventManager);
}
// NS_RELEASE(tmp->mLookAndFeel); // a service
// NS_RELEASE(tmp->mLanguage); // an atom
// NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTheme); // a service
@ -594,7 +589,8 @@ nsPresContext::GetDocumentColorPreferences()
usePrefColors = PR_FALSE;
}
else {
mLookAndFeel->GetMetric(nsILookAndFeel::eMetric_UseAccessibilityTheme, useAccessibilityTheme);
useAccessibilityTheme =
LookAndFeel::GetInt(LookAndFeel::eIntID_UseAccessibilityTheme, 0);
usePrefColors = !useAccessibilityTheme;
}
@ -619,12 +615,12 @@ nsPresContext::GetDocumentColorPreferences()
}
}
else {
mDefaultColor = NS_RGB(0x00, 0x00, 0x00);
mBackgroundColor = NS_RGB(0xFF, 0xFF, 0xFF);
mLookAndFeel->GetColor(nsILookAndFeel::eColor_WindowForeground,
mDefaultColor);
mLookAndFeel->GetColor(nsILookAndFeel::eColor_WindowBackground,
mBackgroundColor);
mDefaultColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WindowForeground,
NS_RGB(0x00, 0x00, 0x00));
mBackgroundColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground,
NS_RGB(0xFF, 0xFF, 0xFF));
}
// Wherever we got the default background color from, ensure it is
@ -894,14 +890,6 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i)
if (!mImageLoaders[i].Init())
return NS_ERROR_OUT_OF_MEMORY;
// Get the look and feel service here; default colors will be initialized
// from calling GetUserPreferences() when we get a presshell.
nsresult rv = CallGetService(kLookAndFeelCID, &mLookAndFeel);
if (NS_FAILED(rv)) {
NS_ERROR("LookAndFeel service must be implemented for this toolkit");
return rv;
}
mEventManager = new nsEventStateManager();
NS_ADDREF(mEventManager);
@ -989,7 +977,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
"layout.css.devPixelsPerPx",
this);
rv = mEventManager->Init();
nsresult rv = mEventManager->Init();
NS_ENSURE_SUCCESS(rv, rv);
mEventManager->SetPresContext(this);
@ -1547,9 +1535,9 @@ nsPresContext::ThemeChangedInternal()
sThemeChanged = PR_FALSE;
}
// Clear all cached nsILookAndFeel colors.
if (mLookAndFeel && sLookAndFeelChanged) {
mLookAndFeel->LookAndFeelChanged();
// Clear all cached LookAndFeel colors.
if (sLookAndFeelChanged) {
LookAndFeel::Refresh();
sLookAndFeelChanged = PR_FALSE;
}
@ -1584,9 +1572,9 @@ nsPresContext::SysColorChangedInternal()
{
mPendingSysColorChanged = PR_FALSE;
if (mLookAndFeel && sLookAndFeelChanged) {
if (sLookAndFeelChanged) {
// Don't use the cached values for the system colors
mLookAndFeel->LookAndFeelChanged();
LookAndFeel::Refresh();
sLookAndFeelChanged = PR_FALSE;
}

View File

@ -91,7 +91,6 @@ class nsStyleContext;
class nsIAtom;
class nsEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;
class nsIAtom;
struct nsStyleBackground;
@ -298,12 +297,6 @@ public:
{ SetImageAnimationModeExternal(aMode); }
#endif
/**
* Get cached look and feel service. This is faster than obtaining it
* through the service manager.
*/
nsILookAndFeel* LookAndFeel() { return mLookAndFeel; }
/**
* Get medium of presentation
*/
@ -1050,7 +1043,6 @@ protected:
// since there is no dependency
// from gfx back to layout.
nsEventStateManager* mEventManager; // [STRONG]
nsILookAndFeel* mLookAndFeel; // [STRONG]
nsRefPtr<nsRefreshDriver> mRefreshDriver;
nsRefPtr<nsTransitionManager> mTransitionManager;
nsRefPtr<nsAnimationManager> mAnimationManager;

View File

@ -39,7 +39,9 @@
#include "nsGkAtoms.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsEventStateManager.h"
#include "nsILookAndFeel.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
//#define FCF_NOISY
@ -187,10 +189,8 @@ nsFormControlFrame::GetUsableScreenRect(nsPresContext* aPresContext)
nsRect screen;
nsDeviceContext *context = aPresContext->DeviceContext();
PRInt32 dropdownCanOverlapOSBar = PR_FALSE;
nsILookAndFeel *lookAndFeel = aPresContext->LookAndFeel();
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar,
dropdownCanOverlapOSBar);
PRInt32 dropdownCanOverlapOSBar =
LookAndFeel::GetInt(LookAndFeel::eIntID_MenusCanOverlapOSBar, 0);
if ( dropdownCanOverlapOSBar )
context->GetRect(screen);
else

View File

@ -67,7 +67,6 @@
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsILookAndFeel.h"
#include "nsFontMetrics.h"
#include "nsIScrollableFrame.h"
#include "nsIDOMNSEvent.h"
@ -85,6 +84,9 @@
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsContentUtils.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
// Constants
const nscoord kMaxDropDownRows = 20; // This matches the setting for 4.x browsers
@ -336,11 +338,10 @@ void nsListControlFrame::PaintFocus(nsRenderingContext& aRC, nsPoint aPt)
}
// set up back stop colors and then ask L&F service for the real colors
nscolor color;
presContext->LookAndFeel()->
GetColor(lastItemIsSelected ?
nsILookAndFeel::eColor_WidgetSelectForeground :
nsILookAndFeel::eColor_WidgetSelectBackground, color);
nscolor color =
LookAndFeel::GetColor(lastItemIsSelected ?
LookAndFeel::eColorID_WidgetSelectForeground :
LookAndFeel::eColorID_WidgetSelectBackground);
nsCSSRendering::PaintFocus(presContext, aRC, fRect, color);
}

View File

@ -104,9 +104,7 @@
#include "nsIServiceManager.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsILookAndFeel.h"
#include "nsLayoutCID.h"
#include "nsWidgetsCID.h" // for NS_LOOKANDFEEL_CID
#include "nsUnicharUtils.h"
#include "nsLayoutErrors.h"
#include "nsContentErrors.h"
@ -124,12 +122,11 @@
#include "CSSCalc.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
using namespace mozilla::layers;
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
// Struct containing cached metrics for box-wrapped frames.
struct nsBoxLayoutMetrics
{
@ -1061,22 +1058,17 @@ private:
void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
nscolor color = NS_RGB(255, 255, 255);
nsILookAndFeel::nsColorID colorID;
LookAndFeel::ColorID colorID;
nsresult result;
if (mSelectionValue == nsISelectionController::SELECTION_ON) {
colorID = nsILookAndFeel::eColor_TextSelectBackground;
colorID = LookAndFeel::eColorID_TextSelectBackground;
} else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
colorID = nsILookAndFeel::eColor_TextSelectBackgroundAttention;
colorID = LookAndFeel::eColorID_TextSelectBackgroundAttention;
} else {
colorID = nsILookAndFeel::eColor_TextSelectBackgroundDisabled;
colorID = LookAndFeel::eColorID_TextSelectBackgroundDisabled;
}
nsCOMPtr<nsILookAndFeel> look;
look = do_GetService(kLookAndFeelCID, &result);
if (NS_SUCCEEDED(result) && look)
look->GetColor(colorID, color);
nscolor color = LookAndFeel::GetColor(colorID, NS_RGB(255, 255, 255));
gfxRGBA c(color);
c.a = .5;

View File

@ -57,8 +57,6 @@
#include "nsStyleConsts.h"
#include "nsStyleContext.h"
#include "nsHTMLParts.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
#include "nsIComponentManager.h"
#include "nsGUIEvent.h"
#include "nsRenderingContext.h"
@ -74,6 +72,7 @@
#include "mozAutoDocUpdate.h"
#include "mozilla/Preferences.h"
#include "nsHTMLFrameSetElement.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
@ -85,8 +84,6 @@ using namespace mozilla;
#define ALL_VIS 0x000F
#define NONE_VIS 0x0000
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
/*******************************************************************************
* nsFramesetDrag
******************************************************************************/
@ -1685,24 +1682,23 @@ void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContex
nsPoint aPt)
{
nscolor WHITE = NS_RGB(255, 255, 255);
nscolor bgColor = NS_RGB(200,200,200);
nscolor fgColor = NS_RGB(0,0,0);
nscolor hltColor = NS_RGB(255,255,255);
nscolor sdwColor = NS_RGB(128,128,128);
nscolor bgColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetBackground,
NS_RGB(200,200,200));
nscolor fgColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetForeground,
NS_RGB(0,0,0));
nscolor hltColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DHighlight,
NS_RGB(255,255,255));
nscolor sdwColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DShadow,
NS_RGB(128,128,128));
nsRenderingContext::AutoPushTranslation
translate(&aRenderingContext, aPt);
{
nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);
if (lookAndFeel) {
lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetBackground, bgColor);
lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetForeground, fgColor);
lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DShadow, sdwColor);
lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DHighlight, hltColor);
}
}
nscoord widthInPixels = nsPresContext::AppUnitsToIntCSSPixels(mWidth);
nscoord pixelWidth = nsPresContext::CSSPixelsToAppUnits(1);

View File

@ -78,7 +78,7 @@
#include "nsBidiUtils.h"
#include "nsFrameManager.h"
#include "mozilla/Preferences.h"
#include "nsILookAndFeel.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/dom/Element.h"
#include "FrameLayerBuilder.h"
#include "nsSMILKeySpline.h"
@ -1462,11 +1462,8 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsContainerFrame* aOuter,
, mShouldBuildLayer(PR_FALSE)
{
// lookup if we're allowed to overlap the content from the look&feel object
PRInt32 canOverlap;
nsPresContext* presContext = mOuter->PresContext();
presContext->LookAndFeel()->
GetMetric(nsILookAndFeel::eMetric_ScrollbarsCanOverlapContent, canOverlap);
mScrollbarsCanOverlapContent = canOverlap;
mScrollbarsCanOverlapContent =
LookAndFeel::GetInt(LookAndFeel::eIntID_ScrollbarsCanOverlapContent) != 0;
mScrollingActive = IsAlwaysActive();
}

View File

@ -90,7 +90,6 @@
#include "nsFrameSelection.h"
#include "nsISelection.h"
#include "nsIDOMRange.h"
#include "nsILookAndFeel.h"
#include "nsCSSRendering.h"
#include "nsContentUtils.h"
#include "nsLineBreaker.h"
@ -115,6 +114,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/Util.h" // for DebugOnly
#include "mozilla/LookAndFeel.h"
#ifdef NS_DEBUG
#undef NOISY_BLINK
@ -3270,12 +3270,10 @@ nsTextPaintStyle::GetHighlightColors(nscolor* aForeColor,
NS_ASSERTION(aForeColor, "aForeColor is null");
NS_ASSERTION(aBackColor, "aBackColor is null");
nsILookAndFeel* look = mPresContext->LookAndFeel();
nscolor foreColor, backColor;
look->GetColor(nsILookAndFeel::eColor_TextHighlightBackground,
backColor);
look->GetColor(nsILookAndFeel::eColor_TextHighlightForeground,
foreColor);
nscolor backColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightBackground);
nscolor foreColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightForeground);
EnsureSufficientContrast(&foreColor, &backColor);
*aForeColor = foreColor;
*aBackColor = backColor;
@ -3357,14 +3355,12 @@ nsTextPaintStyle::InitCommonColors()
NS_ASSERTION(NS_GET_A(defaultBgColor) == 255,
"default background color is not opaque");
nsILookAndFeel* look = mPresContext->LookAndFeel();
nscolor defaultWindowBackgroundColor, selectionTextColor, selectionBGColor;
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground,
selectionBGColor);
look->GetColor(nsILookAndFeel::eColor_TextSelectForeground,
selectionTextColor);
look->GetColor(nsILookAndFeel::eColor_WindowBackground,
defaultWindowBackgroundColor);
nscolor defaultWindowBackgroundColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground);
nscolor selectionTextColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground);
nscolor selectionBGColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
mSufficientContrast =
NS_MIN(NS_MIN(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE,
@ -3428,28 +3424,26 @@ nsTextPaintStyle::InitSelectionColors()
}
}
nsILookAndFeel* look = mPresContext->LookAndFeel();
nscolor selectionBGColor;
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground,
selectionBGColor);
nscolor selectionBGColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
if (selectionStatus == nsISelectionController::SELECTION_ATTENTION) {
look->GetColor(nsILookAndFeel::eColor_TextSelectBackgroundAttention,
mSelectionBGColor);
mSelectionBGColor =
LookAndFeel::GetColor(
LookAndFeel::eColorID_TextSelectBackgroundAttention);
mSelectionBGColor = EnsureDifferentColors(mSelectionBGColor,
selectionBGColor);
} else if (selectionStatus != nsISelectionController::SELECTION_ON) {
look->GetColor(nsILookAndFeel::eColor_TextSelectBackgroundDisabled,
mSelectionBGColor);
mSelectionBGColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackgroundDisabled);
mSelectionBGColor = EnsureDifferentColors(mSelectionBGColor,
selectionBGColor);
} else {
mSelectionBGColor = selectionBGColor;
}
look->GetColor(nsILookAndFeel::eColor_TextSelectForeground,
mSelectionTextColor);
mSelectionTextColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground);
// On MacOS X, we don't exchange text color and BG color.
if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
@ -3469,36 +3463,36 @@ nsTextPaintStyle::GetSelectionStyle(PRInt32 aIndex)
}
struct StyleIDs {
nsILookAndFeel::nsColorID mForeground, mBackground, mLine;
nsILookAndFeel::nsMetricID mLineStyle;
nsILookAndFeel::nsMetricFloatID mLineRelativeSize;
LookAndFeel::ColorID mForeground, mBackground, mLine;
LookAndFeel::IntID mLineStyle;
LookAndFeel::FloatID mLineRelativeSize;
};
static StyleIDs SelectionStyleIDs[] = {
{ nsILookAndFeel::eColor_IMERawInputForeground,
nsILookAndFeel::eColor_IMERawInputBackground,
nsILookAndFeel::eColor_IMERawInputUnderline,
nsILookAndFeel::eMetric_IMERawInputUnderlineStyle,
nsILookAndFeel::eMetricFloat_IMEUnderlineRelativeSize },
{ nsILookAndFeel::eColor_IMESelectedRawTextForeground,
nsILookAndFeel::eColor_IMESelectedRawTextBackground,
nsILookAndFeel::eColor_IMESelectedRawTextUnderline,
nsILookAndFeel::eMetric_IMESelectedRawTextUnderlineStyle,
nsILookAndFeel::eMetricFloat_IMEUnderlineRelativeSize },
{ nsILookAndFeel::eColor_IMEConvertedTextForeground,
nsILookAndFeel::eColor_IMEConvertedTextBackground,
nsILookAndFeel::eColor_IMEConvertedTextUnderline,
nsILookAndFeel::eMetric_IMEConvertedTextUnderlineStyle,
nsILookAndFeel::eMetricFloat_IMEUnderlineRelativeSize },
{ nsILookAndFeel::eColor_IMESelectedConvertedTextForeground,
nsILookAndFeel::eColor_IMESelectedConvertedTextBackground,
nsILookAndFeel::eColor_IMESelectedConvertedTextUnderline,
nsILookAndFeel::eMetric_IMESelectedConvertedTextUnderline,
nsILookAndFeel::eMetricFloat_IMEUnderlineRelativeSize },
{ nsILookAndFeel::eColor_LAST_COLOR,
nsILookAndFeel::eColor_LAST_COLOR,
nsILookAndFeel::eColor_SpellCheckerUnderline,
nsILookAndFeel::eMetric_SpellCheckerUnderlineStyle,
nsILookAndFeel::eMetricFloat_SpellCheckerUnderlineRelativeSize }
{ LookAndFeel::eColorID_IMERawInputForeground,
LookAndFeel::eColorID_IMERawInputBackground,
LookAndFeel::eColorID_IMERawInputUnderline,
LookAndFeel::eIntID_IMERawInputUnderlineStyle,
LookAndFeel::eFloatID_IMEUnderlineRelativeSize },
{ LookAndFeel::eColorID_IMESelectedRawTextForeground,
LookAndFeel::eColorID_IMESelectedRawTextBackground,
LookAndFeel::eColorID_IMESelectedRawTextUnderline,
LookAndFeel::eIntID_IMESelectedRawTextUnderlineStyle,
LookAndFeel::eFloatID_IMEUnderlineRelativeSize },
{ LookAndFeel::eColorID_IMEConvertedTextForeground,
LookAndFeel::eColorID_IMEConvertedTextBackground,
LookAndFeel::eColorID_IMEConvertedTextUnderline,
LookAndFeel::eIntID_IMEConvertedTextUnderlineStyle,
LookAndFeel::eFloatID_IMEUnderlineRelativeSize },
{ LookAndFeel::eColorID_IMESelectedConvertedTextForeground,
LookAndFeel::eColorID_IMESelectedConvertedTextBackground,
LookAndFeel::eColorID_IMESelectedConvertedTextUnderline,
LookAndFeel::eIntID_IMESelectedConvertedTextUnderline,
LookAndFeel::eFloatID_IMEUnderlineRelativeSize },
{ LookAndFeel::eColorID_LAST_COLOR,
LookAndFeel::eColorID_LAST_COLOR,
LookAndFeel::eColorID_SpellCheckerUnderline,
LookAndFeel::eIntID_SpellCheckerUnderlineStyle,
LookAndFeel::eFloatID_SpellCheckerUnderlineRelativeSize }
};
void
@ -3511,17 +3505,16 @@ nsTextPaintStyle::InitSelectionStyle(PRInt32 aIndex)
StyleIDs* styleIDs = &SelectionStyleIDs[aIndex];
nsILookAndFeel* look = mPresContext->LookAndFeel();
nscolor foreColor, backColor;
if (styleIDs->mForeground == nsILookAndFeel::eColor_LAST_COLOR) {
if (styleIDs->mForeground == LookAndFeel::eColorID_LAST_COLOR) {
foreColor = NS_SAME_AS_FOREGROUND_COLOR;
} else {
look->GetColor(styleIDs->mForeground, foreColor);
foreColor = LookAndFeel::GetColor(styleIDs->mForeground);
}
if (styleIDs->mBackground == nsILookAndFeel::eColor_LAST_COLOR) {
if (styleIDs->mBackground == LookAndFeel::eColorID_LAST_COLOR) {
backColor = NS_TRANSPARENT;
} else {
look->GetColor(styleIDs->mBackground, backColor);
backColor = LookAndFeel::GetColor(styleIDs->mBackground);
}
// Convert special color to actual color
@ -3564,20 +3557,15 @@ nsTextPaintStyle::GetSelectionUnderline(nsPresContext* aPresContext,
NS_ASSERTION(aStyle, "aStyle is null");
NS_ASSERTION(aIndex >= 0 && aIndex < 5, "Index out of range");
nsILookAndFeel* look = aPresContext->LookAndFeel();
StyleIDs& styleID = SelectionStyleIDs[aIndex];
nscolor color;
float size;
PRInt32 style;
look->GetColor(styleID.mLine, color);
look->GetMetric(styleID.mLineStyle, style);
nscolor color = LookAndFeel::GetColor(styleID.mLine);
PRInt32 style = LookAndFeel::GetInt(styleID.mLineStyle);
if (style > NS_STYLE_TEXT_DECORATION_STYLE_MAX) {
NS_ERROR("Invalid underline style value is specified");
style = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
}
look->GetMetric(styleID.mLineRelativeSize, size);
float size = LookAndFeel::GetFloat(styleID.mLineRelativeSize);
NS_ASSERTION(size, "selection underline relative size must be larger than 0");

View File

@ -58,7 +58,7 @@
#include "nsIObserver.h"
#include "nsNetUtil.h"
#include "nsILookAndFeel.h"
#include "mozilla/LookAndFeel.h"
#include "nsCSSRendering.h"
#include "prprf.h" // For PR_snprintf()
@ -1852,9 +1852,9 @@ void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
// get color to use for selection from the look&feel object
nscolor bgColor = NS_RGB(0, 0, 0);
mFrame->PresContext()->LookAndFeel()->
GetColor(nsILookAndFeel::eColor_TextSelectBackground, bgColor);
nscolor bgColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground,
NS_RGB(0, 0, 0));
aCtx->SetColor(bgColor);
aCtx->FillRect(mRect + ToReferenceFrame());
}
@ -2056,8 +2056,8 @@ nsMathMLChar::PaintForeground(nsPresContext* aPresContext,
nscolor fgColor = styleContext->GetStyleColor()->mColor;
if (aIsSelected) {
// get color to use for selection from the look&feel object
aPresContext->LookAndFeel()->
GetColor(nsILookAndFeel::eColor_TextSelectForeground, fgColor);
fgColor = LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
fgColor);
}
aRenderingContext.SetColor(fgColor);

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsSVGTextFrame.h"
#include "nsILookAndFeel.h"
#include "mozilla/LookAndFeel.h"
#include "nsTextFragment.h"
#include "nsBidiPresUtils.h"
#include "nsSVGUtils.h"
@ -1007,11 +1007,11 @@ nsSVGGlyphFrame::GetHighlight(PRUint32 *charnum, PRUint32 *nchars,
*charnum=CompressIndex(details->mStart, fragment);
*nchars=CompressIndex(details->mEnd, fragment)-*charnum;
nsILookAndFeel *look = presContext->LookAndFeel();
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, *background);
look->GetColor(nsILookAndFeel::eColor_TextSelectForeground, *foreground);
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground,
background);
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
foreground);
SelectionDetails *dp = details;
while ((dp=details->mNext) != nsnull) {

View File

@ -65,7 +65,9 @@
//TABLECELL SELECTION
#include "nsFrameSelection.h"
#include "nsILookAndFeel.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
nsTableCellFrame::nsTableCellFrame(nsStyleContext* aContext) :
@ -328,9 +330,8 @@ nsTableCellFrame::DecorateForSelection(nsRenderingContext& aRenderingContext,
bordercolor = NS_RGB(176,176,176);// disabled color
}
else {
presContext->LookAndFeel()->
GetColor(nsILookAndFeel::eColor_TextSelectBackground,
bordercolor);
bordercolor =
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
}
nscoord threePx = nsPresContext::CSSPixelsToAppUnits(3);
if ((mRect.width > threePx) && (mRect.height > threePx))