Diff
Modified: trunk/Source/WebCore/ChangeLog (115763 => 115764)
--- trunk/Source/WebCore/ChangeLog 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/ChangeLog 2012-05-02 00:12:49 UTC (rev 115764)
@@ -1,3 +1,36 @@
+2012-05-01 Kent Tamura <[email protected]>
+
+ Calendar Picker: Add capability to add platform-specific style sheet
+ https://bugs.webkit.org/show_bug.cgi?id=85272
+
+ Reviewed by Kentaro Hara.
+
+ Add RenderTheme::extraCalendarPickerStyleSheet(). The resultant string
+ of the function is inserted into the calendar picker page.
+
+ No new tests. Calendar picker apperance is not testable yet.
+
+ * Resources/calendarPicker.css: Removed styles for year-month buttons.
+ * Resources/calendarPickerMac.css:
+ Moved from calendarPicker.css, and adjust styles so that they look
+ standard Lion buttons.
+ (.year-month-button):
+ (.year-month-button:active):
+ (.year-month-button:disabled):
+ * WebCore.gyp/WebCore.gyp: Add a rule to produce CalendarPickerMac.{cpp,h}.
+ * html/shadow/CalendarPickerElement.cpp:
+ (WebCore::CalendarPickerElement::writeDocument):
+ Add extraCalendarPickerStyleSheet() result to the document.
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::extraCalendarPickerStyleSheet):
+ Added. Returns an empty CString by default.
+ * rendering/RenderTheme.h:
+ (RenderTheme): Added extraCalendarPickerStyleSheet().
+ * rendering/RenderThemeChromiumMac.h: Added extraCalendarPickerStyleSheet().
+ * rendering/RenderThemeChromiumMac.mm:
+ (WebCore::RenderThemeChromiumMac::extraCalendarPickerStyleSheet):
+ Added. Returns the content of Resources/calendarPickerMac.css.
+
2012-05-01 James Simonsen <[email protected]>
Ensure HTMLElementStack fails gracefully if it has a non-Element.
Modified: trunk/Source/WebCore/Resources/calendarPicker.css (115763 => 115764)
--- trunk/Source/WebCore/Resources/calendarPicker.css 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/Resources/calendarPicker.css 2012-05-02 00:12:49 UTC (rev 115764)
@@ -96,34 +96,6 @@
width: 100%;
}
-/* FIXME: We'd like to use the standard button appearance for non-Mac. */
-.year-month-button {
- -webkit-appearance: none;
- background: -webkit-gradient(linear, left top, left bottom, from(#eee), color-stop(0.4, #fff), color-stop(0.6, #dddddd), to(#eee));
- border: solid 1px #444;
- border-radius: 3px;
- box-shadow: inset 1px 1px 1px rgba(255,255,255,0.4), inset -1px -1px 1px rgba(255,255,255,0.4);
- padding-left: 3px;
- padding-right: 3px;
-}
-
-.year-month-button:hover {
- background: -webkit-gradient(linear, left top, left bottom, from(#e0f0ff), color-stop(0.4, #e0f0ff), color-stop(0.6, #b0e0ff), to(#b0e0ff));
- border: solid 1px #448;
-}
-
-.year-month-button:active {
- border: solid 1px black;
- box-shadow: inset 1px 1px 1px rgba(0,0,0,0.3), inset -1px -1px 1px rgba(0,0,0,0.3);
-}
-
-.year-month-button:disabled {
- color: #888;
- background: -webkit-gradient(linear, left top, left bottom, from(#eee), color-stop(0.4, #fff), color-stop(0.6, #dddddd), to(#eee));
- border: solid 1px #ccc;
- box-shadow: inset 1px 1px 1px rgba(255,255,255,0.4), inset -1px -1px 1px rgba(255,255,255,0.4);
-}
-
.year-month-button-left {
display: inline-block;
}
Added: trunk/Source/WebCore/Resources/calendarPickerMac.css (0 => 115764)
--- trunk/Source/WebCore/Resources/calendarPickerMac.css (rev 0)
+++ trunk/Source/WebCore/Resources/calendarPickerMac.css 2012-05-02 00:12:49 UTC (rev 115764)
@@ -0,0 +1,49 @@
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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.
+ */
+
+.year-month-button {
+ -webkit-appearance: none;
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), color-stop(0.3, #fff), color-stop(0.35, #f7f7f7), color-stop(0.49, #f7f7f7), color-stop(0.5, #ededed), to(#ededed));
+ border: solid 1px #a6a6a6;
+ border-radius: 4px;
+ box-shadow: inset 1px 1px 1px rgba(255,255,255,0.4), inset -1px -1px 1px rgba(255,255,255,0.4);
+ padding-left: 3px;
+ padding-right: 3px;
+}
+
+.year-month-button:active {
+ background: -webkit-gradient(linear, left top, left bottom, from(#a3bfef), color-stop(0.49, #6ba3ef), color-stop(0.5, #4491ef), to(#a3d1ef));
+ border: solid 1px #4d4d50;
+}
+
+.year-month-button:disabled {
+ color: #888;
+ border: solid 1px #d1d1d1;
+}
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (115763 => 115764)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-05-02 00:12:49 UTC (rev 115764)
@@ -863,6 +863,24 @@
],
},
{
+ 'action_name': 'CalendarPickerMac',
+ 'inputs': [
+ '../Resources/calendarPickerMac.css',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPickerMac.h',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPickerMac.cpp',
+ ],
+ 'action': [
+ 'python',
+ '../make-file-arrays.py',
+ '--condition=ENABLE(CALENDAR_PICKER)',
+ '--out-h=<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPickerMac.h',
+ '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPickerMac.cpp',
+ '<@(_inputs)',
+ ],
+ },
+ {
'action_name': 'XLinkNames',
'inputs': [
'../dom/make_names.pl',
@@ -1145,6 +1163,9 @@
'include_dirs': [
'<(chromium_src_dir)/third_party/apple_webkit',
],
+ 'sources': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPickerMac.cpp',
+ ],
}],
['OS=="win"', {
'defines': [
Modified: trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp (115763 => 115764)
--- trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp 2012-05-02 00:12:49 UTC (rev 115764)
@@ -47,6 +47,7 @@
#include "LocalizedStrings.h"
#include "Page.h"
#include "RenderDetailsMarker.h"
+#include "RenderTheme.h"
#include <wtf/text/StringBuilder.h>
using namespace WTF::Unicode;
@@ -208,6 +209,11 @@
addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
writer.addData(calendarPickerCss, sizeof(calendarPickerCss));
+ if (document()->page()) {
+ CString extraStyle = document()->page()->theme()->extraCalendarPickerStyleSheet();
+ if (extraStyle.length())
+ writer.addData(extraStyle.data(), extraStyle.length());
+ }
addLiteral("</style></head><body><div id=main>Loading...</div><script>\n"
"window.dialogArguments = {\n", writer);
addProperty("min", minString, writer);
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (115763 => 115764)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2012-05-02 00:12:49 UTC (rev 115764)
@@ -613,6 +613,13 @@
return platformInactiveSelectionForegroundColor();
}
+#if ENABLE(CALENDAR_PICKER)
+CString RenderTheme::extraCalendarPickerStyleSheet()
+{
+ return CString();
+}
+#endif
+
LayoutUnit RenderTheme::baselinePosition(const RenderObject* o) const
{
if (!o->isBox())
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (115763 => 115764)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2012-05-02 00:12:49 UTC (rev 115764)
@@ -94,6 +94,9 @@
#if ENABLE(FULLSCREEN_API)
virtual String extraFullScreenStyleSheet() { return String(); };
#endif
+#if ENABLE(CALENDAR_PICKER)
+ virtual CString extraCalendarPickerStyleSheet();
+#endif
// A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
// position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumMac.h (115763 => 115764)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumMac.h 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumMac.h 2012-05-02 00:12:49 UTC (rev 115764)
@@ -67,6 +67,9 @@
virtual Color disabledTextColor(const Color& textColor, const Color&) const OVERRIDE { return textColor; }
virtual void updateActiveState(NSCell*, const RenderObject*);
virtual String extraDefaultStyleSheet();
+#if ENABLE(CALENDAR_PICKER)
+ virtual CString extraCalendarPickerStyleSheet() OVERRIDE;
+#endif
virtual bool shouldShowPlaceholderWhenFocused() const OVERRIDE;
};
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumMac.mm (115763 => 115764)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumMac.mm 2012-05-02 00:04:01 UTC (rev 115763)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumMac.mm 2012-05-02 00:12:49 UTC (rev 115764)
@@ -19,6 +19,8 @@
*/
#import "config.h"
+
+#import "CalendarPickerMac.h"
#import "LocalCurrentGraphicsContext.h"
#import "RenderThemeChromiumMac.h"
#import "PaintInfo.h"
@@ -195,6 +197,12 @@
String(themeChromiumUserAgentStyleSheet, sizeof(themeChromiumUserAgentStyleSheet));
}
+#if ENABLE(CALENDAR_PICKER)
+CString RenderThemeChromiumMac::extraCalendarPickerStyleSheet()
+{
+ return CString(calendarPickerMacCss, WTF_ARRAY_LENGTH(calendarPickerMacCss));
+}
+#endif
bool RenderThemeChromiumMac::paintMediaVolumeSliderContainer(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
{