diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 00:51:10 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 00:51:10 +0000 |
commit | 799edbdbd3aadc8044bccf4e10bf6a3ebfef1d6b (patch) | |
tree | 7003bbd2eddf2d5af5bd826279743eacb9b76030 /webkit/port | |
parent | b89e36066f99f22dca4c15724ba0b8331a946234 (diff) | |
download | chromium_src-799edbdbd3aadc8044bccf4e10bf6a3ebfef1d6b.zip chromium_src-799edbdbd3aadc8044bccf4e10bf6a3ebfef1d6b.tar.gz chromium_src-799edbdbd3aadc8044bccf4e10bf6a3ebfef1d6b.tar.bz2 |
Add ChromiumBridge::isLayoutTestMode() and change references to webkit::IsLayoutTest() to use that instead.
Review URL: http://codereview.chromium.org/10804
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
5 files changed, 38 insertions, 32 deletions
diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h index 9e1e575..4fe339d 100644 --- a/webkit/port/platform/chromium/ChromiumBridge.h +++ b/webkit/port/platform/chromium/ChromiumBridge.h @@ -67,6 +67,9 @@ namespace WebCore { // Language ----------------------------------------------------------- static String computedDefaultLanguage(); + // LayoutTestMode ----------------------------------------------------- + static bool layoutTestMode(); + // Screen ------------------------------------------------------------- static int screenDepth(Widget*); static int screenDepthPerComponent(Widget*); @@ -77,6 +80,7 @@ namespace WebCore { // Widget ------------------------------------------------------------- static void widgetSetCursor(Widget*, const Cursor&); static void widgetSetFocus(Widget*); + }; } diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp index e887d59..c19bcca 100644 --- a/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp +++ b/webkit/port/platform/chromium/ScrollbarThemeChromiumWin.cpp @@ -29,6 +29,7 @@ #include <windows.h> #include <vsstyle.h> +#include "ChromiumBridge.h" #include "GraphicsContext.h" #include "PlatformContextSkia.h" #include "PlatformMouseEvent.h" @@ -36,7 +37,6 @@ #include "base/gfx/native_theme.h" #include "base/win_util.h" -#include "webkit/glue/webkit_glue.h" namespace WebCore { @@ -78,7 +78,7 @@ int ScrollbarThemeChromiumWin::scrollbarThickness(ScrollbarControlSize controlSi { static int thickness; if (!thickness) { - if (webkit_glue::IsLayoutTestMode()) + if (ChromiumBridge::layoutTestMode()) return kMacScrollbarSize[controlSize]; thickness = GetSystemMetrics(SM_CXVSCROLL); } @@ -265,7 +265,7 @@ IntSize ScrollbarThemeChromiumWin::buttonSize(Scrollbar* scrollbar) const int kLayoutTestModeGirth = 17; int thickness = scrollbarThickness(); - int girth = webkit_glue::IsLayoutTestMode() ? kLayoutTestModeGirth : thickness; + int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness; if (scrollbar->orientation() == HorizontalScrollbar) { int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth; return IntSize(width, thickness); diff --git a/webkit/port/platform/graphics/FontCacheWin.cpp b/webkit/port/platform/graphics/FontCacheWin.cpp index c9c8238..b6938a8 100644 --- a/webkit/port/platform/graphics/FontCacheWin.cpp +++ b/webkit/port/platform/graphics/FontCacheWin.cpp @@ -27,6 +27,7 @@ */ #include "config.h" +#include "ChromiumBridge.h" #include "FontCache.h" #include "Font.h" #include "HashSet.h" @@ -573,7 +574,7 @@ static LONG toGDIFontWeight(FontWeight fontWeight) // TODO in pending/FontCache.h. AtomicString FontCache::getGenericFontForScript(UScriptCode script, const FontDescription& description) { - if (webkit_glue::IsLayoutTestMode() && script == USCRIPT_LATIN) + if (ChromiumBridge::layoutTestMode() && script == USCRIPT_LATIN) return emptyAtom; FontDescription::GenericFamilyType generic = description.genericFamily(); const wchar_t* scriptFont = gfx::GetFontFamilyForScript( @@ -594,7 +595,7 @@ static void FillLogFont(const FontDescription& fontDescription, LOGFONT* winfont winfont->lfStrikeOut = false; winfont->lfCharSet = DEFAULT_CHARSET; winfont->lfOutPrecision = OUT_TT_ONLY_PRECIS; - winfont->lfQuality = webkit_glue::IsLayoutTestMode() ? NONANTIALIASED_QUALITY + winfont->lfQuality = ChromiumBridge::layoutTestMode() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings. winfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; winfont->lfItalic = fontDescription.italic(); diff --git a/webkit/port/platform/graphics/mac/FontCacheMacPending.cpp b/webkit/port/platform/graphics/mac/FontCacheMacPending.cpp index cdfe861..325b57d 100644 --- a/webkit/port/platform/graphics/mac/FontCacheMacPending.cpp +++ b/webkit/port/platform/graphics/mac/FontCacheMacPending.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "AtomicString.h" +#include "ChromiumBridge.h" #include "FontCache.h" #include "FontDescription.h" #include "webkit_glue.h" @@ -45,7 +46,7 @@ namespace WebCore { // TODO in pending/FontCache.h. AtomicString FontCache::getGenericFontForScript(UScriptCode script, const FontDescription& description) { - if (webkit_glue::IsLayoutTestMode()) + if (ChromiumBridge::layoutTestMode()) return emptyAtom; // TODO(pinkerton) -- flesh this out with some script handling code return emptyAtom; diff --git a/webkit/port/rendering/RenderThemeWin.cpp b/webkit/port/rendering/RenderThemeWin.cpp index 51e146a..74a477b 100644 --- a/webkit/port/rendering/RenderThemeWin.cpp +++ b/webkit/port/rendering/RenderThemeWin.cpp @@ -27,6 +27,7 @@ #include <uxtheme.h> #include <vssym32.h> +#include "ChromiumBridge.h" #include "CSSValueKeywords.h" #include "Document.h" #include "FontSelector.h" @@ -39,7 +40,6 @@ #include "base/gfx/font_utils.h" #include "base/gfx/skia_utils.h" #include "base/win_util.h" -#include "webkit/glue/webkit_glue.h" // These enums correspond to similarly named values defined by SafariTheme.h enum ControlSize { @@ -143,7 +143,7 @@ RenderThemeWin::~RenderThemeWin() Color RenderThemeWin::platformActiveSelectionBackgroundColor() const { - if (webkit_glue::IsLayoutTestMode()) + if (ChromiumBridge::layoutTestMode()) return Color("#0000FF"); // Royal blue COLORREF color = GetSysColor(COLOR_HIGHLIGHT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255); @@ -151,7 +151,7 @@ Color RenderThemeWin::platformActiveSelectionBackgroundColor() const Color RenderThemeWin::platformInactiveSelectionBackgroundColor() const { - if (webkit_glue::IsLayoutTestMode()) + if (ChromiumBridge::layoutTestMode()) return Color("#999999"); // Medium grey COLORREF color = GetSysColor(COLOR_GRAYTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255); @@ -159,7 +159,7 @@ Color RenderThemeWin::platformInactiveSelectionBackgroundColor() const Color RenderThemeWin::platformActiveSelectionForegroundColor() const { - if (webkit_glue::IsLayoutTestMode()) + if (ChromiumBridge::layoutTestMode()) return Color("#FFFFCC"); // Pale yellow COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255); @@ -281,7 +281,7 @@ double RenderThemeWin::caretBlinkFrequency() const { // Disable the blinking caret in layout test mode, as it introduces // a race condition for the pixel tests. http://b/1198440 - if (webkit_glue::IsLayoutTestMode()) + if (ChromiumBridge::layoutTestMode()) return 0; // TODO(ericroman): this should be using the platform's blink frequency. @@ -298,7 +298,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& case CSSValueSmallCaption: cachedDesc = &smallSystemFont; if (!smallSystemFont.isAbsoluteSize()) { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = systemFontSizeForControlSize(SmallControlSize); } else { NONCLIENTMETRICS metrics; @@ -311,7 +311,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& case CSSValueMenu: cachedDesc = &menuFont; if (!menuFont.isAbsoluteSize()) { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = systemFontSizeForControlSize(RegularControlSize); } else { NONCLIENTMETRICS metrics; @@ -324,7 +324,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& case CSSValueStatusBar: cachedDesc = &labelFont; if (!labelFont.isAbsoluteSize()) { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = kLayoutTestStatusBarFontSize; } else { NONCLIENTMETRICS metrics; @@ -335,7 +335,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& } break; case CSSValueWebkitMiniControl: - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = systemFontSizeForControlSize(MiniControlSize); } else { faceName = defaultGUIFont(document); @@ -345,7 +345,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& } break; case CSSValueWebkitSmallControl: - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = systemFontSizeForControlSize(SmallControlSize); } else { faceName = defaultGUIFont(document); @@ -353,7 +353,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& } break; case CSSValueWebkitControl: - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = systemFontSizeForControlSize(RegularControlSize); } else { faceName = defaultGUIFont(document); @@ -361,7 +361,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& } break; default: - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { fontSize = kLayoutTestSystemFontSize; } else { faceName = defaultGUIFont(document); @@ -373,7 +373,7 @@ void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& cachedDesc = &fontDescription; if (fontSize) { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { cachedDesc->firstFamily().setFamily("Lucida Grande"); } else { ASSERT(faceName); @@ -510,7 +510,7 @@ static void setSizeIfAuto(RenderStyle* style, const IntSize& size) int RenderThemeWin::minimumMenuListSize(RenderStyle* style) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { return kLayoutTestMenuListMinimumWidth[controlSizeForFont(style)]; } else { return 0; @@ -539,14 +539,14 @@ void RenderThemeWin::setCheckboxSize(RenderStyle* style) const // At different DPI settings on Windows, querying the theme gives you a larger size that accounts for // the higher DPI. Until our entire engine honors a DPI setting other than 96, we can't rely on the theme's // metrics. - const IntSize size = webkit_glue::IsLayoutTestMode() ? + const IntSize size = ChromiumBridge::layoutTestMode() ? layoutTestCheckboxSize(style) : IntSize(13, 13); setSizeIfAuto(style, size); } void RenderThemeWin::setRadioSize(RenderStyle* style) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { setSizeIfAuto(style, layoutTestRadioboxSize(style)); } else { // Use same sizing for radio box as checkbox. @@ -604,7 +604,7 @@ void RenderThemeWin::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle // Height is locked to auto on all browsers. style->setLineHeight(RenderStyle::initialLineHeight()); - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { style->resetBorder(); style->setHeight(Length(Auto)); // Select one of the 3 fixed heights for controls @@ -648,7 +648,7 @@ bool RenderThemeWin::paintMenuList(RenderObject* o, const RenderObject::PaintInf // If the MenuList is smaller than the size of a button, make sure to // shrink it appropriately and not put its x position to the left of // the menulist. - const int buttonWidth = webkit_glue::IsLayoutTestMode() ? + const int buttonWidth = ChromiumBridge::layoutTestMode() ? kLayoutTestMenuListButtonWidth : GetSystemMetrics(SM_CXVSCROLL); int spacingLeft = borderLeft + o->paddingLeft(); int spacingRight = borderRight + o->paddingRight(); @@ -735,7 +735,7 @@ static int layoutTestMenuListInternalPadding(RenderStyle* style, int paddingType int RenderThemeWin::menuListInternalPadding(RenderStyle* style, int paddingType) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { return layoutTestMenuListInternalPadding(style, paddingType); } @@ -766,7 +766,7 @@ void RenderThemeWin::adjustButtonInnerStyle(RenderStyle* style) const void RenderThemeWin::setButtonPadding(RenderStyle* style) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { setFixedPadding(style, kLayoutTestButtonPadding); } else if (!style->width().isAuto()) { @@ -798,7 +798,7 @@ void RenderThemeWin::setButtonPadding(RenderStyle* style) const void RenderThemeWin::adjustSliderThumbSize(RenderObject* o) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) { o->style()->setWidth(Length(kLayoutTestSliderThumbWidth, Fixed)); @@ -809,7 +809,7 @@ void RenderThemeWin::adjustSliderThumbSize(RenderObject* o) const void RenderThemeWin::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { // Override border. style->resetBorder(); style->setBorderLeftWidth(kLayoutTestSearchFieldBorderWidth); @@ -850,7 +850,7 @@ static const IntSize* layoutTestResultsButtonSizes() void RenderThemeWin::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { IntSize size = layoutTestCancelButtonSizes()[controlSizeForFont(style)]; style->setWidth(Length(size.width(), Fixed)); style->setHeight(Length(size.height(), Fixed)); @@ -860,7 +860,7 @@ void RenderThemeWin::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* select void RenderThemeWin::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { IntSize size = layoutTestResultsButtonSizes()[controlSizeForFont(style)]; style->setWidth(Length(size.width() - kLayoutTestEmptyResultsOffset, Fixed)); style->setHeight(Length(size.height(), Fixed)); @@ -870,7 +870,7 @@ void RenderThemeWin::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector void RenderThemeWin::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { IntSize size = layoutTestResultsButtonSizes()[controlSizeForFont(style)]; style->setWidth(Length(size.width(), Fixed)); style->setHeight(Length(size.height(), Fixed)); @@ -880,7 +880,7 @@ void RenderThemeWin::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* s void RenderThemeWin::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { - if (webkit_glue::IsLayoutTestMode()) { + if (ChromiumBridge::layoutTestMode()) { IntSize size = layoutTestResultsButtonSizes()[controlSizeForFont(style)]; style->setWidth(Length(size.width() + kLayoutTestResultsArrowWidth, Fixed)); style->setHeight(Length(size.height(), Fixed)); |