--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (14,0) size 756x369 [border: (1px solid #000000)]
+ RenderBlock {DIV} at (3,3) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 64x12
+ RenderText {#text} at (0,0) size 64x12
+ text run at (0,0) width 64: "ActiveBorder"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#4B89D0]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,16) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 69x12
+ RenderText {#text} at (0,0) size 69x12
+ text run at (0,0) width 69: "ActiveCaption"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,29) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 73x12
+ RenderText {#text} at (0,0) size 73x12
+ text run at (0,0) width 73: "AppWorkspace"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#AAAAAA]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,42) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 58x12
+ RenderText {#text} at (0,0) size 58x12
+ text run at (0,0) width 58: "Background"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#6363CE]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,55) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 56x12
+ RenderText {#text} at (0,0) size 56x12
+ text run at (0,0) width 56: "ButtonFace"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#C0C0C0]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,68) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 78x12
+ RenderText {#text} at (0,0) size 78x12
+ text run at (0,0) width 78: "ButtonHighlight"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#E9E9E9]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,81) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 72x12
+ RenderText {#text} at (0,0) size 72x12
+ text run at (0,0) width 72: "ButtonShadow"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#939393]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,94) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 55x12
+ RenderText {#text} at (0,0) size 55x12
+ text run at (0,0) width 55: "ButtonText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,107) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 60x12
+ RenderText {#text} at (0,0) size 60x12
+ text run at (0,0) width 60: "CaptionText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,120) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 46x12
+ RenderText {#text} at (0,0) size 46x12
+ text run at (0,0) width 46: "GrayText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#808080]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,133) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 45x12
+ RenderText {#text} at (0,0) size 45x12
+ text run at (0,0) width 45: "Highlight"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#B5D5FF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,146) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 67x12
+ RenderText {#text} at (0,0) size 67x12
+ text run at (0,0) width 67: "HighlightText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,159) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 73x12
+ RenderText {#text} at (0,0) size 73x12
+ text run at (0,0) width 73: "InactiveBorder"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,172) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 78x12
+ RenderText {#text} at (0,0) size 78x12
+ text run at (0,0) width 78: "InactiveCaption"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,185) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 100x12
+ RenderText {#text} at (0,0) size 100x12
+ text run at (0,0) width 100: "InactiveCaptionText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,198) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 78x12
+ RenderText {#text} at (0,0) size 78x12
+ text run at (0,0) width 78: "InfoBackground"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#FBFCC5]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,211) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 42x12
+ RenderText {#text} at (0,0) size 42x12
+ text run at (0,0) width 42: "InfoText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,224) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 26x12
+ RenderText {#text} at (0,0) size 26x12
+ text run at (0,0) width 26: "Menu"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#0E37FF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,237) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 48x12
+ RenderText {#text} at (0,0) size 48x12
+ text run at (0,0) width 48: "MenuText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,250) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 44x12
+ RenderText {#text} at (0,0) size 44x12
+ text run at (0,0) width 44: "Scrollbar"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#AAAAAA]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,263) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 99x12
+ RenderText {#text} at (0,0) size 99x12
+ text run at (0,0) width 99: "ThreeDDarkShadow"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,276) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 59x12
+ RenderText {#text} at (0,0) size 59x12
+ text run at (0,0) width 59: "ThreeDFace"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#C0C0C0]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,289) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 81x12
+ RenderText {#text} at (0,0) size 81x12
+ text run at (0,0) width 81: "ThreeDHighlight"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,302) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 100x12
+ RenderText {#text} at (0,0) size 100x12
+ text run at (0,0) width 100: "ThreeDLightShadow"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,315) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 75x12
+ RenderText {#text} at (0,0) size 75x12
+ text run at (0,0) width 75: "ThreeDShadow"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,328) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 39x12
+ RenderText {#text} at (0,0) size 39x12
+ text run at (0,0) width 39: "Window"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#E8E8FF]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,341) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 71x12
+ RenderText {#text} at (0,0) size 71x12
+ text run at (0,0) width 71: "WindowFrame"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#AAAAAA]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
+ RenderBlock {DIV} at (3,354) size 750x12
+ RenderBlock (floating) {DIV} at (0,0) size 61x12
+ RenderText {#text} at (0,0) size 61x12
+ text run at (0,0) width 61: "WindowText"
+ RenderBlock (floating) {DIV} at (130,0) size 620x12 [bgcolor=#000000]
+ RenderText {#text} at (0,0) size 4x12
+ text run at (0,0) width 4: " "
+ RenderBlock (generated) at (0,12) size 750x0
+ RenderText at (0,0) size 0x0
return Color(static_cast<int>(255.0 * [color redComponent]), static_cast<int>(255.0 * [color greenComponent]), static_cast<int>(255.0 * [color blueComponent]));
}
-void RenderThemeMac::systemFont(int propId, FontDescription& fontDescription) const
+void RenderThemeMac::systemFont(int cssValueId, FontDescription& fontDescription) const
{
static FontDescription systemFont;
static FontDescription smallSystemFont;
FontDescription* cachedDesc;
NSFont* font = nil;
- switch (propId) {
+ switch (cssValueId) {
case CSS_VAL_SMALL_CAPTION:
cachedDesc = &smallSystemFont;
if (!smallSystemFont.isAbsoluteSize())
fontDescription = *cachedDesc;
}
+static RGBA32 convertNSColorToColor(NSColor *color)
+{
+ NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+ if (colorInColorSpace) {
+ static const double scaleFactor = nextafter(256.0, 0.0);
+ return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComponent]),
+ static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]),
+ static_cast<int>(scaleFactor * [colorInColorSpace blueComponent]));
+ }
+
+ // This conversion above can fail if the NSColor in question is an NSPatternColor
+ // (as many system colors are). These colors are actually a repeating pattern
+ // not just a solid color. To work around this we simply draw a 1x1 image of
+ // the color and use that pixel's color. It might be better to use an average of
+ // the colors in the pattern instead.
+ NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
+ pixelsWide:1
+ pixelsHigh:1
+ bitsPerSample:8
+ samplesPerPixel:4
+ hasAlpha:YES
+ isPlanar:NO
+ colorSpaceName:NSCalibratedRGBColorSpace
+ bytesPerRow:4
+ bitsPerPixel:32];
+
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep]];
+ NSEraseRect(NSMakeRect(0, 0, 1, 1));
+ [color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)];
+ [NSGraphicsContext restoreGraphicsState];
+
+ NSUInteger pixel[3];
+ [offscreenRep getPixel:pixel atX:0 y:0];
+
+ [offscreenRep release];
+
+ return makeRGB(pixel[0], pixel[1], pixel[3]);
+}
+
+void RenderThemeMac::platformColorsDidChange()
+{
+ m_systemColorCache.clear();
+ RenderTheme::platformColorsDidChange();
+}
+
+Color RenderThemeMac::systemColor(int cssValueId) const
+{
+ if (m_systemColorCache.contains(cssValueId))
+ return m_systemColorCache.get(cssValueId);
+
+ Color color;
+ switch (cssValueId) {
+ case CSS_VAL_ACTIVEBORDER:
+ color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]);
+ break;
+ case CSS_VAL_ACTIVECAPTION:
+ color = convertNSColorToColor([NSColor windowFrameTextColor]);
+ break;
+ case CSS_VAL_APPWORKSPACE:
+ color = convertNSColorToColor([NSColor headerColor]);
+ break;
+ case CSS_VAL_BACKGROUND:
+ // Use theme independent default
+ break;
+ case CSS_VAL_BUTTONFACE:
+ // We use this value instead of NSColor's controlColor to avoid website incompatibilities.
+ // We may want to change this to use the NSColor in future.
+ color = 0xFFC0C0C0;
+ break;
+ case CSS_VAL_BUTTONHIGHLIGHT:
+ color = convertNSColorToColor([NSColor controlHighlightColor]);
+ break;
+ case CSS_VAL_BUTTONSHADOW:
+ color = convertNSColorToColor([NSColor controlShadowColor]);
+ break;
+ case CSS_VAL_BUTTONTEXT:
+ color = convertNSColorToColor([NSColor controlTextColor]);
+ break;
+ case CSS_VAL_CAPTIONTEXT:
+ color = convertNSColorToColor([NSColor textColor]);
+ break;
+ case CSS_VAL_GRAYTEXT:
+ color = convertNSColorToColor([NSColor disabledControlTextColor]);
+ break;
+ case CSS_VAL_HIGHLIGHT:
+ color = convertNSColorToColor([NSColor selectedTextBackgroundColor]);
+ break;
+ case CSS_VAL_HIGHLIGHTTEXT:
+ color = convertNSColorToColor([NSColor selectedTextColor]);
+ break;
+ case CSS_VAL_INACTIVEBORDER:
+ color = convertNSColorToColor([NSColor controlBackgroundColor]);
+ break;
+ case CSS_VAL_INACTIVECAPTION:
+ color = convertNSColorToColor([NSColor controlBackgroundColor]);
+ break;
+ case CSS_VAL_INACTIVECAPTIONTEXT:
+ color = convertNSColorToColor([NSColor textColor]);
+ break;
+ case CSS_VAL_INFOBACKGROUND:
+ // There is no corresponding NSColor for this so we use a hard coded value.
+ color = 0xFFFBFCC5;
+ break;
+ case CSS_VAL_INFOTEXT:
+ color = convertNSColorToColor([NSColor textColor]);
+ break;
+ case CSS_VAL_MENU:
+ color = convertNSColorToColor([NSColor selectedMenuItemColor]);
+ break;
+ case CSS_VAL_MENUTEXT:
+ color = convertNSColorToColor([NSColor selectedMenuItemTextColor]);
+ break;
+ case CSS_VAL_SCROLLBAR:
+ color = convertNSColorToColor([NSColor scrollBarColor]);
+ break;
+ case CSS_VAL_TEXT:
+ color = convertNSColorToColor([NSColor textColor]);
+ break;
+ case CSS_VAL_THREEDDARKSHADOW:
+ color = convertNSColorToColor([NSColor controlDarkShadowColor]);
+ break;
+ case CSS_VAL_THREEDSHADOW:
+ color = convertNSColorToColor([NSColor shadowColor]);
+ break;
+ case CSS_VAL_THREEDFACE:
+ // We use this value instead of NSColor's controlColor to avoid website incompatibilities.
+ // We may want to change this to use the NSColor in future.
+ color = 0xFFC0C0C0;
+ break;
+ case CSS_VAL_THREEDHIGHLIGHT:
+ color = convertNSColorToColor([NSColor highlightColor]);
+ break;
+ case CSS_VAL_THREEDLIGHTSHADOW:
+ color = convertNSColorToColor([NSColor controlLightHighlightColor]);
+ break;
+ case CSS_VAL_WINDOW:
+ color = convertNSColorToColor([NSColor windowBackgroundColor]);
+ break;
+ case CSS_VAL_WINDOWFRAME:
+ color = convertNSColorToColor([NSColor windowFrameColor]);
+ break;
+ case CSS_VAL_WINDOWTEXT:
+ color = convertNSColorToColor([NSColor windowFrameTextColor]);
+ break;
+ }
+
+ if (!color.isValid())
+ color = RenderTheme::systemColor(cssValueId);
+
+ if (color.isValid())
+ m_systemColorCache.set(cssValueId, color.rgb());
+
+ return color;
+}
+
bool RenderThemeMac::isControlStyled(const RenderStyle* style, const BorderData& border,
const BackgroundLayer& background, const Color& backgroundColor) const
{