Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (153632 => 153633)
--- trunk/Source/_javascript_Core/ChangeLog 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-08-02 02:07:34 UTC (rev 153633)
@@ -1,3 +1,12 @@
+2013-08-01 Ruth Fong <[email protected]>
+
+ [Forms: color] <input type='color'> popover color well implementation
+ <rdar://problem/14411008> and https://bugs.webkit.org/show_bug.cgi?id=119356
+
+ Reviewed by Benjamin Poulain.
+
+ * Configurations/FeatureDefines.xcconfig: Added and enabled INPUT_TYPE_COLOR_POPOVER.
+
2013-08-01 Oliver Hunt <[email protected]>
DFG is not enforcing correct ordering of ToString conversion in MakeRope
Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (153632 => 153633)
--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig 2013-08-02 02:07:34 UTC (rev 153633)
@@ -99,6 +99,7 @@
ENABLE_INDEXED_DATABASE = ;
ENABLE_INPUT_SPEECH = ;
ENABLE_INPUT_TYPE_COLOR = ENABLE_INPUT_TYPE_COLOR;
+ENABLE_INPUT_TYPE_COLOR_POPOVER = ENABLE_INPUT_TYPE_COLOR_POPOVER;
ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(PLATFORM_NAME));
ENABLE_INPUT_TYPE_DATE_iphoneos = ENABLE_INPUT_TYPE_DATE;
ENABLE_INPUT_TYPE_DATE_iphonesimulator = $(ENABLE_INPUT_TYPE_DATE_iphoneos);
Modified: trunk/Source/WTF/ChangeLog (153632 => 153633)
--- trunk/Source/WTF/ChangeLog 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WTF/ChangeLog 2013-08-02 02:07:34 UTC (rev 153633)
@@ -1,3 +1,12 @@
+2013-08-01 Ruth Fong <[email protected]>
+
+ [Forms: color] <input type='color'> popover color well implementation
+ <rdar://problem/14411008> and https://bugs.webkit.org/show_bug.cgi?id=119356
+
+ Reviewed by Benjamin Poulain.
+
+ * wtf/FeatureDefines.h: Added and enabled INPUT_TYPE_COLOR_POPOVER.
+
2013-08-01 Simon Fraser <[email protected]>
REGRESSION(r145592): AutodrainedPool.h. RunLoopTimer.h, SchedulePair.h are being copied into the wrong location
Modified: trunk/Source/WTF/wtf/FeatureDefines.h (153632 => 153633)
--- trunk/Source/WTF/wtf/FeatureDefines.h 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WTF/wtf/FeatureDefines.h 2013-08-02 02:07:34 UTC (rev 153633)
@@ -190,6 +190,10 @@
#define ENABLE_INPUT_TYPE_COLOR 1
#endif
+#if !defined(ENABLE_INPUT_TYPE_COLOR_POPOVER)
+#define ENABLE_INPUT_TYPE_COLOR_POPOVER 1
+#endif
+
#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
/* --------- Apple Windows port --------- */
@@ -510,6 +514,10 @@
#define ENABLE_INPUT_TYPE_COLOR 0
#endif
+#if !defined(ENABLE_INPUT_TYPE_COLOR_POPOVER)
+#define ENABLE_INPUT_TYPE_COLOR_POPOVER 0
+#endif
+
#if !defined(ENABLE_INPUT_TYPE_DATE)
#define ENABLE_INPUT_TYPE_DATE 0
#endif
Modified: trunk/Source/WebCore/ChangeLog (153632 => 153633)
--- trunk/Source/WebCore/ChangeLog 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebCore/ChangeLog 2013-08-02 02:07:34 UTC (rev 153633)
@@ -1,3 +1,12 @@
+2013-08-01 Ruth Fong <[email protected]>
+
+ [Forms: color] <input type='color'> popover color well implementation
+ <rdar://problem/14411008> and https://bugs.webkit.org/show_bug.cgi?id=119356
+
+ Reviewed by Benjamin Poulain.
+
+ * Configurations/FeatureDefines.xcconfig: Added and enabled INPUT_TYPE_COLOR_POPOVER.
+
2013-07-31 Ryosuke Niwa <[email protected]>
FormAssociatedElement shouldn't create out-of-tree FormAttributeTargetObserver
Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (153632 => 153633)
--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig 2013-08-02 02:07:34 UTC (rev 153633)
@@ -100,6 +100,7 @@
ENABLE_INDIE_UI = ENABLE_INDIE_UI;
ENABLE_INPUT_SPEECH = ;
ENABLE_INPUT_TYPE_COLOR = ENABLE_INPUT_TYPE_COLOR;
+ENABLE_INPUT_TYPE_COLOR_POPOVER = ENABLE_INPUT_TYPE_COLOR_POPOVER;
ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(PLATFORM_NAME));
ENABLE_INPUT_TYPE_DATE_iphoneos = ENABLE_INPUT_TYPE_DATE;
ENABLE_INPUT_TYPE_DATE_iphonesimulator = $(ENABLE_INPUT_TYPE_DATE_iphoneos);
Modified: trunk/Source/WebKit/mac/ChangeLog (153632 => 153633)
--- trunk/Source/WebKit/mac/ChangeLog 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit/mac/ChangeLog 2013-08-02 02:07:34 UTC (rev 153633)
@@ -1,3 +1,12 @@
+2013-08-01 Ruth Fong <[email protected]>
+
+ [Forms: color] <input type='color'> popover color well implementation
+ <rdar://problem/14411008> and https://bugs.webkit.org/show_bug.cgi?id=119356
+
+ Reviewed by Benjamin Poulain.
+
+ * Configurations/FeatureDefines.xcconfig: Added and enabled INPUT_TYPE_COLOR_POPOVER.
+
2013-07-31 Tim Horton <[email protected]>
Remove didFinishLoad order quirk
Modified: trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig (153632 => 153633)
--- trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig 2013-08-02 02:07:34 UTC (rev 153633)
@@ -99,6 +99,7 @@
ENABLE_INDEXED_DATABASE = ;
ENABLE_INPUT_SPEECH = ;
ENABLE_INPUT_TYPE_COLOR = ENABLE_INPUT_TYPE_COLOR;
+ENABLE_INPUT_TYPE_COLOR_POPOVER = ENABLE_INPUT_TYPE_COLOR_POPOVER;
ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(PLATFORM_NAME));
ENABLE_INPUT_TYPE_DATE_iphoneos = ENABLE_INPUT_TYPE_DATE;
ENABLE_INPUT_TYPE_DATE_iphonesimulator = $(ENABLE_INPUT_TYPE_DATE_iphoneos);
Modified: trunk/Source/WebKit2/ChangeLog (153632 => 153633)
--- trunk/Source/WebKit2/ChangeLog 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit2/ChangeLog 2013-08-02 02:07:34 UTC (rev 153633)
@@ -1,3 +1,50 @@
+2013-08-01 Ruth Fong <[email protected]>
+
+ [Forms: color] <input type='color'> popover color well implementation
+ <rdar://problem/14411008> and https://bugs.webkit.org/show_bug.cgi?id=119356
+
+ Reviewed by Benjamin Poulain.
+
+ This patch adds an popover implementation of <input type='color'>.
+
+ * Configurations/FeatureDefines.xcconfig: Added and enabled INPUT_TYPE_COLOR_POPOVER.
+
+ * UIProcess/API/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::createColorPicker): Updated to pass the
+ coordinates of the <input type='color'> element and the WKView
+ object for the window.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::viewWillStartLiveResize): Close popover color
+ picker when the view is resized.
+ (WebKit::WebPageProxy::viewInWindowStateDidChange): Close popover color
+ picker when the view is no longer in the window.
+ (WebKit::WebPageProxy::showColorPicker): Updated to show either a color panel
+ or a popover color picker depending on whether INPUT_TYPE_COLOR_POPOVER is enabled.
+
+ * UIProcess/mac/WebColorPickerMac.h:
+ * UIProcess/mac/WebColorPickerMac.mm:
+ (WebKit::WebColorPickerMac::create):
+ (WebKit::WebColorPickerMac::~WebColorPickerMac):
+ (WebKit::WebColorPickerMac::WebColorPickerMac):
+ (WebKit::WebColorPickerMac::endPicker):
+ (WebKit::WebColorPickerMac::setSelectedColor):
+ (WebKit::WebColorPickerMac::showColorPicker):
+ Methods updated to handle both the color panel implementation and
+ the popover implementation; also renamed m_panel to m_colorPickerUI.
+
+ (-[WKColorPopoverMac initWithFrame:WebCore::inView:]):
+ (-[WKColorPopoverMac setAndShowPicker:WebKit::withColor:]):
+ (-[WKColorPopoverMac dealloc]):
+ (-[WKColorPopoverMac invalidate]):
+ (-[WKColorPopoverMac windowWillClose:]):
+ (-[WKColorPopoverMac didChooseColor:]):
+ (-[WKColorPopoverMac setColor:]):
+ WKColorPopoverMac provides the popover implementation of <input type='color'>.
+
+ (-[WKColorPanelMac didChooseColor:]): Updated to match the interface of
+ WKColorPickerMac::didChooseColor.
+
2013-08-01 Anders Carlsson <[email protected]>
Lots of leaks under WebContext::pluginInfoStoreDidLoadPlugins()
Modified: trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig (153632 => 153633)
--- trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig 2013-08-02 02:07:34 UTC (rev 153633)
@@ -99,6 +99,7 @@
ENABLE_INDEXED_DATABASE = ;
ENABLE_INPUT_SPEECH = ;
ENABLE_INPUT_TYPE_COLOR = ENABLE_INPUT_TYPE_COLOR;
+ENABLE_INPUT_TYPE_COLOR_POPOVER = ENABLE_INPUT_TYPE_COLOR_POPOVER;
ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(PLATFORM_NAME));
ENABLE_INPUT_TYPE_DATE_iphoneos = ENABLE_INPUT_TYPE_DATE;
ENABLE_INPUT_TYPE_DATE_iphonesimulator = $(ENABLE_INPUT_TYPE_DATE_iphoneos);
@@ -186,4 +187,4 @@
ENABLE_FTL_JIT = ;
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_BLOB) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PLUGIN_PROXY_FOR_VIDEO) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_FONTS) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_THREADED_HTML_PARSER) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(FEATURE_DEFINES_$(PLATFORM_NAME));
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_BLOB) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PLUGIN_PROXY_FOR_VIDEO) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_FONTS) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_THREADED_HTML_PARSER) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(FEATURE_DEFINES_$(PLATFORM_NAME));
Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (153632 => 153633)
--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm 2013-08-02 02:07:34 UTC (rev 153633)
@@ -394,9 +394,9 @@
}
#if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor, const WebCore::IntRect&)
+PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor, const WebCore::IntRect& rect)
{
- return WebColorPickerMac::create(page, initialColor);
+ return WebColorPickerMac::create(page, initialColor, rect, wkView());
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (153632 => 153633)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-08-02 02:07:34 UTC (rev 153633)
@@ -1005,6 +1005,10 @@
{
if (!isValid())
return;
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ if (m_colorPicker)
+ endColorPicker();
+#endif
m_process->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
}
@@ -1053,6 +1057,13 @@
m_drawingArea->layerHostingModeDidChange();
}
}
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ else {
+ // When leaving the current page, close the popover color well.
+ if (m_colorPicker)
+ endColorPicker();
+ }
+#endif
}
void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
@@ -2923,6 +2934,11 @@
#if ENABLE(INPUT_TYPE_COLOR)
void WebPageProxy::showColorPicker(const WebCore::Color& initialColor, const IntRect& elementRect)
{
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ // A new popover color well needs to be created (and the previous one destroyed) for
+ // each activation of a color element.
+ m_colorPicker = 0;
+#endif
if (!m_colorPicker)
m_colorPicker = m_pageClient->createColorPicker(this, initialColor, elementRect);
m_colorPicker->showColorPicker(initialColor);
Modified: trunk/Source/WebKit2/UIProcess/mac/WebColorPickerMac.h (153632 => 153633)
--- trunk/Source/WebKit2/UIProcess/mac/WebColorPickerMac.h 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit2/UIProcess/mac/WebColorPickerMac.h 2013-08-02 02:07:34 UTC (rev 153633)
@@ -37,20 +37,30 @@
#if USE(APPKIT)
#import "WebColorPicker.h"
+#import "WKView.h"
+#import <WebCore/IntRect.h>
#include <wtf/RetainPtr.h>
-OBJC_CLASS NSColorWell;
-OBJC_CLASS WKColorPanelMac;
-
namespace WebCore {
class Color;
}
namespace WebKit {
+class WebColorPickerMac;
+}
+
+@protocol WKColorPickerUIMac <NSObject>
+- (void)setAndShowPicker:(WebKit::WebColorPickerMac*)picker withColor:(NSColor *)color;
+- (void)invalidate;
+- (void)setColor:(NSColor *)color;
+- (void)didChooseColor:(id)sender;
+@end
+
+namespace WebKit {
class WebColorPickerMac : public WebColorPicker {
public:
- static PassRefPtr<WebColorPickerMac> create(WebColorPicker::Client*, const WebCore::Color&);
+ static PassRefPtr<WebColorPickerMac> create(WebColorPicker::Client*, const WebCore::Color&, const WebCore::IntRect&, WKView*);
~WebColorPickerMac();
virtual void endPicker() OVERRIDE;
@@ -60,8 +70,8 @@
void didChooseColor(const WebCore::Color&);
private:
- WebColorPickerMac(WebColorPicker::Client*, const WebCore::Color&);
- RetainPtr<WKColorPanelMac> m_panel;
+ WebColorPickerMac(WebColorPicker::Client*, const WebCore::Color&, const WebCore::IntRect&, WKView*);
+ RetainPtr<NSObject<WKColorPickerUIMac> > m_colorPickerUI;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/mac/WebColorPickerMac.mm (153632 => 153633)
--- trunk/Source/WebKit2/UIProcess/mac/WebColorPickerMac.mm 2013-08-02 01:57:12 UTC (rev 153632)
+++ trunk/Source/WebKit2/UIProcess/mac/WebColorPickerMac.mm 2013-08-02 02:07:34 UTC (rev 153633)
@@ -40,54 +40,78 @@
using namespace WebKit;
-// A listener class to act as a event target for NSColorPanel and send
-// the results to the C++ class, WebColorPickerMac.
-@interface WKColorPanelMac : NSObject<NSWindowDelegate> {
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+
+// The methods we use from NSPopoverColorWell aren't declared in its header
+// so there's no benefit to trying to include them. Instead we just declare
+// the class and methods here.
+@interface NSPopoverColorWell : NSColorWell
+@end
+
+@interface NSPopoverColorWell (AppKitSecretsIKnow)
+- (void)_showPopover;
+@end
+
+@interface WKColorPopoverMac : NSObject<WKColorPickerUIMac, NSWindowDelegate> {
@private
BOOL _lastChangedByUser;
- WebColorPickerMac* _picker;
+ WebColorPickerMac *_picker;
+ RetainPtr<NSPopoverColorWell> _popoverWell;
}
+- (id)initWithFrame:(const WebCore::IntRect &)rect inView:(WKView *)view;
+@end
+#else
+
+@interface WKColorPanelMac : NSObject<WKColorPickerUIMac, NSWindowDelegate> {
+@private
+ BOOL _lastChangedByUser;
+ WebColorPickerMac *_picker;
+}
- (id)init;
-- (void)setAndShowPicker:(WebKit::WebColorPickerMac*)picker withColor:(NSColor *)color;
-- (void)didChooseColor:(NSColorPanel *)panel;
-- (void)invalidate;
+@end
-// Sets color to the NSColorPanel as a non user change.
-- (void)setColor:(NSColor *)color;
+#endif // ENABLE(INPUT_TYPE_COLOR_POPOVER)
-@end
-
namespace WebKit {
-PassRefPtr<WebColorPickerMac> WebColorPickerMac::create(WebColorPicker::Client* client, const WebCore::Color& initialColor)
+PassRefPtr<WebColorPickerMac> WebColorPickerMac::create(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, WKView* view)
{
- return adoptRef(new WebColorPickerMac(client, initialColor));
+ return adoptRef(new WebColorPickerMac(client, initialColor, rect, view));
}
WebColorPickerMac::~WebColorPickerMac()
{
- ASSERT(!m_panel);
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ if (m_colorPickerUI)
+ endPicker();
+#else
+ ASSERT(!m_colorPickerUI);
+#endif
}
-WebColorPickerMac::WebColorPickerMac(WebColorPicker::Client* client, const WebCore::Color& initialColor)
+WebColorPickerMac::WebColorPickerMac(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, WKView* view)
: WebColorPicker(client)
{
- m_panel = adoptNS([[WKColorPanelMac alloc] init]);
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ m_colorPickerUI = adoptNS([[WKColorPopoverMac alloc] initWithFrame:rect inView:view]);
+#else
+ m_colorPickerUI = adoptNS([[WKColorPanelMac alloc] init]);
+#endif
}
void WebColorPickerMac::endPicker()
{
- [m_panel invalidate];
- m_panel = nullptr;
+ [m_colorPickerUI invalidate];
+ m_colorPickerUI = nil;
}
void WebColorPickerMac::setSelectedColor(const WebCore::Color& color)
{
- if (!m_client || !m_panel)
+ if (!m_client || !m_colorPickerUI)
return;
- [m_panel setColor:nsColor(color)];
+ [m_colorPickerUI setColor:nsColor(color)];
}
void WebColorPickerMac::didChooseColor(const WebCore::Color& color)
@@ -97,21 +121,97 @@
m_client->didChooseColor(color);
}
+
void WebColorPickerMac::showColorPicker(const WebCore::Color& color)
{
if (!m_client)
return;
- if (!m_panel)
- m_panel = adoptNS([[WKColorPanelMac alloc] init]);
+#if !ENABLE(INPUT_TYPE_COLOR_POPOVER)
+ if (!m_colorPickerUI)
+ m_colorPickerUI = adoptNS([[WKColorPanelMac alloc] init]);
+#endif
- [m_panel setAndShowPicker:this withColor:nsColor(color)];
+ [m_colorPickerUI setAndShowPicker:this withColor:nsColor(color)];
}
} // namespace WebKit
-using namespace WebKit;
+#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
+@implementation WKColorPopoverMac
+- (id)initWithFrame:(const WebCore::IntRect &)rect inView:(WKView *)view
+{
+ if(!(self = [super init]))
+ return self;
+
+ _popoverWell = adoptNS([[NSPopoverColorWell alloc] initWithFrame:NSRectFromCGRect(rect)]);
+ if (!_popoverWell)
+ return self;
+
+ [[view window].contentView addSubview:_popoverWell.get()];
+
+ return self;
+}
+
+- (void)setAndShowPicker:(WebKit::WebColorPickerMac*)picker withColor:(NSColor *)color
+{
+ _picker = picker;
+
+ [_popoverWell setTarget:self];
+ [_popoverWell setAction:@selector(didChooseColor:)];
+ [_popoverWell setColor:color];
+ [_popoverWell _showPopover];
+
+ _lastChangedByUser = YES;
+}
+- (void)dealloc
+{
+ ASSERT(!_popoverWell);
+ ASSERT(!_picker);
+ [super dealloc];
+}
+
+- (void)invalidate
+{
+ [_popoverWell removeFromSuperviewWithoutNeedingDisplay];
+ [_popoverWell setTarget:nil];
+ [_popoverWell setAction:nil];
+ [_popoverWell deactivate];
+ _popoverWell = nil;
+ _picker = nil;
+}
+
+- (void)windowWillClose:(NSNotification *)notification
+{
+ _lastChangedByUser = YES;
+ _picker->endPicker();
+}
+
+- (void)didChooseColor:(id)sender
+{
+ if (sender != _popoverWell)
+ return;
+
+ // Handle the case where the <input type='color'> value is programmatically set.
+ if (!_lastChangedByUser) {
+ _lastChangedByUser = YES;
+ return;
+ }
+
+ _picker->didChooseColor(WebCore::colorFromNSColor([_popoverWell color]));
+}
+
+- (void)setColor:(NSColor *)color
+{
+ _lastChangedByUser = NO;
+ [_popoverWell setColor:color];
+}
+
+@end
+
+#else
+
@implementation WKColorPanelMac
- (id)init
@@ -154,15 +254,18 @@
_picker->endPicker();
}
-- (void)didChooseColor:(NSColorPanel *)panel
+- (void)didChooseColor:(id)sender
{
+ if (sender != [NSColorPanel sharedColorPanel])
+ return;
+
// Handle the case where the <input type='color'> value is programmatically set.
if (!_lastChangedByUser) {
_lastChangedByUser = YES;
return;
}
- _picker->didChooseColor(WebCore::colorFromNSColor([panel color]));
+ _picker->didChooseColor(WebCore::colorFromNSColor([sender color]));
}
- (void)setColor:(NSColor *)color
@@ -173,6 +276,8 @@
@end
+#endif // ENABLE(INPUT_TYPE_COLOR_POPOVER)
+
#endif // USE(APPKIT)
#endif // ENABLE(INPUT_TYPE_COLOR)