+2012-08-14 Keishi Hattori <keishi@webkit.org>
+
+ Share common code between calendar picker and color suggestion picker
+ https://bugs.webkit.org/show_bug.cgi?id=93802
+
+ Reviewed by Kent Tamura.
+
+ * ManualTests/forms/calendar-picker.html:
+ * ManualTests/forms/color-suggestion-picker.html:
+
2012-08-14 Milian Wolff <milian.wolff@kdab.com>
[Qt] QtWebKit linking fails for QNX cross build
var frame = document.getElementsByTagName('iframe')[0];
var doc = frame.contentDocument;
doc.documentElement.innerHTML = '<head></head><body><div id=main>Loading...</div></body>';
+ var commonCssLink = doc.createElement('link');
+ commonCssLink.rel = 'stylesheet';
+ commonCssLink.href = '../../Source/WebCore/Resources/pagepopups/pickerCommon.css?' + (new Date()).getTime();
+ doc.head.appendChild(commonCssLink);
var link = doc.createElement('link');
link.rel = 'stylesheet';
link.href = '../../Source/WebCore/Resources/pagepopups/calendarPicker.css?' + (new Date()).getTime();
doc.head.appendChild(link);
+ var commonJsScript = doc.createElement('script');
+ commonJsScript.src = '../../Source/WebCore/Resources/pagepopups/pickerCommon.js?' + (new Date()).getTime();
+ doc.body.appendChild(commonJsScript);
var script = doc.createElement('script');
script.src = '../../Source/WebCore/Resources/pagepopups/calendarPicker.js?' + (new Date()).getTime();
doc.body.appendChild(script);
var frame = document.getElementsByTagName('iframe')[0];
var doc = frame.contentDocument;
doc.documentElement.innerHTML = '<head></head><body><div id=main>Loading...</div></body>';
+ var commonCssLink = doc.createElement('link');
+ commonCssLink.rel = 'stylesheet';
+ commonCssLink.href = '../../Source/WebCore/Resources/pagepopups/pickerCommon.css?' + (new Date()).getTime();
+ doc.head.appendChild(commonCssLink);
var link = doc.createElement('link');
link.rel = 'stylesheet';
link.href = '../../Source/WebCore/Resources/pagepopups/colorSuggestionPicker.css?' + (new Date()).getTime();
doc.head.appendChild(link);
+ var commonJsScript = doc.createElement('script');
+ commonJsScript.src = '../../Source/WebCore/Resources/pagepopups/pickerCommon.js?' + (new Date()).getTime();
+ doc.body.appendChild(commonJsScript);
var script = doc.createElement('script');
script.src = '../../Source/WebCore/Resources/pagepopups/colorSuggestionPicker.js?' + (new Date()).getTime();
doc.body.appendChild(script);
+2012-08-14 Keishi Hattori <keishi@webkit.org>
+
+ Share common code between calendar picker and color suggestion picker
+ https://bugs.webkit.org/show_bug.cgi?id=93802
+
+ Reviewed by Kent Tamura.
+
+ We want to share common code like utility functions between picker page popups.
+
+ No new tests because no behavior change. Covered by existing tests, color-suggestion-picker-appearance.html and calendar-picker-apeparance.html.
+
+ * Resources/pagepopups/calendarPicker.js:
+ (YearMonthController.prototype.attachTo):
+ (YearMonthController.prototype._showPopup):
+ * Resources/pagepopups/colorSuggestionPicker.js:
+ (handleMessage):
+ (handleArgumentsTimeout):
+ * Resources/pagepopups/pickerCommon.css: Added.
+ (body):
+ * Resources/pagepopups/pickerCommon.js: Added.
+ (createElement):
+ (resizeWindow):
+ (getScrollbarWidth):
+ * WebCore.gyp/WebCore.gyp: Add actions for pickerCommon.{css,js}
+ * html/shadow/CalendarPickerElement.cpp:
+ (WebCore::CalendarPickerElement::writeDocument):
+
2012-08-14 Ojan Vafai <ojan@chromium.org>
Fix access to m_markupBox in WebCore::EllipsisBox::paint
MonthSelectorPopup: "month-selector-popup",
MonthSelectorPopupContents: "month-selector-popup-contents",
MonthSelectorPopupEntry: "month-selector-popup-entry",
- MonthSelectorPopupSizer: "month-selector-popup-sizer",
MonthSelectorWall: "month-selector-wall",
NoFocusRing: "no-focus-ring",
NotThisMonth: "not-this-month",
// ----------------------------------------------------------------
// Utility functions
-/**
- * @param {!string} id
- */
-function $(id) {
- return document.getElementById(id);
-}
-
-function bind(func, context) {
- return function() {
- return func.apply(context, arguments);
- };
-}
-
-/**
- * @param {!string} tagName
- * @param {string=} opt_class
- * @param {string=} opt_text
- * @return {!Element}
- */
-function createElement(tagName, opt_class, opt_text) {
- var element = document.createElement(tagName);
- if (opt_class)
- element.setAttribute("class", opt_class);
- if (opt_text)
- element.appendChild(document.createTextNode(opt_text));
- return element;
-}
-
/**
* @return {!string} lowercase locale name. e.g. "en-us"
*/
return yearString + "-" + ("0" + (month + 1)).substr(-2, 2) + "-" + ("0" + day).substr(-2, 2);
}
-/**
- * @param {!number} width
- * @param {!number} height
- */
-function resizeWindow(width, height) {
- if (window.frameElement) {
- window.frameElement.style.width = width + "px";
- window.frameElement.style.height = height + "px";
- } else {
- window.resizeTo(width, height);
- }
-}
-
// ----------------------------------------------------------------
// Initialization
this._monthPopup.tabIndex = 0;
this._monthPopupContents = createElement("div", ClassNames.MonthSelectorPopupContents);
this._monthPopup.appendChild(this._monthPopupContents);
- // Sizer used to determine the width of the viewport in the popup menu.
- var sizer = createElement("div", ClassNames.MonthSelectorPopupSizer);
- this._monthPopup.appendChild(sizer);
box.appendChild(this._monthPopup);
this._month = createElement("div", ClassNames.MonthSelector);
this._month.addEventListener("click", bind(this._showPopup, this), false);
if (bottom > popupHeight)
this._monthPopup.scrollTop = bottom - popupHeight;
}
- var sizer = document.querySelector("." + ClassNames.MonthSelectorPopupSizer);
- var scrollWidth = this._monthPopupContents.clientWidth - sizer.clientWidth;
- if (scrollWidth > 0)
- this._monthPopup.style.webkitPaddingEnd = scrollWidth + 'px';
+ this._monthPopup.style.webkitPaddingEnd = getScrollbarWidth() + 'px';
}
this._monthPopup.focus();
};
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-var global = {
- argumentsReceived: false,
- scrollbarWidth: null
-};
-
-/**
- * @param {!string} id
- */
-function $(id) {
- return document.getElementById(id);
-}
-
-function bind(func, context) {
- return function() {
- return func.apply(context, arguments);
- };
-}
-
-function getScrollbarWidth() {
- if (global.scrollbarWidth === null) {
- var scrollDiv = document.createElement("div");
- scrollDiv.style.opacity = "0";
- scrollDiv.style.overflow = "scroll";
- scrollDiv.style.width = "50px";
- scrollDiv.style.height = "50px";
- document.body.appendChild(scrollDiv);
- global.scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
- scrollDiv.parentNode.removeChild(scrollDiv);
- }
- return global.scrollbarWidth;
-}
-
-/**
- * @param {!string} tagName
- * @param {string=} opt_class
- * @param {string=} opt_text
- * @return {!Element}
- */
-function createElement(tagName, opt_class, opt_text) {
- var element = document.createElement(tagName);
- if (opt_class)
- element.setAttribute("class", opt_class);
- if (opt_text)
- element.appendChild(document.createTextNode(opt_text));
- return element;
-}
-
-/**
- * @param {!number} width
- * @param {!number} height
- */
-function resizeWindow(width, height) {
- if (window.frameElement) {
- window.frameElement.style.width = width + "px";
- window.frameElement.style.height = height + "px";
- } else {
- window.resizeTo(width, height);
- }
-}
+window.argumentsReceived = false;
/**
* @param {Event} event
*/
function handleMessage(event) {
initialize(JSON.parse(event.data));
- global.argumentsReceived = true;
+ window.argumentsReceived = true;
}
/**
"#4a86e8", "#0000ff", "#9900ff", "#ff00ff"];
function handleArgumentsTimeout() {
- if (global.argumentsReceived)
+ if (window.argumentsReceived)
return;
var args = {
values : DefaultColorPalette,
--- /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 INC. 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 INC. 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.
+ */
+
+body {
+ -webkit-user-select: none;
+ background-color: white;
+ font: -webkit-small-control;
+ margin: 0;
+ overflow: hidden;
+}
--- /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 INC. 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 INC. 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.
+ */
+
+/**
+ * @param {!string} id
+ */
+function $(id) {
+ return document.getElementById(id);
+}
+
+function bind(func, context) {
+ return function() {
+ return func.apply(context, arguments);
+ };
+}
+
+/**
+ * @param {!string} tagName
+ * @param {string=} opt_class
+ * @param {string=} opt_text
+ * @return {!Element}
+ */
+function createElement(tagName, opt_class, opt_text) {
+ var element = document.createElement(tagName);
+ if (opt_class)
+ element.setAttribute("class", opt_class);
+ if (opt_text)
+ element.appendChild(document.createTextNode(opt_text));
+ return element;
+}
+
+/**
+ * @param {!number} width
+ * @param {!number} height
+ */
+function resizeWindow(width, height) {
+ if (window.frameElement) {
+ window.frameElement.style.width = width + "px";
+ window.frameElement.style.height = height + "px";
+ } else {
+ window.resizeTo(width, height);
+ }
+}
+
+function getScrollbarWidth() {
+ if (typeof window.scrollbarWidth === "undefined") {
+ var scrollDiv = document.createElement("div");
+ scrollDiv.style.opacity = "0";
+ scrollDiv.style.overflow = "scroll";
+ scrollDiv.style.width = "50px";
+ scrollDiv.style.height = "50px";
+ document.body.appendChild(scrollDiv);
+ window.scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
+ scrollDiv.parentNode.removeChild(scrollDiv);
+ }
+ return window.scrollbarWidth;
+}
'--defines', '<(feature_defines)',
],
},
+ {
+ 'action_name': 'PickerCommon',
+ 'inputs': [
+ '../Resources/pagepopups/pickerCommon.css',
+ '../Resources/pagepopups/pickerCommon.js',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/PickerCommon.h',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/PickerCommon.cpp',
+ ],
+ 'action': [
+ 'python',
+ '../make-file-arrays.py',
+ '--condition=ENABLE(CALENDAR_PICKER)',
+ '--out-h=<(SHARED_INTERMEDIATE_DIR)/webkit/PickerCommon.h',
+ '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/webkit/PickerCommon.cpp',
+ '<@(_inputs)',
+ ],
+ },
{
'action_name': 'CalendarPicker',
'inputs': [
'<(SHARED_INTERMEDIATE_DIR)/webkit/EventTargetHeaders.h',
'<(SHARED_INTERMEDIATE_DIR)/webkit/EventTargetInterfaces.h',
'<(SHARED_INTERMEDIATE_DIR)/webkit/ExceptionCodeDescription.cpp',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/PickerCommon.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheetsData.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.cpp',
#include "LocalizedDate.h"
#include "LocalizedStrings.h"
#include "Page.h"
+#include "PickerCommon.h"
#include "RenderDetailsMarker.h"
#include "RenderTheme.h"
#include <wtf/text/StringBuilder.h>
stepString = "1";
addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
+ writer.addData(pickerCommonCss, sizeof(pickerCommonCss));
writer.addData(calendarPickerCss, sizeof(calendarPickerCss));
if (document()->page()) {
CString extraStyle = document()->page()->theme()->extraCalendarPickerStyleSheet();
addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer);
addString("}\n", writer);
+ writer.addData(pickerCommonJs, sizeof(pickerCommonJs));
writer.addData(calendarPickerJs, sizeof(calendarPickerJs));
addString("</script></body>\n", writer);
}
+2012-08-14 Keishi Hattori <keishi@webkit.org>
+
+ Share common code between calendar picker and color suggestion picker
+ https://bugs.webkit.org/show_bug.cgi?id=93802
+
+ Reviewed by Kent Tamura.
+
+ * src/ColorChooserUIController.cpp:
+ (WebKit::ColorChooserUIController::writeDocument):
+
2012-08-14 Scott Graham <scottmg@chromium.org>
[Chromium] Fix warnings on Windows build
#include "ColorSuggestionPicker.h"
#include "IntRect.h"
#include "LocalizedStrings.h"
+#include "PickerCommon.h"
#include "WebColorChooser.h"
#include "platform/WebColor.h"
#include "platform/WebKitPlatformSupport.h"
suggestionValues.append(suggestions[i].serialized());
WebCore::PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer);
+ writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss));
writer.addData(WebCore::colorSuggestionPickerCss, sizeof(WebCore::colorSuggestionPickerCss));
WebCore::PagePopupClient::addString("</style></head><body><div id=main>Loading...</div><script>\n"
"window.dialogArguments = {\n", writer);
WebCore::PagePopupClient::addProperty("values", suggestionValues, writer);
WebCore::PagePopupClient::addProperty("otherColorLabel", Platform::current()->queryLocalizedString(WebLocalizedString::OtherColorLabel), writer);
WebCore::PagePopupClient::addString("};\n", writer);
+ writer.addData(WebCore::pickerCommonJs, sizeof(WebCore::pickerCommonJs));
writer.addData(WebCore::colorSuggestionPickerJs, sizeof(WebCore::colorSuggestionPickerJs));
WebCore::PagePopupClient::addString("</script></body>\n", writer);
}