+2013-04-05 Ryosuke Niwa <rniwa@webkit.org>
+
+ Remove Chromium code from WebCore/rendering
+ https://bugs.webkit.org/show_bug.cgi?id=114017
+
+ Reviewed by Simon Fraser.
+
+ Removed.
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::setLogicalWidthForTextRun):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer):
+ (WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer):
+ (WebCore::RenderLayerBacking::requiresScrollCornerLayer):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::paintContents):
+ (WebCore::shouldCompositeOverflowControls):
+ (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
+ * rendering/RenderMediaControlsChromium.cpp: Removed.
+ * rendering/RenderMediaControlsChromium.h: Removed.
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::shouldRespectImageOrientation):
+ * rendering/RenderText.cpp:
+ (WebCore):
+ (WebCore::RenderText::previousOffsetForBackwardDeletion):
+ * rendering/RenderThemeChromiumAndroid.cpp: Removed.
+ * rendering/RenderThemeChromiumAndroid.h: Removed.
+ * rendering/RenderThemeChromiumCommon.cpp: Removed.
+ * rendering/RenderThemeChromiumCommon.h: Removed.
+ * rendering/RenderThemeChromiumDefault.cpp: Removed.
+ * rendering/RenderThemeChromiumDefault.h: Removed.
+ * rendering/RenderThemeChromiumFontProvider.cpp: Removed.
+ * rendering/RenderThemeChromiumFontProvider.h: Removed.
+ * rendering/RenderThemeChromiumFontProviderLinux.cpp: Removed.
+ * rendering/RenderThemeChromiumFontProviderWin.cpp: Removed.
+ * rendering/RenderThemeChromiumMac.h: Removed.
+ * rendering/RenderThemeChromiumMac.mm: Removed.
+ * rendering/RenderThemeChromiumSkia.cpp: Removed.
+ * rendering/RenderThemeChromiumSkia.h: Removed.
+ * rendering/RenderThemeChromiumWin.cpp: Removed.
+ * rendering/RenderThemeChromiumWin.h: Removed.
+ * rendering/RenderThemeMacShared.mm:
+ (WebCore::RenderThemeMacShared::paintSliderThumb):
+
2013-04-05 Noam Rosenthal <noam@webkit.org>
[Texmap] css3/filters/filter-animation-from-none-hw.html does not animate
float measuredWidth = 0;
bool kerningIsEnabled = font.typesettingFeatures() & Kerning;
-
-#if PLATFORM(CHROMIUM) && OS(DARWIN)
- // FIXME: Having any font feature settings enabled can lead to selection gaps on
- // Chromium-mac. https://bugs.webkit.org/show_bug.cgi?id=113418
- bool canUseSimpleFontCodePath = renderer->canUseSimpleFontCodePath() && !font.fontDescription().featureSettings();
-#else
bool canUseSimpleFontCodePath = renderer->canUseSimpleFontCodePath();
-#endif
// Since we don't cache glyph overflows, we need to re-measure the run if
// the style is linebox-contain: glyph.
bool RenderLayerBacking::requiresHorizontalScrollbarLayer() const
{
-#if !PLATFORM(CHROMIUM)
if (!m_owningLayer->hasOverlayScrollbars() && !m_owningLayer->needsCompositedScrolling())
return false;
-#endif
return m_owningLayer->horizontalScrollbar();
}
bool RenderLayerBacking::requiresVerticalScrollbarLayer() const
{
-#if !PLATFORM(CHROMIUM)
if (!m_owningLayer->hasOverlayScrollbars() && !m_owningLayer->needsCompositedScrolling())
return false;
-#endif
return m_owningLayer->verticalScrollbar();
}
bool RenderLayerBacking::requiresScrollCornerLayer() const
{
-#if !PLATFORM(CHROMIUM)
if (!m_owningLayer->hasOverlayScrollbars() && !m_owningLayer->needsCompositedScrolling())
return false;
-#endif
return !m_owningLayer->scrollCornerAndResizerRect().isEmpty();
}
transformedClip.moveBy(scrollCorner.location());
m_renderView->frameView()->paintScrollCorner(&context, transformedClip);
context.restore();
-#if PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING)
- } else if (graphicsLayer == layerForOverhangAreas()) {
- ScrollView* view = m_renderView->frameView();
- view->calculateAndPaintOverhangAreas(&context, clip);
-#endif
}
}
return true;
}
-#if !PLATFORM(CHROMIUM)
if (!view->hasOverlayScrollbars())
return false;
-#endif
return true;
}
if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground() && !m_renderView->frameView()->prohibitsScrolling())
return true;
- // Chromium always wants a layer.
-#if PLATFORM(CHROMIUM)
- return true;
-#endif
-
return false;
}
+++ /dev/null
-/*
- * Copyright (C) 2009 Apple Inc.
- * Copyright (C) 2009 Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderMediaControlsChromium.h"
-
-#include "Gradient.h"
-#include "GraphicsContext.h"
-#include "HTMLMediaElement.h"
-#include "HTMLNames.h"
-#include "PaintInfo.h"
-#include "TimeRanges.h"
-
-namespace WebCore {
-
-#if ENABLE(VIDEO)
-
-typedef WTF::HashMap<const char*, Image*> MediaControlImageMap;
-static MediaControlImageMap* gMediaControlImageMap = 0;
-
-static Image* platformResource(const char* name)
-{
- if (!gMediaControlImageMap)
- gMediaControlImageMap = new MediaControlImageMap();
- if (Image* image = gMediaControlImageMap->get(name))
- return image;
- if (Image* image = Image::loadPlatformResource(name).leakRef()) {
- gMediaControlImageMap->set(name, image);
- return image;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-static bool hasSource(const HTMLMediaElement* mediaElement)
-{
- return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY
- && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE;
-}
-
-static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Image* image)
-{
- context->drawImage(image, ColorSpaceDeviceRGB, rect);
- return true;
-}
-
-static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3");
- static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2");
- static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1");
- static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0");
- static Image* soundDisabled = platformResource("mediaplayerSoundDisabled");
-
- if (!hasSource(mediaElement) || !mediaElement->hasAudio())
- return paintMediaButton(paintInfo.context, rect, soundDisabled);
-
- if (mediaElement->muted() || mediaElement->volume() <= 0)
- return paintMediaButton(paintInfo.context, rect, soundLevel0);
-
- if (mediaElement->volume() <= 0.33)
- return paintMediaButton(paintInfo.context, rect, soundLevel1);
-
- if (mediaElement->volume() <= 0.66)
- return paintMediaButton(paintInfo.context, rect, soundLevel2);
-
- return paintMediaButton(paintInfo.context, rect, soundLevel3);
-}
-
-static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- static Image* mediaPlay = platformResource("mediaplayerPlay");
- static Image* mediaPause = platformResource("mediaplayerPause");
- static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled");
-
- if (!hasSource(mediaElement))
- return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled);
-
- return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : mediaPause);
-}
-
-static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- if (!hasSource(mediaElement) || !mediaElement->canPlay())
- return false;
-
- static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay");
- return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay);
-}
-
-static Image* getMediaSliderThumb()
-{
- static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
- return mediaSliderThumb;
-}
-
-static void paintRoundedSliderBackground(const IntRect& rect, const RenderStyle* style, GraphicsContext* context)
-{
- int borderRadius = rect.height() / 2;
- IntSize radii(borderRadius, borderRadius);
- Color sliderBackgroundColor = Color(11, 11, 11);
- context->save();
- context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundColor, ColorSpaceDeviceRGB);
- context->restore();
-}
-
-static void paintSliderRangeHighlight(const IntRect& rect, const RenderStyle* style, GraphicsContext* context, int startPosition, int endPosition, Color startColor, Color endColor)
-{
- // Calculate border radius; need to avoid being smaller than half the slider height
- // because of https://bugs.webkit.org/show_bug.cgi?id=30143.
- int borderRadius = rect.height() / 2;
- IntSize radii(borderRadius, borderRadius);
-
- // Calculate highlight rectangle and edge dimensions.
- int startOffset = startPosition;
- int endOffset = rect.width() - endPosition;
- int rangeWidth = endPosition - startPosition;
-
- if (rangeWidth <= 0)
- return;
-
- // Make sure the range width is bigger than border radius at the edges to retain rounded corners.
- if (startOffset < borderRadius && rangeWidth < borderRadius)
- rangeWidth = borderRadius;
- if (endOffset < borderRadius && rangeWidth < borderRadius) {
- startPosition -= borderRadius - rangeWidth;
- rangeWidth = borderRadius;
- }
-
- // Set rectangle to highlight range.
- IntRect highlightRect = rect;
- highlightRect.move(startOffset, 0);
- highlightRect.setWidth(rangeWidth);
-
- // Don't bother drawing an empty area.
- if (highlightRect.isEmpty())
- return;
-
- // Calculate white-grey gradient.
- IntPoint sliderTopLeft = highlightRect.location();
- IntPoint sliderBottomLeft = sliderTopLeft;
- sliderBottomLeft.move(0, highlightRect.height());
- RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft);
- gradient->addColorStop(0.0, startColor);
- gradient->addColorStop(1.0, endColor);
-
- // Fill highlight rectangle with gradient, potentially rounded if on left or right edge.
- context->save();
- context->setFillGradient(gradient);
-
- if (startOffset < borderRadius && endOffset < borderRadius)
- context->fillRoundedRect(highlightRect, radii, radii, radii, radii, startColor, ColorSpaceDeviceRGB);
- else if (startOffset < borderRadius)
- context->fillRoundedRect(highlightRect, radii, IntSize(0, 0), radii, IntSize(0, 0), startColor, ColorSpaceDeviceRGB);
- else if (endOffset < borderRadius)
- context->fillRoundedRect(highlightRect, IntSize(0, 0), radii, IntSize(0, 0), radii, startColor, ColorSpaceDeviceRGB);
- else
- context->fillRect(highlightRect);
-
- context->restore();
-}
-
-const int mediaSliderThumbWidth = 32;
-
-static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- RenderStyle* style = object->style();
- GraphicsContext* context = paintInfo.context;
-
- paintRoundedSliderBackground(rect, style, context);
-
- // Draw the buffered range. Since the element may have multiple buffered ranges and it'd be
- // distracting/'busy' to show all of them, show only the buffered range containing the current play head.
- RefPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered();
- float duration = mediaElement->duration();
- float currentTime = mediaElement->currentTime();
- if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(currentTime))
- return true;
-
- for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) {
- float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION);
- float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION);
- if (std::isnan(start) || std::isnan(end) || start > currentTime || end < currentTime)
- continue;
- int startPosition = int(start * rect.width() / duration);
- int currentPosition = int(currentTime * rect.width() / duration);
- int endPosition = int(end * rect.width() / duration);
-
- // Add half the thumb width proportionally adjusted to the current painting position.
- int thumbCenter = mediaSliderThumbWidth / 2;
- int addWidth = thumbCenter * (1.0 - 2.0 * currentPosition / rect.width());
- currentPosition += addWidth;
-
- // Draw white-ish highlight before current time.
- Color startColor = Color(195, 195, 195);
- Color endColor = Color(217, 217, 217);
- if (currentPosition > startPosition)
- paintSliderRangeHighlight(rect, style, context, startPosition, currentPosition, startColor, endColor);
-
- // Draw grey-ish highlight after current time.
- startColor = Color(60, 60, 60);
- endColor = Color(76, 76, 76);
-
- if (endPosition > currentPosition)
- paintSliderRangeHighlight(rect, style, context, currentPosition, endPosition, startColor, endColor);
-
- return true;
- }
-
- return true;
-}
-
-static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- ASSERT(object->node());
- HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
- if (!mediaElement)
- return false;
-
- if (!hasSource(mediaElement))
- return true;
-
- Image* mediaSliderThumb = getMediaSliderThumb();
- return paintMediaButton(paintInfo.context, rect, mediaSliderThumb);
-}
-
-const int mediaVolumeSliderThumbWidth = 24;
-
-static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- GraphicsContext* context = paintInfo.context;
- RenderStyle* style = object->style();
-
- paintRoundedSliderBackground(rect, style, context);
-
- // Calculate volume position for white background rectangle.
- float volume = mediaElement->volume();
- if (std::isnan(volume) || volume < 0)
- return true;
- if (volume > 1)
- volume = 1;
- if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->muted())
- volume = 0;
-
- // Calculate the position relative to the center of the thumb.
- float fillWidth = 0;
- if (volume > 0) {
- float thumbCenter = mediaVolumeSliderThumbWidth / 2;
- float zoomLevel = style->effectiveZoom();
- float positionWidth = volume * (rect.width() - (zoomLevel * thumbCenter));
- fillWidth = positionWidth + (zoomLevel * thumbCenter / 2);
- }
-
- Color startColor = Color(195, 195, 195);
- Color endColor = Color(217, 217, 217);
-
- paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor, endColor);
-
- return true;
-}
-
-static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- ASSERT(object->node());
- HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
- if (!mediaElement)
- return false;
-
- if (!hasSource(mediaElement) || !mediaElement->hasAudio())
- return true;
-
- static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSliderThumb");
- return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb);
-}
-
-static bool paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- static Image* mediaFullscreenButton = platformResource("mediaplayerFullscreen");
- return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton);
-}
-
-static bool paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- HTMLMediaElement* mediaElement = toParentMediaElement(object);
- if (!mediaElement)
- return false;
-
- static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosedCaption");
- static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplayerClosedCaptionDisabled");
-
- if (mediaElement->webkitClosedCaptionsVisible())
- return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButton);
-
- return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDisabled);
-}
-
-
-bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- switch (part) {
- case MediaMuteButton:
- case MediaUnMuteButton:
- return paintMediaMuteButton(object, paintInfo, rect);
- case MediaPauseButton:
- case MediaPlayButton:
- return paintMediaPlayButton(object, paintInfo, rect);
- case MediaShowClosedCaptionsButton:
- return paintMediaToggleClosedCaptionsButton(object, paintInfo, rect);
- case MediaSlider:
- return paintMediaSlider(object, paintInfo, rect);
- case MediaSliderThumb:
- return paintMediaSliderThumb(object, paintInfo, rect);
- case MediaVolumeSlider:
- return paintMediaVolumeSlider(object, paintInfo, rect);
- case MediaVolumeSliderThumb:
- return paintMediaVolumeSliderThumb(object, paintInfo, rect);
- case MediaEnterFullscreenButton:
- case MediaExitFullscreenButton:
- return paintMediaFullscreenButton(object, paintInfo, rect);
- case MediaOverlayPlayButton:
- return paintMediaOverlayPlayButton(object, paintInfo, rect);
- case MediaVolumeSliderMuteButton:
- case MediaSeekBackButton:
- case MediaSeekForwardButton:
- case MediaVolumeSliderContainer:
- case MediaTimelineContainer:
- case MediaCurrentTimeDisplay:
- case MediaTimeRemainingDisplay:
- case MediaControlsPanel:
- case MediaRewindButton:
- case MediaReturnToRealtimeButton:
- case MediaStatusDisplay:
- case MediaHideClosedCaptionsButton:
- case MediaTextTrackDisplayContainer:
- case MediaTextTrackDisplay:
- case MediaFullScreenVolumeSlider:
- case MediaFullScreenVolumeSliderThumb:
- case MediaClosedCaptionsContainer:
- case MediaClosedCaptionsTrackList:
- ASSERT_NOT_REACHED();
- break;
- }
- return false;
-}
-
-const int mediaSliderThumbHeight = 24;
-const int mediaVolumeSliderThumbHeight = 24;
-
-void RenderMediaControlsChromium::adjustMediaSliderThumbSize(RenderStyle* style)
-{
- static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
- static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSliderThumb");
- int width = 0;
- int height = 0;
-
- Image* thumbImage = 0;
- if (style->appearance() == MediaSliderThumbPart) {
- thumbImage = mediaSliderThumb;
- width = mediaSliderThumbWidth;
- height = mediaSliderThumbHeight;
- } else if (style->appearance() == MediaVolumeSliderThumbPart) {
- thumbImage = mediaVolumeSliderThumb;
- width = mediaVolumeSliderThumbWidth;
- height = mediaVolumeSliderThumbHeight;
- }
-
- float zoomLevel = style->effectiveZoom();
- if (thumbImage) {
- style->setWidth(Length(static_cast<int>(width * zoomLevel), Fixed));
- style->setHeight(Length(static_cast<int>(height * zoomLevel), Fixed));
- }
-}
-
-static String formatChromiumMediaControlsTime(float time, float duration)
-{
- if (!std::isfinite(time))
- time = 0;
- if (!std::isfinite(duration))
- duration = 0;
- int seconds = static_cast<int>(fabsf(time));
- int hours = seconds / (60 * 60);
- int minutes = (seconds / 60) % 60;
- seconds %= 60;
-
- // duration defines the format of how the time is rendered
- int durationSecs = static_cast<int>(fabsf(duration));
- int durationHours = durationSecs / (60 * 60);
- int durationMins = (durationSecs / 60) % 60;
-
- if (durationHours || hours)
- return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
- if (durationMins > 9)
- return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
-
- return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
-}
-
-String RenderMediaControlsChromium::formatMediaControlsTime(float time)
-{
- return formatChromiumMediaControlsTime(time, time);
-}
-
-String RenderMediaControlsChromium::formatMediaControlsCurrentTime(float currentTime, float duration)
-{
- return formatChromiumMediaControlsTime(currentTime, duration);
-}
-
-String RenderMediaControlsChromium::formatMediaControlsRemainingTime(float currentTime, float duration)
-{
- return formatChromiumMediaControlsTime(currentTime - duration, duration);
-}
-
-#endif // #if ENABLE(VIDEO)
-
-} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (C) 2009 Apple Inc.
- * Copyright (C) 2009 Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RenderMediaControlsChromium_h
-#define RenderMediaControlsChromium_h
-
-#include "MediaControlElements.h"
-
-namespace WebCore {
-
-struct PaintInfo;
-
-class HTMLMediaElement;
-class IntRect;
-class RenderObject;
-
-class RenderMediaControlsChromium {
-public:
- static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const PaintInfo&, const IntRect&);
- static void adjustMediaSliderThumbSize(RenderStyle*);
- static String formatMediaControlsTime(float time);
- static String formatMediaControlsCurrentTime(float currentTime, float duration);
- static String formatMediaControlsRemainingTime(float currentTime, float duration);
-};
-
-} // namespace WebCore
-
-#endif // RenderMediaControlsChromium_h
// Respect the image's orientation if it's being used as a full-page image or it's
// an <img> and the setting to respect it everywhere is set.
return
-#if USE(CG) || PLATFORM(CHROMIUM) || USE(CAIRO) || PLATFORM(BLACKBERRY)
+#if USE(CG) || USE(CAIRO) || PLATFORM(BLACKBERRY)
// This can only be enabled for ports which honor the orientation flag in their drawing code.
document()->isImageDocument() ||
#endif
return result;
}
-#if PLATFORM(MAC) || PLATFORM(CHROMIUM) && OS(MAC_OS_X)
+#if PLATFORM(MAC)
#define HANGUL_CHOSEONG_START (0x1100)
#define HANGUL_CHOSEONG_END (0x115F)
int RenderText::previousOffsetForBackwardDeletion(int current) const
{
-#if PLATFORM(MAC) || PLATFORM(CHROMIUM) && OS(MAC_OS_X)
+#if PLATFORM(MAC)
ASSERT(m_text);
StringImpl& text = *m_text.impl();
UChar32 character;
+++ /dev/null
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumAndroid.h"
-
-#include "CSSValueKeywords.h"
-#include "Color.h"
-#include "LayoutTestSupport.h"
-#include "PaintInfo.h"
-#include "RenderMediaControlsChromium.h"
-#include "RenderObject.h"
-#include "RenderProgress.h"
-#include "RenderSlider.h"
-#include "ScrollbarTheme.h"
-#include "UserAgentStyleSheets.h"
-
-#include <public/Platform.h>
-#include <public/android/WebThemeEngine.h>
-
-namespace WebCore {
-
-PassRefPtr<RenderTheme> RenderThemeChromiumAndroid::create()
-{
- return adoptRef(new RenderThemeChromiumAndroid());
-}
-
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
-{
- static RenderTheme* renderTheme = RenderThemeChromiumAndroid::create().leakRef();
- return renderTheme;
-}
-
-RenderThemeChromiumAndroid::~RenderThemeChromiumAndroid()
-{
-}
-
-Color RenderThemeChromiumAndroid::systemColor(int cssValueId) const
-{
- if (isRunningLayoutTest() && cssValueId == CSSValueButtonface) {
- // Match Chromium Linux' button color in layout tests.
- static const Color linuxButtonGrayColor(0xffdddddd);
- return linuxButtonGrayColor;
- }
- return RenderTheme::systemColor(cssValueId);
-}
-
-String RenderThemeChromiumAndroid::extraMediaControlsStyleSheet()
-{
- return String(mediaControlsChromiumAndroidUserAgentStyleSheet, sizeof(mediaControlsChromiumAndroidUserAgentStyleSheet));
-}
-
-String RenderThemeChromiumAndroid::extraDefaultStyleSheet()
-{
- return RenderThemeChromiumDefault::extraDefaultStyleSheet() +
- String(themeChromiumAndroidUserAgentStyleSheet, sizeof(themeChromiumAndroidUserAgentStyleSheet));
-}
-
-void RenderThemeChromiumAndroid::adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- if (isRunningLayoutTest()) {
- // Match Chromium Linux spin button style in layout tests.
- // FIXME: Consider removing the conditional if a future Android theme matches this.
- IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartInnerSpinButton);
-
- style->setWidth(Length(size.width(), Fixed));
- style->setMinWidth(Length(size.width(), Fixed));
- }
-}
-
-bool RenderThemeChromiumAndroid::paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaOverlayPlayButton, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-int RenderThemeChromiumAndroid::menuListArrowPadding() const
-{
- // We cannot use the scrollbar thickness here, as it's width is 0 on Android.
- // Instead, use the width of the scrollbar down arrow.
- IntSize scrollbarSize = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarDownArrow);
- return scrollbarSize.width();
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RenderThemeChromiumAndroid_h
-#define RenderThemeChromiumAndroid_h
-
-#include "RenderThemeChromiumDefault.h"
-
-namespace WebCore {
-
-class RenderThemeChromiumAndroid : public RenderThemeChromiumDefault {
-public:
- static PassRefPtr<RenderTheme> create();
- virtual String extraDefaultStyleSheet() OVERRIDE;
-
- virtual Color systemColor(int cssValidId) const OVERRIDE;
-
- virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const OVERRIDE;
-
- virtual bool delegatesMenuListRendering() const OVERRIDE { return true; }
-
- virtual bool paintMediaOverlayPlayButton(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
-
-#if ENABLE(VIDEO)
- virtual String extraMediaControlsStyleSheet() OVERRIDE;
-#endif
-
-#if ENABLE(TOUCH_EVENTS)
- virtual Color platformTapHighlightColor() const OVERRIDE
- {
- return RenderThemeChromiumAndroid::defaultTapHighlightColor;
- }
-#endif
-
- virtual Color platformActiveSelectionBackgroundColor() const OVERRIDE
- {
- return RenderThemeChromiumAndroid::defaultActiveSelectionBackgroundColor;
- }
-
-protected:
- virtual int menuListArrowPadding() const OVERRIDE;
-
-private:
- virtual ~RenderThemeChromiumAndroid();
-
- static const RGBA32 defaultTapHighlightColor = 0x6633b5e5;
- static const RGBA32 defaultActiveSelectionBackgroundColor = 0x6633b5e5;
-};
-
-} // namespace WebCore
-
-#endif // RenderThemeChromiumAndroid_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumCommon.h"
-
-#include "InputTypeNames.h"
-#include "LayoutUnit.h"
-
-namespace WebCore {
-
-bool RenderThemeChromiumCommon::supportsDataListUI(const AtomicString& type)
-{
- return type == InputTypeNames::text() || type == InputTypeNames::search() || type == InputTypeNames::url()
- || type == InputTypeNames::telephone() || type == InputTypeNames::email() || type == InputTypeNames::number()
-#if ENABLE(INPUT_TYPE_COLOR)
- || type == InputTypeNames::color()
-#endif
-#if ENABLE(CALENDAR_PICKER)
- || type == InputTypeNames::date()
-#endif
- || type == InputTypeNames::datetime()
- || type == InputTypeNames::datetimelocal()
- || type == InputTypeNames::month()
- || type == InputTypeNames::week()
- || type == InputTypeNames::time()
- || type == InputTypeNames::range();
-}
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-bool RenderThemeChromiumCommon::supportsCalendarPicker(const AtomicString& type)
-{
- return type == InputTypeNames::date()
- || type == InputTypeNames::datetime()
- || type == InputTypeNames::datetimelocal()
- || type == InputTypeNames::month()
- || type == InputTypeNames::week();
-}
-#endif
-
-LayoutUnit RenderThemeChromiumCommon::sliderTickSnappingThreshold()
-{
- return 5;
-}
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifndef RenderThemeChromiumCommon_h
-#define RenderThemeChromiumCommon_h
-
-#include "LayoutUnit.h"
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-class RenderThemeChromiumCommon {
-public:
- static bool supportsDataListUI(const AtomicString& type);
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
- static bool supportsCalendarPicker(const AtomicString& type);
-#endif
- static LayoutUnit sliderTickSnappingThreshold();
-};
-
-}
-
-#endif // RenderThemeChromiumCommon_h
+++ /dev/null
-/*
- * Copyright (C) 2007 Apple Inc.
- * Copyright (C) 2007 Alp Toker <alp@atoker.com>
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008, 2009 Google Inc.
- * Copyright (C) 2009 Kenneth Rohde Christiansen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "RenderThemeChromiumDefault.h"
-
-#include "CSSValueKeywords.h"
-#include "Color.h"
-#include "PaintInfo.h"
-#include "PlatformContextSkia.h"
-#include "RenderObject.h"
-#include "RenderProgress.h"
-#include "RenderSlider.h"
-#include "ScrollbarTheme.h"
-#include "UserAgentStyleSheets.h"
-#include <public/Platform.h>
-#include <public/WebRect.h>
-#include <public/default/WebThemeEngine.h>
-
-namespace WebCore {
-
-unsigned RenderThemeChromiumDefault::m_activeSelectionBackgroundColor =
- 0xff1e90ff;
-unsigned RenderThemeChromiumDefault::m_activeSelectionForegroundColor =
- Color::black;
-unsigned RenderThemeChromiumDefault::m_inactiveSelectionBackgroundColor =
- 0xffc8c8c8;
-unsigned RenderThemeChromiumDefault::m_inactiveSelectionForegroundColor =
- 0xff323232;
-
-double RenderThemeChromiumDefault::m_caretBlinkInterval;
-
-static const unsigned defaultButtonBackgroundColor = 0xffdddddd;
-
-static WebKit::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, const RenderObject* o)
-{
- if (!theme->isEnabled(o))
- return WebKit::WebThemeEngine::StateDisabled;
- if (theme->isPressed(o))
- return WebKit::WebThemeEngine::StatePressed;
- if (theme->isHovered(o))
- return WebKit::WebThemeEngine::StateHover;
-
- return WebKit::WebThemeEngine::StateNormal;
-}
-
-PassRefPtr<RenderTheme> RenderThemeChromiumDefault::create()
-{
- return adoptRef(new RenderThemeChromiumDefault());
-}
-
-// RenderTheme::themeForPage for Android is defined in RenderThemeChromiumAndroid.cpp.
-#if !OS(ANDROID)
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
-{
- static RenderTheme* rt = RenderThemeChromiumDefault::create().leakRef();
- return rt;
-}
-#endif
-
-RenderThemeChromiumDefault::RenderThemeChromiumDefault()
-{
- m_caretBlinkInterval = RenderTheme::caretBlinkInterval();
-}
-
-RenderThemeChromiumDefault::~RenderThemeChromiumDefault()
-{
-}
-
-Color RenderThemeChromiumDefault::systemColor(int cssValueId) const
-{
- static const Color defaultButtonGrayColor(0xffdddddd);
- static const Color defaultMenuColor(0xfff7f7f7);
-
- if (cssValueId == CSSValueButtonface)
- return defaultButtonGrayColor;
- if (cssValueId == CSSValueMenu)
- return defaultMenuColor;
- return RenderTheme::systemColor(cssValueId);
-}
-
-String RenderThemeChromiumDefault::extraDefaultStyleSheet()
-{
-#if !OS(WINDOWS)
- return RenderThemeChromiumSkia::extraDefaultStyleSheet() +
- String(themeChromiumLinuxUserAgentStyleSheet, sizeof(themeChromiumLinuxUserAgentStyleSheet));
-#else
- return RenderThemeChromiumSkia::extraDefaultStyleSheet();
-#endif
-}
-
-bool RenderThemeChromiumDefault::controlSupportsTints(const RenderObject* o) const
-{
- return isEnabled(o);
-}
-
-Color RenderThemeChromiumDefault::activeListBoxSelectionBackgroundColor() const
-{
- return Color(0x28, 0x28, 0x28);
-}
-
-Color RenderThemeChromiumDefault::activeListBoxSelectionForegroundColor() const
-{
- return Color::black;
-}
-
-Color RenderThemeChromiumDefault::inactiveListBoxSelectionBackgroundColor() const
-{
- return Color(0xc8, 0xc8, 0xc8);
-}
-
-Color RenderThemeChromiumDefault::inactiveListBoxSelectionForegroundColor() const
-{
- return Color(0x32, 0x32, 0x32);
-}
-
-Color RenderThemeChromiumDefault::platformActiveSelectionBackgroundColor() const
-{
- return m_activeSelectionBackgroundColor;
-}
-
-Color RenderThemeChromiumDefault::platformInactiveSelectionBackgroundColor() const
-{
- return m_inactiveSelectionBackgroundColor;
-}
-
-Color RenderThemeChromiumDefault::platformActiveSelectionForegroundColor() const
-{
- return m_activeSelectionForegroundColor;
-}
-
-Color RenderThemeChromiumDefault::platformInactiveSelectionForegroundColor() const
-{
- return m_inactiveSelectionForegroundColor;
-}
-
-#if ENABLE(DATALIST_ELEMENT)
-IntSize RenderThemeChromiumDefault::sliderTickSize() const
-{
- return IntSize(1, 6);
-}
-
-int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const
-{
- return -16;
-}
-#endif
-
-void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Element* element) const
-{
- IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartSliderThumb);
-
- if (style->appearance() == SliderThumbHorizontalPart) {
- style->setWidth(Length(size.width(), Fixed));
- style->setHeight(Length(size.height(), Fixed));
- } else if (style->appearance() == SliderThumbVerticalPart) {
- style->setWidth(Length(size.height(), Fixed));
- style->setHeight(Length(size.width(), Fixed));
- } else
- RenderThemeChromiumSkia::adjustSliderThumbSize(style, element);
-}
-
-bool RenderThemeChromiumDefault::supportsControlTints() const
-{
- return true;
-}
-
-void RenderThemeChromiumDefault::setCaretBlinkInterval(double interval)
-{
- m_caretBlinkInterval = interval;
-}
-
-double RenderThemeChromiumDefault::caretBlinkIntervalInternal() const
-{
- return m_caretBlinkInterval;
-}
-
-void RenderThemeChromiumDefault::setSelectionColors(
- unsigned activeBackgroundColor,
- unsigned activeForegroundColor,
- unsigned inactiveBackgroundColor,
- unsigned inactiveForegroundColor)
-{
- m_activeSelectionBackgroundColor = activeBackgroundColor;
- m_activeSelectionForegroundColor = activeForegroundColor;
- m_inactiveSelectionBackgroundColor = inactiveBackgroundColor;
- m_inactiveSelectionForegroundColor = inactiveForegroundColor;
-}
-
-bool RenderThemeChromiumDefault::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- WebKit::WebThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- extraParams.button.checked = isChecked(o);
- extraParams.button.indeterminate = isIndeterminate(o);
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartCheckbox, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-void RenderThemeChromiumDefault::setCheckboxSize(RenderStyle* style) const
-{
- // If the width and height are both specified, then we have nothing to do.
- if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
- return;
-
- IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartCheckbox);
- setSizeIfAuto(style, size);
-}
-
-bool RenderThemeChromiumDefault::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- WebKit::WebThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- extraParams.button.checked = isChecked(o);
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartRadio, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-void RenderThemeChromiumDefault::setRadioSize(RenderStyle* style) const
-{
- // If the width and height are both specified, then we have nothing to do.
- if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
- return;
-
- IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartRadio);
- setSizeIfAuto(style, size);
-}
-
-bool RenderThemeChromiumDefault::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- WebKit::WebThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- extraParams.button.isDefault = isDefault(o);
- extraParams.button.hasBorder = true;
- extraParams.button.backgroundColor = defaultButtonBackgroundColor;
- if (o->hasBackground())
- extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-bool RenderThemeChromiumDefault::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- // WebThemeEngine does not handle border rounded corner and background image
- // so return true to draw CSS border and background.
- if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage())
- return true;
-
- ControlPart part = o->style()->appearance();
-
- WebKit::WebThemeEngine::ExtraParams extraParams;
- extraParams.textField.isTextArea = part == TextAreaPart;
- extraParams.textField.isListbox = part == ListboxPart;
-
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
-
- // Fallback to white if the specified color object is invalid.
- Color backgroundColor(Color::white);
- if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
- backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
- extraParams.textField.backgroundColor = backgroundColor.rgb();
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartTextField, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-bool RenderThemeChromiumDefault::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- if (!o->isBox())
- return false;
-
- const int right = rect.x() + rect.width();
- const int middle = rect.y() + rect.height() / 2;
-
- WebKit::WebThemeEngine::ExtraParams extraParams;
- extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
- extraParams.menuList.arrowY = middle;
- const RenderBox* box = toRenderBox(o);
- // Match Chromium Win behaviour of showing all borders if any are shown.
- extraParams.menuList.hasBorder = box->borderRight() || box->borderLeft() || box->borderTop() || box->borderBottom();
- extraParams.menuList.hasBorderRadius = o->style()->hasBorderRadius();
- // Fallback to transparent if the specified color object is invalid.
- extraParams.menuList.backgroundColor = Color::transparent;
- if (o->hasBackground())
- extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
-
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartMenuList, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- WebKit::WebThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart;
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartSliderTrack, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
-
-#if ENABLE(DATALIST_ELEMENT)
- paintSliderTicks(o, i, rect);
-#endif
-
- return false;
-}
-
-bool RenderThemeChromiumDefault::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- WebKit::WebThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
- extraParams.slider.inDrag = isPressed(o);
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartSliderThumb, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-void RenderThemeChromiumDefault::adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartInnerSpinButton);
-
- style->setWidth(Length(size.width(), Fixed));
- style->setMinWidth(Length(size.width(), Fixed));
-}
-
-bool RenderThemeChromiumDefault::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- WebKit::WebThemeEngine::ExtraParams extraParams;
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
- extraParams.innerSpin.readOnly = isReadOnlyControl(o);
-
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartInnerSpinButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-#if ENABLE(PROGRESS_ELEMENT)
-
-bool RenderThemeChromiumDefault::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- if (!o->isProgress())
- return true;
-
- RenderProgress* renderProgress = toRenderProgress(o);
- IntRect valueRect = progressValueRectFor(renderProgress, rect);
-
- WebKit::WebThemeEngine::ExtraParams extraParams;
- extraParams.progressBar.determinate = renderProgress->isDeterminate();
- extraParams.progressBar.valueRectX = valueRect.x();
- extraParams.progressBar.valueRectY = valueRect.y();
- extraParams.progressBar.valueRectWidth = valueRect.width();
- extraParams.progressBar.valueRectHeight = valueRect.height();
-
- DirectionFlippingScope scope(o, i, rect);
- WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
- return false;
-}
-
-#endif
-
-bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const
-{
- return true;
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (C) 2007 Holger Hans Peter Freyther
- * Copyright (C) 2007 Alp Toker <alp@atoker.com>
- * Copyright (C) 2008, 2009 Google, Inc.
- * All rights reserved.
- * Copyright (C) 2009 Kenneth Rohde Christiansen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RenderThemeChromiumDefault_h
-#define RenderThemeChromiumDefault_h
-
-#include "RenderThemeChromiumSkia.h"
-
-namespace WebCore {
-
-class RenderThemeChromiumDefault : public RenderThemeChromiumSkia {
-public:
- static PassRefPtr<RenderTheme> create();
- virtual String extraDefaultStyleSheet();
-
- virtual Color systemColor(int cssValidId) const;
-
- // A method asking if the control changes its tint when the window has focus or not.
- virtual bool controlSupportsTints(const RenderObject*) const;
-
- // List Box selection color
- virtual Color activeListBoxSelectionBackgroundColor() const;
- virtual Color activeListBoxSelectionForegroundColor() const;
- virtual Color inactiveListBoxSelectionBackgroundColor() const;
- virtual Color inactiveListBoxSelectionForegroundColor() const;
-
- virtual Color platformActiveSelectionBackgroundColor() const;
- virtual Color platformInactiveSelectionBackgroundColor() const;
- virtual Color platformActiveSelectionForegroundColor() const;
- virtual Color platformInactiveSelectionForegroundColor() const;
-
-#if ENABLE(DATALIST_ELEMENT)
- virtual IntSize sliderTickSize() const OVERRIDE;
- virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE;
-#endif
- virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
-
- static void setCaretBlinkInterval(double);
- virtual double caretBlinkIntervalInternal() const;
-
- virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void setCheckboxSize(RenderStyle*) const;
-
- virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void setRadioSize(RenderStyle*) const;
-
- virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual bool popsMenuBySpaceOrReturn() const OVERRIDE { return true; }
-
-#if ENABLE(PROGRESS_ELEMENT)
- virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
-#endif
-
- virtual bool shouldOpenPickerWithF4Key() const OVERRIDE;
-
- static void setSelectionColors(unsigned activeBackgroundColor, unsigned activeForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForegroundColor);
-
-protected:
- RenderThemeChromiumDefault();
- virtual ~RenderThemeChromiumDefault();
-
-private:
- // A general method asking if any control tinting is supported at all.
- virtual bool supportsControlTints() const;
-
- static double m_caretBlinkInterval;
-
- static unsigned m_activeSelectionBackgroundColor;
- static unsigned m_activeSelectionForegroundColor;
- static unsigned m_inactiveSelectionBackgroundColor;
- static unsigned m_inactiveSelectionForegroundColor;
-};
-
-} // namespace WebCore
-
-#endif // RenderThemeChromiumDefault_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumFontProvider.h"
-
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-// The default variable-width font size. We use this as the default font
-// size for the "system font", and as a base size (which we then shrink) for
-// form control fonts.
-// static
-float RenderThemeChromiumFontProvider::s_defaultFontSize = 16.0;
-
-// We aim to match IE here.
-// -IE uses a font based on the encoding as the default font for form controls.
-// -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT),
-// which returns MS Shell Dlg)
-// -Safari uses Lucida Grande.
-//
-// FIXME: The only case where we know we don't match IE is for ANSI encodings.
-// IE uses MS Shell Dlg there, which we render incorrectly at certain pixel
-// sizes (e.g. 15px). So, for now we just use Arial.
-const String& RenderThemeChromiumFontProvider::defaultGUIFont()
-{
- DEFINE_STATIC_LOCAL(String, fontFace, (ASCIILiteral("Arial")));
- return fontFace;
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RenderThemeChromiumFontProvider_h
-#define RenderThemeChromiumFontProvider_h
-
-namespace WTF {
-class String;
-}
-
-namespace WebCore {
-
-class FontDescription;
-
-class RenderThemeChromiumFontProvider {
-public:
- static void systemFont(int propId, FontDescription&);
- static void setDefaultFontSize(int);
-
-protected:
- static const WTF::String& defaultGUIFont();
-
- static float s_defaultFontSize;
-};
-
-} // namespace WebCore
-
-#endif // RenderThemeChromiumFontProvider_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumFontProvider.h"
-
-#include "CSSValueKeywords.h"
-#include "FontDescription.h"
-
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-// static
-void RenderThemeChromiumFontProvider::setDefaultFontSize(int fontSize)
-{
- s_defaultFontSize = static_cast<float>(fontSize);
-}
-
-// static
-void RenderThemeChromiumFontProvider::systemFont(int propId, FontDescription& fontDescription)
-{
- float fontSize = s_defaultFontSize;
-
- switch (propId) {
- case CSSValueWebkitMiniControl:
- case CSSValueWebkitSmallControl:
- case CSSValueWebkitControl:
- // Why 2 points smaller? Because that's what Gecko does. Note that we
- // are assuming a 96dpi screen, which is the default that we use on
- // Windows.
- static const float pointsPerInch = 72.0f;
- static const float pixelsPerInch = 96.0f;
- fontSize -= (2.0f / pointsPerInch) * pixelsPerInch;
- break;
- }
-
- fontDescription.firstFamily().setFamily(defaultGUIFont());
- fontDescription.setSpecifiedSize(fontSize);
- fontDescription.setIsAbsoluteSize(true);
- fontDescription.setGenericFamily(FontDescription::NoFamily);
- fontDescription.setWeight(FontWeightNormal);
- fontDescription.setItalic(false);
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumFontProvider.h"
-
-#include "CSSValueKeywords.h"
-#include "FontDescription.h"
-#include "HWndDC.h"
-#include "SystemInfo.h"
-
-#include <windows.h>
-#include <wtf/text/WTFString.h>
-
-#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(structName, member) \
- offsetof(structName, member) + \
- (sizeof static_cast<structName*>(0)->member)
-#define NONCLIENTMETRICS_SIZE_PRE_VISTA \
- SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
-
-namespace WebCore {
-
-static FontDescription& smallSystemFont()
-{
- DEFINE_STATIC_LOCAL(FontDescription, font, ());
- return font;
-}
-
-static FontDescription& menuFont()
-{
- DEFINE_STATIC_LOCAL(FontDescription, font, ());
- return font;
-}
-
-static FontDescription& labelFont()
-{
- DEFINE_STATIC_LOCAL(FontDescription, font, ());
- return font;
-}
-
-// Converts |points| to pixels. One point is 1/72 of an inch.
-static float pointsToPixels(float points)
-{
- static float pixelsPerInch = 0.0f;
- if (!pixelsPerInch) {
- HWndDC hdc(0); // What about printing? Is this the right DC?
- if (hdc) // Can this ever actually be 0?
- pixelsPerInch = GetDeviceCaps(hdc, LOGPIXELSY);
- else
- pixelsPerInch = 96.0f;
- }
-
- static const float pointsPerInch = 72.0f;
- return points / pointsPerInch * pixelsPerInch;
-}
-
-static void getNonClientMetrics(NONCLIENTMETRICS* metrics)
-{
- static UINT size = (windowsVersion() >= WindowsVista) ?
- sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
- metrics->cbSize = size;
- bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, size, metrics, 0);
- ASSERT(success);
-}
-
-// Return the height of system font |font| in pixels. We use this size by
-// default for some non-form-control elements.
-static float systemFontSize(const LOGFONT& font)
-{
- float size = -font.lfHeight;
- if (size < 0) {
- HFONT hFont = CreateFontIndirect(&font);
- if (hFont) {
- HWndDC hdc(0); // What about printing? Is this the right DC?
- if (hdc) {
- HGDIOBJ hObject = SelectObject(hdc, hFont);
- TEXTMETRIC tm;
- GetTextMetrics(hdc, &tm);
- SelectObject(hdc, hObject);
- size = tm.tmAscent;
- }
- DeleteObject(hFont);
- }
- }
-
- // The "codepage 936" bit here is from Gecko; apparently this helps make
- // fonts more legible in Simplified Chinese where the default font size is
- // too small.
- //
- // FIXME: http://b/1119883 Since this is only used for "small caption",
- // "menu", and "status bar" objects, I'm not sure how much this even
- // matters. Plus the Gecko patch went in back in 2002, and maybe this
- // isn't even relevant anymore. We should investigate whether this should
- // be removed, or perhaps broadened to be "any CJK locale".
- //
- return ((size < 12.0f) && (GetACP() == 936)) ? 12.0f : size;
-}
-
-// static
-void RenderThemeChromiumFontProvider::systemFont(int propId, FontDescription& fontDescription)
-{
- // This logic owes much to RenderThemeSafari.cpp.
- FontDescription* cachedDesc = 0;
- AtomicString faceName;
- float fontSize = 0;
- switch (propId) {
- case CSSValueSmallCaption:
- cachedDesc = &smallSystemFont();
- if (!smallSystemFont().isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = AtomicString(metrics.lfSmCaptionFont.lfFaceName, wcslen(metrics.lfSmCaptionFont.lfFaceName));
- fontSize = systemFontSize(metrics.lfSmCaptionFont);
- }
- break;
- case CSSValueMenu:
- cachedDesc = &menuFont();
- if (!menuFont().isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = AtomicString(metrics.lfMenuFont.lfFaceName, wcslen(metrics.lfMenuFont.lfFaceName));
- fontSize = systemFontSize(metrics.lfMenuFont);
- }
- break;
- case CSSValueStatusBar:
- cachedDesc = &labelFont();
- if (!labelFont().isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = metrics.lfStatusFont.lfFaceName;
- fontSize = systemFontSize(metrics.lfStatusFont);
- }
- break;
- case CSSValueWebkitMiniControl:
- case CSSValueWebkitSmallControl:
- case CSSValueWebkitControl:
- faceName = defaultGUIFont();
- // Why 2 points smaller? Because that's what Gecko does.
- fontSize = s_defaultFontSize - pointsToPixels(2);
- break;
- default:
- faceName = defaultGUIFont();
- fontSize = s_defaultFontSize;
- break;
- }
-
- if (!cachedDesc)
- cachedDesc = &fontDescription;
-
- if (fontSize) {
- cachedDesc->firstFamily().setFamily(faceName);
- cachedDesc->setIsAbsoluteSize(true);
- cachedDesc->setGenericFamily(FontDescription::NoFamily);
- cachedDesc->setSpecifiedSize(fontSize);
- cachedDesc->setWeight(FontWeightNormal);
- cachedDesc->setItalic(false);
- }
- fontDescription = *cachedDesc;
-}
-
-// static
-void RenderThemeChromiumFontProvider::setDefaultFontSize(int fontSize)
-{
- s_defaultFontSize = static_cast<float>(fontSize);
-
- // Reset cached fonts.
- smallSystemFont() = menuFont() = labelFont() = FontDescription();
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * This file is part of the theme implementation for form controls in WebCore.
- *
- * Copyright (C) 2005 Apple Computer, Inc.
- * Copyright (C) 2008, 2009 Google, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RenderThemeChromiumMac_h
-#define RenderThemeChromiumMac_h
-
-#import "RenderThemeChromiumCommon.h"
-#import "RenderThemeMacShared.h"
-
-namespace WebCore {
-
-class RenderThemeChromiumMac : public RenderThemeMacShared {
-public:
- static PassRefPtr<RenderTheme> create();
-
- virtual bool supportsDataListUI(const AtomicString& type) const OVERRIDE;
-
-protected:
-#if ENABLE(VIDEO)
- virtual void adjustMediaSliderThumbSize(RenderStyle*) const;
- virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
- virtual String extraMediaControlsStyleSheet();
-#if ENABLE(FULLSCREEN_API)
- virtual String extraFullScreenStyleSheet();
-#endif
-
- virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const OVERRIDE;
- virtual bool usesMediaControlStatusDisplay() { return false; }
- virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
- virtual bool usesVerticalVolumeSlider() const { return false; }
- virtual String formatMediaControlsTime(float time) const;
- virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
- virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
- virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&);
-#endif
-
- virtual bool usesTestModeFocusRingColor() const;
- virtual NSView* documentViewFor(RenderObject*) const;
-
- virtual int popupInternalPaddingLeft(RenderStyle*) const;
- virtual int popupInternalPaddingRight(RenderStyle*) const;
-
-private:
- virtual Color disabledTextColor(const Color& textColor, const Color&) const OVERRIDE { return textColor; }
- virtual void updateActiveState(NSCell*, const RenderObject*);
- virtual String extraDefaultStyleSheet();
-#if ENABLE(DATALIST_ELEMENT)
- virtual LayoutUnit sliderTickSnappingThreshold() const OVERRIDE;
-#endif
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
- virtual bool supportsCalendarPicker(const AtomicString& type) const OVERRIDE;
-#endif
- virtual bool shouldShowPlaceholderWhenFocused() const OVERRIDE;
-};
-
-} // namespace WebCore
-
-#endif // RenderThemeChromiumMac_h
+++ /dev/null
-/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2009 Google, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#import "config.h"
-
-#import "LayoutTestSupport.h"
-#import "LocalCurrentGraphicsContext.h"
-#import "RenderThemeChromiumMac.h"
-#import "PaintInfo.h"
-#import "RenderMediaControlsChromium.h"
-#import "WebCoreSystemInterface.h"
-#import "UserAgentStyleSheets.h"
-#import <Carbon/Carbon.h>
-#import <Cocoa/Cocoa.h>
-#import <wtf/RetainPtr.h>
-#import <wtf/StdLibExtras.h>
-#import <math.h>
-
-@interface RTCMFlippedView : NSView
-{}
-
-- (BOOL)isFlipped;
-- (NSText *)currentEditor;
-
-@end
-
-@implementation RTCMFlippedView
-
-- (BOOL)isFlipped {
- return [[NSGraphicsContext currentContext] isFlipped];
-}
-
-- (NSText *)currentEditor {
- return nil;
-}
-
-@end
-
-namespace WebCore {
-
-NSView* FlippedView()
-{
- static NSView* view = [[RTCMFlippedView alloc] init];
- return view;
-}
-
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
-{
- static RenderTheme* rt = RenderThemeChromiumMac::create().leakRef();
- return rt;
-}
-
-PassRefPtr<RenderTheme> RenderThemeChromiumMac::create()
-{
- return adoptRef(new RenderThemeChromiumMac);
-}
-
-bool RenderThemeChromiumMac::supportsDataListUI(const AtomicString& type) const
-{
- return RenderThemeChromiumCommon::supportsDataListUI(type);
-}
-
-bool RenderThemeChromiumMac::usesTestModeFocusRingColor() const
-{
- return isRunningLayoutTest();
-}
-
-NSView* RenderThemeChromiumMac::documentViewFor(RenderObject*) const
-{
- return FlippedView();
-}
-
-const int autofillPopupHorizontalPadding = 4;
-
-// These functions are called with MenuListPart or MenulistButtonPart appearance by RenderMenuList, or with TextFieldPart appearance by AutofillPopupMenuClient.
-// We assume only AutofillPopupMenuClient gives TexfieldPart appearance here.
-// We want to change only Autofill padding.
-// In the future, we have to separate Autofill popup window logic from WebKit to Chromium.
-int RenderThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const
-{
- if (style->appearance() == TextFieldPart)
- return autofillPopupHorizontalPadding;
-
- return RenderThemeMacShared::popupInternalPaddingLeft(style);
-}
-
-int RenderThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const
-{
- if (style->appearance() == TextFieldPart)
- return autofillPopupHorizontalPadding;
-
- return RenderThemeMacShared::popupInternalPaddingRight(style);
-}
-
-// Updates the control tint (a.k.a. active state) of |cell| (from |o|).
-// In the Chromium port, the renderer runs as a background process and controls'
-// NSCell(s) lack a parent NSView. Therefore controls don't have their tint
-// color updated correctly when the application is activated/deactivated.
-// FocusController's setActive() is called when the application is
-// activated/deactivated, which causes a repaint at which time this code is
-// called.
-// This function should be called before drawing any NSCell-derived controls,
-// unless you're sure it isn't needed.
-void RenderThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject* o)
-{
- NSControlTint oldTint = [cell controlTint];
- NSControlTint tint = isActive(o) ? [NSColor currentControlTint] :
- static_cast<NSControlTint>(NSClearControlTint);
-
- if (tint != oldTint)
- [cell setControlTint:tint];
-}
-
-bool RenderThemeChromiumMac::shouldShowPlaceholderWhenFocused() const
-{
- return true;
-}
-
-#if ENABLE(VIDEO)
-
-void RenderThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) const
-{
- RenderMediaControlsChromium::adjustMediaSliderThumbSize(style);
-}
-
-bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect);
-}
-
-bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect);
-}
-
-bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
-}
-
-String RenderThemeChromiumMac::extraMediaControlsStyleSheet()
-{
- return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet));
-}
-
-#if ENABLE(FULLSCREEN_API)
-String RenderThemeChromiumMac::extraFullScreenStyleSheet()
-{
- // FIXME: Chromium may wish to style its default media controls differently in fullscreen.
- return String();
-}
-#endif
-
-String RenderThemeChromiumMac::extraDefaultStyleSheet()
-{
- return RenderThemeMacShared::extraDefaultStyleSheet() +
- String(themeChromiumUserAgentStyleSheet, sizeof(themeChromiumUserAgentStyleSheet));
-}
-
-#if ENABLE(DATALIST_ELEMENT)
-LayoutUnit RenderThemeChromiumMac::sliderTickSnappingThreshold() const
-{
- return RenderThemeChromiumCommon::sliderTickSnappingThreshold();
-}
-#endif
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) && ENABLE(CALENDAR_PICKER)
-bool RenderThemeChromiumMac::supportsCalendarPicker(const AtomicString& type) const
-{
- return RenderThemeChromiumCommon::supportsCalendarPicker(type);
-}
-#endif
-
-bool RenderThemeChromiumMac::paintMediaVolumeSliderContainer(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return true;
-}
-
-bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect);
-}
-
-bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect);
-}
-
-bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
-}
-
-IntPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
-{
- return RenderTheme::volumeSliderOffsetFromMuteButton(muteButtonBox, size);
-}
-
-String RenderThemeChromiumMac::formatMediaControlsTime(float time) const
-{
- return RenderMediaControlsChromium::formatMediaControlsTime(time);
-}
-
-String RenderThemeChromiumMac::formatMediaControlsCurrentTime(float currentTime, float duration) const
-{
- return RenderMediaControlsChromium::formatMediaControlsCurrentTime(currentTime, duration);
-}
-
-String RenderThemeChromiumMac::formatMediaControlsRemainingTime(float currentTime, float duration) const
-{
- return RenderThemeChromiumMac::formatMediaControlsRemainingTime(currentTime, duration);
-}
-
-bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscreenButton, object, paintInfo, rect);
-}
-
-bool RenderThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCaptionsButton, object, paintInfo, rect);
-}
-#endif
-
-} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (C) 2007 Apple Inc.
- * Copyright (C) 2007 Alp Toker <alp@atoker.com>
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2008, 2009 Google Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "RenderThemeChromiumSkia.h"
-
-#include "CSSValueKeywords.h"
-#include "Font.h"
-#include "GraphicsContext.h"
-#include "HTMLMediaElement.h"
-#include "HTMLNames.h"
-#include "Image.h"
-#include "LayoutTestSupport.h"
-#include "MediaControlElements.h"
-#include "PaintInfo.h"
-#include "PlatformContextSkia.h"
-#include "RenderBox.h"
-#include "RenderMediaControlsChromium.h"
-#include "RenderObject.h"
-#include "RenderProgress.h"
-#include "RenderSlider.h"
-#include "RenderThemeChromiumFontProvider.h"
-#include "ScrollbarTheme.h"
-#include "TimeRanges.h"
-#include "TransformationMatrix.h"
-#include "UserAgentStyleSheets.h"
-
-#include <wtf/CurrentTime.h>
-
-#include "SkShader.h"
-#include "SkGradientShader.h"
-
-namespace WebCore {
-
-enum PaddingType {
- TopPadding,
- RightPadding,
- BottomPadding,
- LeftPadding
-};
-
-static const int styledMenuListInternalPadding[4] = { 1, 4, 1, 4 };
-
-// These values all match Safari/Win.
-static const float defaultControlFontPixelSize = 13;
-static const float defaultCancelButtonSize = 9;
-static const float minCancelButtonSize = 5;
-static const float maxCancelButtonSize = 21;
-static const float defaultSearchFieldResultsDecorationSize = 13;
-static const float minSearchFieldResultsDecorationSize = 9;
-static const float maxSearchFieldResultsDecorationSize = 30;
-static const float defaultSearchFieldResultsButtonWidth = 18;
-
-RenderThemeChromiumSkia::RenderThemeChromiumSkia()
-{
-}
-
-RenderThemeChromiumSkia::~RenderThemeChromiumSkia()
-{
-}
-
-// Use the Windows style sheets to match their metrics.
-String RenderThemeChromiumSkia::extraDefaultStyleSheet()
-{
- return String(themeWinUserAgentStyleSheet, sizeof(themeWinUserAgentStyleSheet)) +
- String(themeChromiumSkiaUserAgentStyleSheet, sizeof(themeChromiumSkiaUserAgentStyleSheet)) +
- String(themeChromiumUserAgentStyleSheet, sizeof(themeChromiumUserAgentStyleSheet));
-}
-
-String RenderThemeChromiumSkia::extraQuirksStyleSheet()
-{
- return String(themeWinQuirksUserAgentStyleSheet, sizeof(themeWinQuirksUserAgentStyleSheet));
-}
-
-#if ENABLE(VIDEO)
-String RenderThemeChromiumSkia::extraMediaControlsStyleSheet()
-{
- return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet));
-}
-#endif
-
-bool RenderThemeChromiumSkia::supportsHover(const RenderStyle* style) const
-{
- return true;
-}
-
-bool RenderThemeChromiumSkia::supportsFocusRing(const RenderStyle* style) const
-{
- // This causes WebKit to draw the focus rings for us.
- return false;
-}
-
-bool RenderThemeChromiumSkia::supportsDataListUI(const AtomicString& type) const
-{
- return RenderThemeChromiumCommon::supportsDataListUI(type);
-}
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) && ENABLE(CALENDAR_PICKER)
-bool RenderThemeChromiumSkia::supportsCalendarPicker(const AtomicString& type) const
-{
- return RenderThemeChromiumCommon::supportsCalendarPicker(type);
-}
-#endif
-
-#if ENABLE(VIDEO_TRACK)
-bool RenderThemeChromiumSkia::supportsClosedCaptioning() const
-{
- return true;
-}
-#endif
-
-Color RenderThemeChromiumSkia::platformActiveSelectionBackgroundColor() const
-{
- return Color(0x1e, 0x90, 0xff);
-}
-
-Color RenderThemeChromiumSkia::platformInactiveSelectionBackgroundColor() const
-{
- return Color(0xc8, 0xc8, 0xc8);
-}
-
-Color RenderThemeChromiumSkia::platformActiveSelectionForegroundColor() const
-{
- return Color::black;
-}
-
-Color RenderThemeChromiumSkia::platformInactiveSelectionForegroundColor() const
-{
- return Color(0x32, 0x32, 0x32);
-}
-
-Color RenderThemeChromiumSkia::platformFocusRingColor() const
-{
- static Color focusRingColor(229, 151, 0, 255);
- return focusRingColor;
-}
-
-double RenderThemeChromiumSkia::caretBlinkInterval() const
-{
- // Disable the blinking caret in layout test mode, as it introduces
- // a race condition for the pixel tests. http://b/1198440
- if (isRunningLayoutTest())
- return 0;
-
- return caretBlinkIntervalInternal();
-}
-
-void RenderThemeChromiumSkia::systemFont(int propId, FontDescription& fontDescription) const
-{
- RenderThemeChromiumFontProvider::systemFont(propId, fontDescription);
-}
-
-int RenderThemeChromiumSkia::minimumMenuListSize(RenderStyle* style) const
-{
- return 0;
-}
-
-// These are the default dimensions of radio buttons and checkboxes.
-static const int widgetStandardWidth = 13;
-static const int widgetStandardHeight = 13;
-
-// Return a rectangle that has the same center point as |original|, but with a
-// size capped at |width| by |height|.
-IntRect center(const IntRect& original, int width, int height)
-{
- width = std::min(original.width(), width);
- height = std::min(original.height(), height);
- int x = original.x() + (original.width() - width) / 2;
- int y = original.y() + (original.height() - height) / 2;
-
- return IntRect(x, y, width, height);
-}
-
-void RenderThemeChromiumSkia::setCheckboxSize(RenderStyle* style) const
-{
- // If the width and height are both specified, then we have nothing to do.
- if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
- return;
-
- // FIXME: A hard-coded size of 13 is used. This is wrong but necessary
- // for now. It matches Firefox. 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(widgetStandardWidth, widgetStandardHeight);
- setSizeIfAuto(style, size);
-}
-
-void RenderThemeChromiumSkia::setRadioSize(RenderStyle* style) const
-{
- // Use same sizing for radio box as checkbox.
- setCheckboxSize(style);
-}
-
-void RenderThemeChromiumSkia::adjustButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- if (style->appearance() == PushButtonPart) {
- // Ignore line-height.
- style->setLineHeight(RenderStyle::initialLineHeight());
- }
-}
-
-bool RenderThemeChromiumSkia::paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- return paintTextField(o, i, r);
-}
-
-void RenderThemeChromiumSkia::adjustSearchFieldStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- // Ignore line-height.
- style->setLineHeight(RenderStyle::initialLineHeight());
-}
-
-bool RenderThemeChromiumSkia::paintSearchField(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- return paintTextField(o, i, r);
-}
-
-void RenderThemeChromiumSkia::adjustSearchFieldCancelButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- // Scale the button size based on the font size
- float fontScale = style->fontSize() / defaultControlFontPixelSize;
- int cancelButtonSize = lroundf(std::min(std::max(minCancelButtonSize, defaultCancelButtonSize * fontScale), maxCancelButtonSize));
- style->setWidth(Length(cancelButtonSize, Fixed));
- style->setHeight(Length(cancelButtonSize, Fixed));
-}
-
-IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const
-{
- // Compute an offset between the part renderer and the input renderer.
- LayoutSize offsetFromInputRenderer = -partRenderer->offsetFromAncestorContainer(inputRenderer);
- // Move the rect into partRenderer's coords.
- partRect.move(offsetFromInputRenderer);
- // Account for the local drawing offset.
- partRect.move(localOffset.x(), localOffset.y());
-
- return pixelSnappedIntRect(partRect);
-}
-
-bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelButtonObject, const PaintInfo& paintInfo, const IntRect& r)
-{
- // Get the renderer of <input> element.
- Node* input = cancelButtonObject->node()->shadowHost();
- RenderObject* baseRenderer = input ? input->renderer() : cancelButtonObject;
- if (!baseRenderer->isBox())
- return false;
- RenderBox* inputRenderBox = toRenderBox(baseRenderer);
- LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
-
- // Make sure the scaled button stays square and will fit in its parent's box.
- LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
- // Calculate cancel button's coordinates relative to the input element.
- // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will
- // be one pixel closer to the bottom of the field. This tends to look better with the text.
- LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
- cancelButtonSize, cancelButtonSize);
- IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r);
-
- static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef();
- static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelPressed").leakRef();
- paintInfo.context->drawImage(isPressed(cancelButtonObject) ? cancelPressedImage : cancelImage,
- cancelButtonObject->style()->colorSpace(), paintingRect);
- return false;
-}
-
-void RenderThemeChromiumSkia::adjustSearchFieldDecorationStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- IntSize emptySize(1, 11);
- style->setWidth(Length(emptySize.width(), Fixed));
- style->setHeight(Length(emptySize.height(), Fixed));
-}
-
-void RenderThemeChromiumSkia::adjustSearchFieldResultsDecorationStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- // Scale the decoration size based on the font size
- float fontScale = style->fontSize() / defaultControlFontPixelSize;
- int magnifierSize = lroundf(std::min(std::max(minSearchFieldResultsDecorationSize, defaultSearchFieldResultsDecorationSize * fontScale),
- maxSearchFieldResultsDecorationSize));
- style->setWidth(Length(magnifierSize, Fixed));
- style->setHeight(Length(magnifierSize, Fixed));
-}
-
-bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* magnifierObject, const PaintInfo& paintInfo, const IntRect& r)
-{
- // Get the renderer of <input> element.
- Node* input = magnifierObject->node()->shadowHost();
- RenderObject* baseRenderer = input ? input->renderer() : magnifierObject;
- if (!baseRenderer->isBox())
- return false;
- RenderBox* inputRenderBox = toRenderBox(baseRenderer);
- LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
-
- // Make sure the scaled decoration stays square and will fit in its parent's box.
- LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height()));
- // Calculate decoration's coordinates relative to the input element.
- // Center the decoration vertically. Round up though, so if it has to be one pixel off-center, it will
- // be one pixel closer to the bottom of the field. This tends to look better with the text.
- LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
- magnifierSize, magnifierSize);
- IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
-
- static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef();
- paintInfo.context->drawImage(magnifierImage, magnifierObject->style()->colorSpace(), paintingRect);
- return false;
-}
-
-void RenderThemeChromiumSkia::adjustSearchFieldResultsButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- // Scale the button size based on the font size
- float fontScale = style->fontSize() / defaultControlFontPixelSize;
- int magnifierHeight = lroundf(std::min(std::max(minSearchFieldResultsDecorationSize, defaultSearchFieldResultsDecorationSize * fontScale),
- maxSearchFieldResultsDecorationSize));
- int magnifierWidth = lroundf(magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
- style->setWidth(Length(magnifierWidth, Fixed));
- style->setHeight(Length(magnifierHeight, Fixed));
-}
-
-bool RenderThemeChromiumSkia::paintSearchFieldResultsButton(RenderObject* magnifierObject, const PaintInfo& paintInfo, const IntRect& r)
-{
- // Get the renderer of <input> element.
- Node* input = magnifierObject->node()->shadowHost();
- RenderObject* baseRenderer = input ? input->renderer() : magnifierObject;
- if (!baseRenderer->isBox())
- return false;
- RenderBox* inputRenderBox = toRenderBox(baseRenderer);
- LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
-
- // Make sure the scaled decoration will fit in its parent's box.
- LayoutUnit magnifierHeight = std::min<LayoutUnit>(inputContentBox.height(), r.height());
- LayoutUnit magnifierWidth = std::min<LayoutUnit>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
- LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
- inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
- magnifierWidth, magnifierHeight);
- IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
-
- static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef();
- paintInfo.context->drawImage(magnifierImage, magnifierObject->style()->colorSpace(), paintingRect);
- return false;
-}
-
-bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderStyle* style, Element*) const
-{
-#if ENABLE(VIDEO)
- RenderMediaControlsChromium::adjustMediaSliderThumbSize(style);
-#else
- UNUSED_PARAM(style);
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaToggleClosedCaptionsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
-{
-#if ENABLE(VIDEO_TRACK)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCaptionsButton, o, paintInfo, r);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-String RenderThemeChromiumSkia::formatMediaControlsTime(float time) const
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::formatMediaControlsTime(time);
-#else
- UNUSED_PARAM(time);
- return 0;
-#endif
-}
-
-String RenderThemeChromiumSkia::formatMediaControlsCurrentTime(float currentTime, float duration) const
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::formatMediaControlsCurrentTime(currentTime, duration);
-#else
- UNUSED_PARAM(currentTime);
- UNUSED_PARAM(duration);
- return 0;
-#endif
-}
-
-String RenderThemeChromiumSkia::formatMediaControlsRemainingTime(float currentTime, float duration) const
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::formatMediaControlsRemainingTime(currentTime, duration);
-#else
- UNUSED_PARAM(currentTime);
- UNUSED_PARAM(duration);
- return 0;
-#endif
-}
-
-bool RenderThemeChromiumSkia::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-#if ENABLE(VIDEO)
- return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscreenButton, object, paintInfo, rect);
-#else
- UNUSED_PARAM(object);
- UNUSED_PARAM(paintInfo);
- UNUSED_PARAM(rect);
- return false;
-#endif
-}
-
-void RenderThemeChromiumSkia::adjustMenuListStyle(StyleResolver*, RenderStyle* style, WebCore::Element*) const
-{
- // Height is locked to auto on all browsers.
- style->setLineHeight(RenderStyle::initialLineHeight());
-}
-
-void RenderThemeChromiumSkia::adjustMenuListButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e) const
-{
- adjustMenuListStyle(styleResolver, style, e);
-}
-
-// Used to paint styled menulists (i.e. with a non-default border)
-bool RenderThemeChromiumSkia::paintMenuListButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
-{
- return paintMenuList(o, i, rect);
-}
-
-int RenderThemeChromiumSkia::popupInternalPaddingLeft(RenderStyle* style) const
-{
- return menuListInternalPadding(style, LeftPadding);
-}
-
-int RenderThemeChromiumSkia::popupInternalPaddingRight(RenderStyle* style) const
-{
- return menuListInternalPadding(style, RightPadding);
-}
-
-int RenderThemeChromiumSkia::popupInternalPaddingTop(RenderStyle* style) const
-{
- return menuListInternalPadding(style, TopPadding);
-}
-
-int RenderThemeChromiumSkia::popupInternalPaddingBottom(RenderStyle* style) const
-{
- return menuListInternalPadding(style, BottomPadding);
-}
-
-// static
-void RenderThemeChromiumSkia::setDefaultFontSize(int fontSize)
-{
- RenderThemeChromiumFontProvider::setDefaultFontSize(fontSize);
-}
-
-double RenderThemeChromiumSkia::caretBlinkIntervalInternal() const
-{
- return RenderTheme::caretBlinkInterval();
-}
-
-int RenderThemeChromiumSkia::menuListArrowPadding() const
-{
- return ScrollbarTheme::theme()->scrollbarThickness();
-}
-
-// static
-void RenderThemeChromiumSkia::setSizeIfAuto(RenderStyle* style, const IntSize& size)
-{
- if (style->width().isIntrinsicOrAuto())
- style->setWidth(Length(size.width(), Fixed));
- if (style->height().isAuto())
- style->setHeight(Length(size.height(), Fixed));
-}
-
-int RenderThemeChromiumSkia::menuListInternalPadding(RenderStyle* style, int paddingType) const
-{
- // This internal padding is in addition to the user-supplied padding.
- // Matches the FF behavior.
- int padding = styledMenuListInternalPadding[paddingType];
-
- // Reserve the space for right arrow here. The rest of the padding is
- // set by adjustMenuListStyle, since PopMenuWin.cpp uses the padding from
- // RenderMenuList to lay out the individual items in the popup.
- // If the MenuList actually has appearance "NoAppearance", then that means
- // we don't draw a button, so don't reserve space for it.
- const int barType = style->direction() == LTR ? RightPadding : LeftPadding;
- if (paddingType == barType && style->appearance() != NoControlPart)
- padding += menuListArrowPadding();
-
- return padding;
-}
-
-bool RenderThemeChromiumSkia::shouldShowPlaceholderWhenFocused() const
-{
- return true;
-}
-
-#if ENABLE(DATALIST_ELEMENT)
-LayoutUnit RenderThemeChromiumSkia::sliderTickSnappingThreshold() const
-{
- return RenderThemeChromiumCommon::sliderTickSnappingThreshold();
-}
-#endif
-
-#if ENABLE(PROGRESS_ELEMENT)
-
-//
-// Following values are come from default of GTK+
-//
-static const int progressDeltaPixelsPerSecond = 100;
-static const int progressActivityBlocks = 5;
-static const int progressAnimationFrmaes = 10;
-static const double progressAnimationInterval = 0.125;
-
-IntRect RenderThemeChromiumSkia::determinateProgressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const
-{
- int dx = rect.width() * renderProgress->position();
- return IntRect(rect.x(), rect.y(), dx, rect.height());
-}
-
-IntRect RenderThemeChromiumSkia::indeterminateProgressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const
-{
-
- int valueWidth = rect.width() / progressActivityBlocks;
- int movableWidth = rect.width() - valueWidth;
- if (movableWidth <= 0)
- return IntRect();
-
- double progress = renderProgress->animationProgress();
- if (progress < 0.5)
- return IntRect(rect.x() + progress * 2 * movableWidth, rect.y(), valueWidth, rect.height());
- return IntRect(rect.x() + (1.0 - progress) * 2 * movableWidth, rect.y(), valueWidth, rect.height());
-}
-
-double RenderThemeChromiumSkia::animationRepeatIntervalForProgressBar(RenderProgress*) const
-{
- return progressAnimationInterval;
-}
-
-double RenderThemeChromiumSkia::animationDurationForProgressBar(RenderProgress* renderProgress) const
-{
- return progressAnimationInterval * progressAnimationFrmaes * 2; // "2" for back and forth
-}
-
-IntRect RenderThemeChromiumSkia::progressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const
-{
- return renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect);
-}
-
-RenderThemeChromiumSkia::DirectionFlippingScope::DirectionFlippingScope(RenderObject* renderer, const PaintInfo& paintInfo, const IntRect& rect)
- : m_needsFlipping(!renderer->style()->isLeftToRightDirection())
- , m_paintInfo(paintInfo)
-{
- if (!m_needsFlipping)
- return;
- m_paintInfo.context->save();
- m_paintInfo.context->translate(2 * rect.x() + rect.width(), 0);
- m_paintInfo.context->scale(FloatSize(-1, 1));
-}
-
-RenderThemeChromiumSkia::DirectionFlippingScope::~DirectionFlippingScope()
-{
- if (!m_needsFlipping)
- return;
- m_paintInfo.context->restore();
-}
-
-
-#endif
-
-} // namespace WebCore
+++ /dev/null
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * Copyright (C) 2007 Holger Hans Peter Freyther
- * Copyright (C) 2007 Alp Toker <alp@atoker.com>
- * Copyright (C) 2008, 2009 Google, Inc.
- * All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RenderThemeChromiumSkia_h
-#define RenderThemeChromiumSkia_h
-
-#include "RenderTheme.h"
-#include "RenderThemeChromiumCommon.h"
-
-namespace WebCore {
-
-class RenderProgress;
-
-class RenderThemeChromiumSkia : public RenderTheme {
-public:
- RenderThemeChromiumSkia();
- virtual ~RenderThemeChromiumSkia();
-
- virtual String extraDefaultStyleSheet();
- virtual String extraQuirksStyleSheet();
-#if ENABLE(VIDEO)
- virtual String extraMediaControlsStyleSheet();
-#endif
-
-#if ENABLE(TOUCH_EVENTS)
- virtual Color platformTapHighlightColor() const OVERRIDE
- {
- return Color(defaultTapHighlightColor);
- }
-#endif
-
- // A method asking if the theme's controls actually care about redrawing when hovered.
- virtual bool supportsHover(const RenderStyle*) const;
-
- // A method asking if the theme is able to draw the focus ring.
- virtual bool supportsFocusRing(const RenderStyle*) const;
-
- virtual bool supportsDataListUI(const AtomicString& type) const OVERRIDE;
-
-#if ENABLE(VIDEO_TRACK)
- virtual bool supportsClosedCaptioning() const OVERRIDE;
-#endif
- // The platform selection color.
- virtual Color platformActiveSelectionBackgroundColor() const;
- virtual Color platformInactiveSelectionBackgroundColor() const;
- virtual Color platformActiveSelectionForegroundColor() const;
- virtual Color platformInactiveSelectionForegroundColor() const;
- virtual Color platformFocusRingColor() const;
-
- // To change the blink interval, override caretBlinkIntervalInternal instead of this one so that we may share layout test code an intercepts.
- virtual double caretBlinkInterval() const;
-
- // System fonts.
- virtual void systemFont(int propId, FontDescription&) const;
-
- virtual int minimumMenuListSize(RenderStyle*) const;
-
- virtual void setCheckboxSize(RenderStyle*) const;
-
- virtual void setRadioSize(RenderStyle*) const;
-
- virtual void adjustButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
-
- virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustSearchFieldStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustSearchFieldCancelButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustSearchFieldDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
-
- virtual void adjustSearchFieldResultsDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustSearchFieldResultsButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
- virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual String formatMediaControlsTime(float time) const;
- virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
- virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
- virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
-
- // MenuList refers to an unstyled menulist (meaning a menulist without
- // background-color or border set) and MenuListButton refers to a styled
- // menulist (a menulist with background-color or border set). They have
- // this distinction to support showing aqua style themes whenever they
- // possibly can, which is something we don't want to replicate.
- //
- // In short, we either go down the MenuList code path or the MenuListButton
- // codepath. We never go down both. And in both cases, they render the
- // entire menulist.
- virtual void adjustMenuListStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
-
-#if ENABLE(PROGRESS_ELEMENT)
- virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
- virtual double animationDurationForProgressBar(RenderProgress*) const;
-#endif
-
- // These methods define the padding for the MenuList's inner block.
- virtual int popupInternalPaddingLeft(RenderStyle*) const;
- virtual int popupInternalPaddingRight(RenderStyle*) const;
- virtual int popupInternalPaddingTop(RenderStyle*) const;
- virtual int popupInternalPaddingBottom(RenderStyle*) const;
-
-#if ENABLE(VIDEO)
- // Media controls
- virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
- virtual bool usesVerticalVolumeSlider() const { return false; }
-#endif
-
- // Provide a way to pass the default font size from the Settings object
- // to the render theme. FIXME: http://b/1129186 A cleaner way would be
- // to remove the default font size from this object and have callers
- // that need the value to get it directly from the appropriate Settings
- // object.
- static void setDefaultFontSize(int);
-
-protected:
- virtual double caretBlinkIntervalInternal() const;
-
- virtual int menuListArrowPadding() const;
-
- static void setSizeIfAuto(RenderStyle*, const IntSize&);
-
-#if ENABLE(PROGRESS_ELEMENT)
- IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const;
- IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const;
- IntRect progressValueRectFor(RenderProgress*, const IntRect&) const;
-
- class DirectionFlippingScope {
- public:
- DirectionFlippingScope(RenderObject*, const PaintInfo&, const IntRect&);
- ~DirectionFlippingScope();
-
- private:
- bool m_needsFlipping;
- const PaintInfo& m_paintInfo;
- };
-#endif
-
-private:
- virtual Color disabledTextColor(const Color& textColor, const Color&) const OVERRIDE { return textColor; }
- virtual bool shouldShowPlaceholderWhenFocused() const OVERRIDE;
-
-#if ENABLE(DATALIST_ELEMENT)
- virtual LayoutUnit sliderTickSnappingThreshold() const OVERRIDE;
-#endif
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
- virtual bool supportsCalendarPicker(const AtomicString& type) const OVERRIDE;
-#endif
-
- int menuListInternalPadding(RenderStyle*, int paddingType) const;
- bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
- IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
-
- static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black.
-};
-
-} // namespace WebCore
-
-#endif // RenderThemeChromiumSkia_h
+++ /dev/null
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2008, 2009 Google, Inc.
- * Copyright (C) 2009 Kenneth Rohde Christiansen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "RenderThemeChromiumWin.h"
-
-#include <windows.h>
-#include <uxtheme.h>
-#include <vssym32.h>
-
-#include "CSSValueKeywords.h"
-#include "FontSelector.h"
-#include "FontUtilsChromiumWin.h"
-#include "GraphicsContext.h"
-#include "HTMLMediaElement.h"
-#include "HTMLNames.h"
-#include "LayoutTestSupport.h"
-#include "MediaControlElements.h"
-#include "PaintInfo.h"
-#include "PlatformContextSkia.h"
-#include "RenderBox.h"
-#include "RenderProgress.h"
-#include "RenderSlider.h"
-#include "RenderThemeChromiumCommon.h"
-#include "ScrollbarTheme.h"
-#include "SystemInfo.h"
-#include "TransparencyWin.h"
-#include <public/Platform.h>
-#include <public/WebColor.h>
-#include <public/WebRect.h>
-#include <public/win/WebThemeEngine.h>
-#include <wtf/CurrentTime.h>
-
-
-// FIXME: This dependency should eventually be removed.
-#include <skia/ext/skia_utils_win.h>
-
-namespace WebCore {
-
-// The standard width for the menu list drop-down button when run under
-// layout test mode. Use the value that's currently captured in most baselines.
-static const int kStandardMenuListButtonWidth = 17;
-
-namespace {
-// We must not create multiple ThemePainter instances.
-class ThemePainter {
-public:
- ThemePainter(GraphicsContext* context, const IntRect& r)
- {
-#ifndef NDEBUG
- ASSERT(!s_hasInstance);
- s_hasInstance = true;
-#endif
- TransparencyWin::TransformMode transformMode = getTransformMode(context->getCTM());
- m_helper.init(context, getLayerMode(context, transformMode), transformMode, r);
-
- if (!m_helper.context()) {
- // TransparencyWin doesn't have well-defined copy-ctor nor op=()
- // so we re-initialize it instead of assigning a fresh istance.
- // On the reinitialization, we fallback to use NoLayer mode.
- // Note that the original initialization failure can be caused by
- // a failure of an internal buffer allocation and NoLayer mode
- // does not have such buffer allocations.
- m_helper.~TransparencyWin();
- new (&m_helper) TransparencyWin();
- m_helper.init(context, TransparencyWin::NoLayer, transformMode, r);
- }
- }
-
- ~ThemePainter()
- {
- m_helper.composite();
-#ifndef NDEBUG
- s_hasInstance = false;
-#endif
- }
-
- GraphicsContext* context() { return m_helper.context(); }
- const IntRect& drawRect() { return m_helper.drawRect(); }
-
-private:
-
- static TransparencyWin::LayerMode getLayerMode(GraphicsContext* context, TransparencyWin::TransformMode transformMode)
- {
- if (context->platformContext()->isDrawingToImageBuffer()) // Might have transparent background.
- return TransparencyWin::WhiteLayer;
- if (context->platformContext()->canvas()->isDrawingToLayer()) // Needs antialiasing help.
- return TransparencyWin::OpaqueCompositeLayer;
- // Nothing interesting.
- return transformMode == TransparencyWin::KeepTransform ? TransparencyWin::NoLayer : TransparencyWin::OpaqueCompositeLayer;
- }
-
- static TransparencyWin::TransformMode getTransformMode(const AffineTransform& matrix)
- {
- if (matrix.b() || matrix.c()) // Skew.
- return TransparencyWin::Untransform;
- if (matrix.a() != 1.0 || matrix.d() != 1.0) // Scale.
- return TransparencyWin::ScaleTransform;
- // Nothing interesting.
- return TransparencyWin::KeepTransform;
- }
-
- TransparencyWin m_helper;
-#ifndef NDEBUG
- static bool s_hasInstance;
-#endif
-};
-
-#ifndef NDEBUG
-bool ThemePainter::s_hasInstance = false;
-#endif
-
-} // namespace
-
-// Internal static helper functions. We don't put them in an anonymous
-// namespace so they have easier access to the WebCore namespace.
-
-static bool supportsFocus(ControlPart appearance)
-{
- switch (appearance) {
- case SquareButtonPart:
- case PushButtonPart:
- case ButtonPart:
- case DefaultButtonPart:
- case SearchFieldPart:
- case TextFieldPart:
- case TextAreaPart:
- return true;
- }
- return false;
-}
-
-static double querySystemBlinkInterval(double defaultInterval)
-{
- UINT blinkTime = GetCaretBlinkTime();
- if (!blinkTime)
- return defaultInterval;
- if (blinkTime == INFINITE)
- return 0;
- return blinkTime / 1000.0;
-}
-
-PassRefPtr<RenderTheme> RenderThemeChromiumWin::create()
-{
- return adoptRef(new RenderThemeChromiumWin);
-}
-
-PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
-{
- static RenderTheme* rt = RenderThemeChromiumWin::create().leakRef();
- return rt;
-}
-
-bool RenderThemeChromiumWin::supportsFocusRing(const RenderStyle* style) const
-{
- // Let webkit draw one of its halo rings around any focused element,
- // except push buttons. For buttons we use the windows PBS_DEFAULTED
- // styling to give it a blue border.
- return style->appearance() == ButtonPart
- || style->appearance() == PushButtonPart
- || style->appearance() == SquareButtonPart;
-}
-
-Color RenderThemeChromiumWin::platformActiveSelectionBackgroundColor() const
-{
- if (isRunningLayoutTest())
- return Color(0x00, 0x00, 0xff); // Royal blue.
- COLORREF color = GetSysColor(COLOR_HIGHLIGHT);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff);
-}
-
-Color RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor() const
-{
- if (isRunningLayoutTest())
- return Color(0x99, 0x99, 0x99); // Medium gray.
- COLORREF color = GetSysColor(COLOR_GRAYTEXT);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff);
-}
-
-Color RenderThemeChromiumWin::platformActiveSelectionForegroundColor() const
-{
- if (isRunningLayoutTest())
- return Color(0xff, 0xff, 0xcc); // Pale yellow.
- COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff);
-}
-
-Color RenderThemeChromiumWin::platformInactiveSelectionForegroundColor() const
-{
- return Color::white;
-}
-
-Color RenderThemeChromiumWin::platformActiveTextSearchHighlightColor() const
-{
- return Color(0xff, 0x96, 0x32); // Orange.
-}
-
-Color RenderThemeChromiumWin::platformInactiveTextSearchHighlightColor() const
-{
- return Color(0xff, 0xff, 0x96); // Yellow.
-}
-
-// Map a CSSValue* system color to an index understood by GetSysColor().
-static int cssValueIdToSysColorIndex(int cssValueId)
-{
- switch (cssValueId) {
- case CSSValueActiveborder: return COLOR_ACTIVEBORDER;
- case CSSValueActivecaption: return COLOR_ACTIVECAPTION;
- case CSSValueAppworkspace: return COLOR_APPWORKSPACE;
- case CSSValueBackground: return COLOR_BACKGROUND;
- case CSSValueButtonface: return COLOR_BTNFACE;
- case CSSValueButtonhighlight: return COLOR_BTNHIGHLIGHT;
- case CSSValueButtonshadow: return COLOR_BTNSHADOW;
- case CSSValueButtontext: return COLOR_BTNTEXT;
- case CSSValueCaptiontext: return COLOR_CAPTIONTEXT;
- case CSSValueGraytext: return COLOR_GRAYTEXT;
- case CSSValueHighlight: return COLOR_HIGHLIGHT;
- case CSSValueHighlighttext: return COLOR_HIGHLIGHTTEXT;
- case CSSValueInactiveborder: return COLOR_INACTIVEBORDER;
- case CSSValueInactivecaption: return COLOR_INACTIVECAPTION;
- case CSSValueInactivecaptiontext: return COLOR_INACTIVECAPTIONTEXT;
- case CSSValueInfobackground: return COLOR_INFOBK;
- case CSSValueInfotext: return COLOR_INFOTEXT;
- case CSSValueMenu: return COLOR_MENU;
- case CSSValueMenutext: return COLOR_MENUTEXT;
- case CSSValueScrollbar: return COLOR_SCROLLBAR;
- case CSSValueThreeddarkshadow: return COLOR_3DDKSHADOW;
- case CSSValueThreedface: return COLOR_3DFACE;
- case CSSValueThreedhighlight: return COLOR_3DHIGHLIGHT;
- case CSSValueThreedlightshadow: return COLOR_3DLIGHT;
- case CSSValueThreedshadow: return COLOR_3DSHADOW;
- case CSSValueWindow: return COLOR_WINDOW;
- case CSSValueWindowframe: return COLOR_WINDOWFRAME;
- case CSSValueWindowtext: return COLOR_WINDOWTEXT;
- default: return -1; // Unsupported CSSValue
- }
-}
-
-Color RenderThemeChromiumWin::systemColor(int cssValueId) const
-{
- int sysColorIndex = cssValueIdToSysColorIndex(cssValueId);
- if (isRunningLayoutTest() || (sysColorIndex == -1))
- return RenderTheme::systemColor(cssValueId);
-
- COLORREF color = GetSysColor(sysColorIndex);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color));
-}
-
-#if ENABLE(DATALIST_ELEMENT)
-IntSize RenderThemeChromiumWin::sliderTickSize() const
-{
- return IntSize(1, 3);
-}
-
-int RenderThemeChromiumWin::sliderTickOffsetFromTrackCenter() const
-{
- return 11;
-}
-#endif
-
-void RenderThemeChromiumWin::adjustSliderThumbSize(RenderStyle* style, Element* element) const
-{
- // These sizes match what WinXP draws for various menus.
- const int sliderThumbAlongAxis = 11;
- const int sliderThumbAcrossAxis = 21;
- if (style->appearance() == SliderThumbHorizontalPart) {
- style->setWidth(Length(sliderThumbAlongAxis, Fixed));
- style->setHeight(Length(sliderThumbAcrossAxis, Fixed));
- } else if (style->appearance() == SliderThumbVerticalPart) {
- style->setWidth(Length(sliderThumbAcrossAxis, Fixed));
- style->setHeight(Length(sliderThumbAlongAxis, Fixed));
- } else
- RenderThemeChromiumSkia::adjustSliderThumbSize(style, element);
-}
-
-bool RenderThemeChromiumWin::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- return paintButton(o, i, r);
-}
-bool RenderThemeChromiumWin::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- return paintButton(o, i, r);
-}
-
-bool RenderThemeChromiumWin::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- const ThemeData& themeData = getThemeData(o);
-
- ThemePainter painter(i.context, r);
- WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintButton(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()));
- return false;
-}
-
-bool RenderThemeChromiumWin::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- return paintTextFieldInternal(o, i, r, true);
-}
-
-bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- const ThemeData& themeData = getThemeData(o);
-
- ThemePainter painter(i.context, r);
- WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintTrackbar(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()));
-
-#if ENABLE(DATALIST_ELEMENT)
- paintSliderTicks(o, i, r);
-#endif
-
- return false;
-}
-
-bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- const ThemeData& themeData = getThemeData(o);
-
- ThemePainter painter(i.context, r);
- WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintTrackbar(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()));
-
- return false;
-}
-
-static int menuListButtonWidth()
-{
- static int width = isRunningLayoutTest() ? kStandardMenuListButtonWidth :
- IntSize(WebKit::Platform::current()->themeEngine()->getSize(SBP_ARROWBTN)).width();
- return width;
-}
-
-// Used to paint unstyled menulists (i.e. with the default border)
-bool RenderThemeChromiumWin::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- if (!o->isBox())
- return false;
-
- const RenderBox* box = toRenderBox(o);
- int borderRight = box->borderRight();
- int borderLeft = box->borderLeft();
- int borderTop = box->borderTop();
- int borderBottom = box->borderBottom();
-
- // If all the borders are 0, then tell skia not to paint the border on the
- // textfield. FIXME: http://b/1210017 Figure out how to get Windows to not
- // draw individual borders and then pass that to skia so we can avoid
- // drawing any borders that are set to 0. For non-zero borders, we draw the
- // border, but webkit just draws over it.
- bool drawEdges = !(!borderRight && !borderLeft && !borderTop && !borderBottom);
-
- paintTextFieldInternal(o, i, r, drawEdges);
-
- // Take padding and border into account. 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 = menuListButtonWidth();
- int spacingLeft = borderLeft + box->paddingLeft();
- int spacingRight = borderRight + box->paddingRight();
- int spacingTop = borderTop + box->paddingTop();
- int spacingBottom = borderBottom + box->paddingBottom();
-
- int buttonX;
- if (r.maxX() - r.x() < buttonWidth)
- buttonX = r.x();
- else
- buttonX = o->style()->direction() == LTR ? r.maxX() - spacingRight - buttonWidth : r.x() + spacingLeft;
-
- // Compute the rectangle of the button in the destination image.
- IntRect rect(buttonX,
- r.y() + spacingTop,
- std::min(buttonWidth, r.maxX() - r.x()),
- r.height() - (spacingTop + spacingBottom));
-
- // Get the correct theme data for a textfield and paint the menu.
- ThemePainter painter(i.context, rect);
- WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintMenuList(canvas, CP_DROPDOWNBUTTON, determineState(o), determineClassicState(o), WebKit::WebRect(painter.drawRect()));
- return false;
-}
-
-double RenderThemeChromiumWin::caretBlinkIntervalInternal() const
-{
- // This involves a system call, so we cache the result.
- static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBlinkInterval());
- return blinkInterval;
-}
-
-unsigned RenderThemeChromiumWin::determineState(RenderObject* o, ControlSubPart subPart)
-{
- unsigned result = TS_NORMAL;
- ControlPart appearance = o->style()->appearance();
- if (!isEnabled(o))
- result = TS_DISABLED;
- else if (isReadOnlyControl(o))
- result = (appearance == TextFieldPart || appearance == TextAreaPart || appearance == SearchFieldPart) ? ETS_READONLY : TS_DISABLED;
- // Active overrides hover and focused.
- else if (isPressed(o) && (subPart == SpinButtonUp) == isSpinUpButtonPartPressed(o))
- result = TS_PRESSED;
- else if (supportsFocus(appearance) && isFocused(o))
- result = ETS_FOCUSED;
- else if (isHovered(o) && (subPart == SpinButtonUp) == isSpinUpButtonPartHovered(o))
- result = TS_HOT;
-
- // CBS_UNCHECKED*: 1-4
- // CBS_CHECKED*: 5-8
- // CBS_MIXED*: 9-12
- if (isIndeterminate(o))
- result += 8;
- else if (isChecked(o))
- result += 4;
- return result;
-}
-
-unsigned RenderThemeChromiumWin::determineSliderThumbState(RenderObject* o)
-{
- unsigned result = TUS_NORMAL;
- if (!isEnabled(o))
- result = TUS_DISABLED;
- else if (supportsFocus(o->style()->appearance()) && isFocused(o))
- result = TUS_FOCUSED;
- else if (isPressed(o))
- result = TUS_PRESSED;
- else if (isHovered(o))
- result = TUS_HOT;
- return result;
-}
-
-unsigned RenderThemeChromiumWin::determineClassicState(RenderObject* o, ControlSubPart subPart)
-{
- unsigned result = 0;
-
- ControlPart part = o->style()->appearance();
-
- // Sliders are always in the normal state.
- if (part == SliderHorizontalPart || part == SliderVerticalPart)
- return result;
-
- // So are readonly text fields.
- if (isReadOnlyControl(o) && (part == TextFieldPart || part == TextAreaPart || part == SearchFieldPart))
- return result;
-
- if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart) {
- if (!isEnabled(o))
- result = DFCS_INACTIVE;
- else if (isPressed(o)) // Active supersedes hover
- result = DFCS_PUSHED;
- else if (isHovered(o))
- result = DFCS_HOT;
- } else {
- if (!isEnabled(o) || isReadOnlyControl(o))
- result = DFCS_INACTIVE;
- // Active supersedes hover
- else if (isPressed(o) && (subPart == SpinButtonUp) == isSpinUpButtonPartPressed(o))
- result = DFCS_PUSHED;
- else if (supportsFocus(part) && isFocused(o)) // So does focused
- result = 0;
- else if (isHovered(o) && (subPart == SpinButtonUp) == isSpinUpButtonPartHovered(o))
- result = DFCS_HOT;
- // Classic theme can't represent indeterminate states. Use unchecked appearance.
- if (isChecked(o) && !isIndeterminate(o))
- result |= DFCS_CHECKED;
- }
- return result;
-}
-
-ThemeData RenderThemeChromiumWin::getThemeData(RenderObject* o, ControlSubPart subPart)
-{
- ThemeData result;
- switch (o->style()->appearance()) {
- case CheckboxPart:
- result.m_part = BP_CHECKBOX;
- result.m_state = determineState(o);
- result.m_classicState = DFCS_BUTTONCHECK;
- break;
- case RadioPart:
- result.m_part = BP_RADIOBUTTON;
- result.m_state = determineState(o);
- result.m_classicState = DFCS_BUTTONRADIO;
- break;
- case SquareButtonPart:
- case PushButtonPart:
- case ButtonPart:
- result.m_part = BP_PUSHBUTTON;
- result.m_state = determineState(o);
- result.m_classicState = DFCS_BUTTONPUSH;
- break;
- case SliderHorizontalPart:
- result.m_part = TKP_TRACK;
- result.m_state = TRS_NORMAL;
- break;
- case SliderVerticalPart:
- result.m_part = TKP_TRACKVERT;
- result.m_state = TRVS_NORMAL;
- break;
- case SliderThumbHorizontalPart:
- result.m_part = TKP_THUMBBOTTOM;
- result.m_state = determineSliderThumbState(o);
- break;
- case SliderThumbVerticalPart:
- result.m_part = TKP_THUMBVERT;
- result.m_state = determineSliderThumbState(o);
- break;
- case ListboxPart:
- case MenulistPart:
- case MenulistButtonPart:
- case SearchFieldPart:
- case TextFieldPart:
- case TextAreaPart:
- result.m_part = EP_EDITTEXT;
- result.m_state = determineState(o);
- break;
- case InnerSpinButtonPart:
- result.m_part = subPart == SpinButtonUp ? SPNP_UP : SPNP_DOWN;
- result.m_state = determineState(o, subPart);
- result.m_classicState = subPart == SpinButtonUp ? DFCS_SCROLLUP : DFCS_SCROLLDOWN;
- break;
- }
-
- result.m_classicState |= determineClassicState(o, subPart);
-
- return result;
-}
-
-bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o,
- const PaintInfo& i,
- const IntRect& r,
- bool drawEdges)
-{
- // Fallback to white if the specified color object is invalid.
- Color backgroundColor(Color::white);
- if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
- backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
-
- // If we have background-image, don't fill the content area to expose the
- // parent's background. Also, we shouldn't fill the content area if the
- // alpha of the color is 0. The API of Windows GDI ignores the alpha.
- //
- // Note that we should paint the content area white if we have neither the
- // background color nor background image explicitly specified to keep the
- // appearance of select element consistent with other browsers.
- bool fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha();
-
- if (o->style()->hasBorderRadius()) {
- // If the style has rounded borders, setup the context to clip the
- // background (themed or filled) appropriately.
- // FIXME: make sure we do the right thing if css background-clip is set.
- i.context->save();
- i.context->clipRoundedRect(o->style()->getRoundedBorderFor(r));
- }
- {
- const ThemeData& themeData = getThemeData(o);
- ThemePainter painter(i.context, r);
- WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintTextField(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()), backgroundColor.rgb(), fillContentArea, drawEdges);
- // End of block commits the painter before restoring context.
- }
- if (o->style()->hasBorderRadius())
- i.context->restore();
- return false;
-}
-
-void RenderThemeChromiumWin::adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- int width = ScrollbarTheme::theme()->scrollbarThickness();
- style->setWidth(Length(width, Fixed));
- style->setMinWidth(Length(width, Fixed));
-}
-
-bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
-{
- IntRect half = rect;
-
- // Need explicit blocks to avoid to create multiple ThemePainter instances.
- {
- half.setHeight(rect.height() / 2);
- const ThemeData& upThemeData = getThemeData(object, SpinButtonUp);
- ThemePainter upPainter(info.context, half);
- WebKit::WebCanvas* canvas = upPainter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintSpinButton(canvas, upThemeData.m_part, upThemeData.m_state, upThemeData.m_classicState, WebKit::WebRect(upPainter.drawRect()));
- }
-
- {
- half.setY(rect.y() + rect.height() / 2);
- const ThemeData& downThemeData = getThemeData(object, SpinButtonDown);
- ThemePainter downPainter(info.context, half);
- WebKit::WebCanvas* canvas = downPainter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintSpinButton(canvas, downThemeData.m_part, downThemeData.m_state, downThemeData.m_classicState, WebKit::WebRect(downPainter.drawRect()));
- }
- return false;
-}
-
-#if ENABLE(PROGRESS_ELEMENT)
-
-// MSDN says that update intervals for the bar is 30ms.
-// http://msdn.microsoft.com/en-us/library/bb760842(v=VS.85).aspx
-static const double progressAnimationFrameRate = 0.033;
-
-double RenderThemeChromiumWin::animationRepeatIntervalForProgressBar(RenderProgress*) const
-{
- return progressAnimationFrameRate;
-}
-
-double RenderThemeChromiumWin::animationDurationForProgressBar(RenderProgress* renderProgress) const
-{
- // On Chromium Windows port, animationProgress() and associated values aren't used.
- // So here we can return arbitrary positive value.
- return progressAnimationFrameRate;
-}
-
-void RenderThemeChromiumWin::adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const
-{
-}
-
-bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- if (!o->isProgress())
- return true;
-
- RenderProgress* renderProgress = toRenderProgress(o);
- // For indeterminate bar, valueRect is ignored and it is computed by the theme engine
- // because the animation is a platform detail and WebKit doesn't need to know how.
- IntRect valueRect = renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, r) : IntRect(0, 0, 0, 0);
- double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0;
- ThemePainter painter(i.context, r);
- DirectionFlippingScope scope(o, i, r);
- WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
- WebKit::Platform::current()->themeEngine()->paintProgressBar(canvas, WebKit::WebRect(r), WebKit::WebRect(valueRect), renderProgress->isDeterminate(), animatedSeconds);
- return false;
-}
-
-#endif
-
-bool RenderThemeChromiumWin::shouldOpenPickerWithF4Key() const
-{
- return true;
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2008, 2009 Google, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RenderThemeChromiumWin_h
-#define RenderThemeChromiumWin_h
-
-#include "RenderThemeChromiumSkia.h"
-
-#if WIN32
-typedef void* HANDLE;
-typedef struct HINSTANCE__* HINSTANCE;
-typedef HINSTANCE HMODULE;
-#endif
-
-namespace WebCore {
-
-struct ThemeData {
- ThemeData() : m_part(0), m_state(0), m_classicState(0) { }
-
- unsigned m_part;
- unsigned m_state;
- unsigned m_classicState;
-};
-
-class RenderThemeChromiumWin : public RenderThemeChromiumSkia {
-public:
- static PassRefPtr<RenderTheme> create();
-
- // A method asking if the theme is able to draw the focus ring.
- virtual bool supportsFocusRing(const RenderStyle*) const OVERRIDE;
-
- // The platform selection color.
- virtual Color platformActiveSelectionBackgroundColor() const OVERRIDE;
- virtual Color platformInactiveSelectionBackgroundColor() const OVERRIDE;
- virtual Color platformActiveSelectionForegroundColor() const OVERRIDE;
- virtual Color platformInactiveSelectionForegroundColor() const OVERRIDE;
- virtual Color platformActiveTextSearchHighlightColor() const OVERRIDE;
- virtual Color platformInactiveTextSearchHighlightColor() const OVERRIDE;
-
- virtual Color systemColor(int cssValueId) const OVERRIDE;
-
-#if ENABLE(DATALIST_ELEMENT)
- virtual IntSize sliderTickSize() const OVERRIDE;
- virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE;
-#endif
- virtual void adjustSliderThumbSize(RenderStyle*, Element*) const OVERRIDE;
-
- // Various paint functions.
- virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
- virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
- virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
- virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
- virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
- virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
-
- // MenuList refers to an unstyled menulist (meaning a menulist without
- // background-color or border set) and MenuListButton refers to a styled
- // menulist (a menulist with background-color or border set). They have
- // this distinction to support showing aqua style themes whenever they
- // possibly can, which is something we don't want to replicate.
- //
- // In short, we either go down the MenuList code path or the MenuListButton
- // codepath. We never go down both. And in both cases, they render the
- // entire menulist.
- virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
-
- virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const OVERRIDE;
- virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
-
-#if ENABLE(PROGRESS_ELEMENT)
- virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const OVERRIDE;
- virtual double animationDurationForProgressBar(RenderProgress*) const OVERRIDE;
- virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const OVERRIDE;
- virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
-#endif
-
- virtual bool shouldOpenPickerWithF4Key() const OVERRIDE;
-
-protected:
- virtual double caretBlinkIntervalInternal() const OVERRIDE;
-
-private:
- enum ControlSubPart {
- None,
- SpinButtonDown,
- SpinButtonUp,
- };
-
- RenderThemeChromiumWin() { }
- virtual ~RenderThemeChromiumWin() { }
-
- unsigned determineState(RenderObject*, ControlSubPart = None);
- unsigned determineSliderThumbState(RenderObject*);
- unsigned determineClassicState(RenderObject*, ControlSubPart = None);
-
- ThemeData getThemeData(RenderObject*, ControlSubPart = None);
-
- bool paintTextFieldInternal(RenderObject*, const PaintInfo&, const IntRect&, bool);
-};
-
-} // namespace WebCore
-
-#endif
paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
}
-#if PLATFORM(CHROMIUM)
- paintInfo.context->translate(0, unzoomedRect.y());
- paintInfo.context->scale(FloatSize(1, -1));
- paintInfo.context->translate(0, -(unzoomedRect.y() + unzoomedRect.height()));
-#endif
-
[sliderThumbCell drawInteriorWithFrame:unzoomedRect inView:documentViewFor(o)];
[sliderThumbCell setControlView:nil];