Diff
Modified: trunk/LayoutTests/ChangeLog (234787 => 234788)
--- trunk/LayoutTests/ChangeLog 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/LayoutTests/ChangeLog 2018-08-12 20:19:25 UTC (rev 234788)
@@ -1,3 +1,15 @@
+2018-08-12 Aditya Keerthi <[email protected]>
+
+ [macOS] Color wells should appear pressed when presenting a color picker
+ https://bugs.webkit.org/show_bug.cgi?id=188477
+
+ Reviewed by Tim Horton.
+
+ Rebaseline tests to match new color-well appearance.
+
+ * platform/mac/fast/forms/color/input-appearance-color-expected.png:
+ * platform/mac/fast/forms/color/input-appearance-color-expected.txt:
+
2018-08-12 Zalan Bujtas <[email protected]>
[LFC] Float prev/next sibling should prevent top/bottom margin collapsing with parent.
Modified: trunk/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt (234787 => 234788)
--- trunk/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt 2018-08-12 20:19:25 UTC (rev 234788)
@@ -12,10 +12,10 @@
RenderBR {BR} at (456,14) size 1x0
RenderBlock {INPUT} at (0,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#000000] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#000000] [border: (1px solid #8A8A8A)]
RenderBlock {INPUT} at (44,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#000000] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#000000] [border: (1px solid #8A8A8A)]
RenderText {#text} at (0,0) size 0x0
RenderBlock {H3} at (0,100) size 784x23
RenderText {#text} at (0,0) size 162x22
@@ -26,32 +26,32 @@
RenderBR {BR} at (589,14) size 1x0
RenderBlock {INPUT} at (0,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (44,21) size 4x18
text run at (44,21) width 4: " "
RenderBlock {INPUT} at (48,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (92,21) size 4x18
text run at (92,21) width 4: " "
RenderBlock {INPUT} at (96,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (140,21) size 4x18
text run at (140,21) width 4: " "
RenderBlock {INPUT} at (144,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (188,21) size 4x18
text run at (188,21) width 4: " "
RenderBlock {INPUT} at (192,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (236,21) size 4x18
text run at (236,21) width 4: " "
RenderBlock {INPUT} at (240,18) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (0,0) size 0x0
RenderBlock {H3} at (0,200) size 784x23
RenderText {#text} at (0,0) size 122x22
@@ -59,52 +59,52 @@
RenderBlock (anonymous) at (0,241) size 784x24
RenderBlock {INPUT} at (0,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#FF0000] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#FF0000] [border: (1px solid #8A8A8A)]
RenderText {#text} at (44,3) size 4x18
text run at (44,3) width 4: " "
RenderBlock {INPUT} at (48,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (92,3) size 4x18
text run at (92,3) width 4: " "
RenderBlock {INPUT} at (96,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#0000FF] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#0000FF] [border: (1px solid #8A8A8A)]
RenderText {#text} at (140,3) size 4x18
text run at (140,3) width 4: " "
RenderBlock {INPUT} at (144,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#EC008C] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#EC008C] [border: (1px solid #8A8A8A)]
RenderText {#text} at (188,3) size 4x18
text run at (188,3) width 4: " "
RenderBlock {INPUT} at (192,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#40E0D0] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#40E0D0] [border: (1px solid #8A8A8A)]
RenderText {#text} at (236,3) size 4x18
text run at (236,3) width 4: " "
RenderBlock {INPUT} at (240,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#FF0000] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#FF0000] [border: (1px solid #8A8A8A)]
RenderText {#text} at (284,3) size 4x18
text run at (284,3) width 4: " "
RenderBlock {INPUT} at (288,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#00FF00] [border: (1px solid #8A8A8A)]
RenderText {#text} at (332,3) size 4x18
text run at (332,3) width 4: " "
RenderBlock {INPUT} at (336,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#0000FF] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#0000FF] [border: (1px solid #8A8A8A)]
RenderText {#text} at (380,3) size 4x18
text run at (380,3) width 4: " "
RenderBlock {INPUT} at (384,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#EC008C] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#EC008C] [border: (1px solid #8A8A8A)]
RenderText {#text} at (428,3) size 4x18
text run at (428,3) width 4: " "
RenderBlock {INPUT} at (432,0) size 44x23 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 38x21
- RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#40E0D0] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 34x13 [bgcolor=#40E0D0] [border: (1px solid #8A8A8A)]
RenderText {#text} at (0,0) size 0x0
RenderBlock {H3} at (0,283) size 784x23
RenderText {#text} at (0,0) size 118x22
@@ -112,4 +112,4 @@
RenderBlock (anonymous) at (0,324) size 784x31
RenderBlock {INPUT} at (0,0) size 100x30 [bgcolor=#FFFFFF] [border: none (2px inset #000000) none (2px inset #000000)]
RenderFlexibleBox {DIV} at (3,1) size 94x28
- RenderBlock {DIV} at (2,4) size 90x20 [bgcolor=#FF0000] [border: (1px solid #777777)]
+ RenderBlock {DIV} at (2,4) size 90x20 [bgcolor=#FF0000] [border: (1px solid #8A8A8A)]
Modified: trunk/Source/WebCore/ChangeLog (234787 => 234788)
--- trunk/Source/WebCore/ChangeLog 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/ChangeLog 2018-08-12 20:19:25 UTC (rev 234788)
@@ -1,3 +1,59 @@
+2018-08-12 Aditya Keerthi <[email protected]>
+
+ [macOS] Color wells should appear pressed when presenting a color picker
+ https://bugs.webkit.org/show_bug.cgi?id=188477
+
+ Reviewed by Tim Horton.
+
+ Currently, when clicking on a color well, the color well loses its pressed
+ appearance once the mouse is lifted. Because of this behavior, the color well
+ does not appear to be active when the color picker is displayed.
+
+ Added the color-well -webkit-appearance value to control the drawing of the color
+ well separate from other buttons. Also added a new ControlState, named
+ PresentingState. A control can be in this state whenever it is presenting some
+ attached view. In the case of the color well this is the color picker. The
+ Information as to whether a form control is in the presenting state comes from
+ isPresentingAttachedView() in HTMLInputElement.
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ * css/CSSProperties.json:
+ * css/CSSValueKeywords.in:
+ * css/html.css:
+ (input[type="color"]::-webkit-color-swatch):
+ * html/ColorInputType.cpp:
+ (WebCore::ColorInputType::isPresentingAttachedView const):
+ (WebCore::ColorInputType::elementDidBlur):
+ (WebCore::ColorInputType::didEndChooser):
+ * html/ColorInputType.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::isPresentingAttachedView const):
+ * html/HTMLInputElement.h:
+ * html/InputType.cpp:
+ (WebCore::InputType::isPresentingAttachedView const):
+ * html/InputType.h:
+ * platform/ControlStates.h:
+ * platform/ThemeTypes.h:
+ * platform/mac/ThemeMac.mm:
+ (WebCore::updateStates):
+ (WebCore::setUpButtonCell):
+ (WebCore::paintColorWell):
+ (WebCore::ThemeMac::minimumControlSize const):
+ (WebCore::ThemeMac::controlBorder const):
+ (WebCore::ThemeMac::paint):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::paint):
+ (WebCore::RenderTheme::paintBorderOnly):
+ (WebCore::RenderTheme::paintDecorations):
+ (WebCore::RenderTheme::isControlStyled const):
+ (WebCore::RenderTheme::extractControlStatesForRenderer const):
+ (WebCore::RenderTheme::isPresenting const):
+ * rendering/RenderTheme.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::adjustRepaintRect):
+
2018-08-12 Zalan Bujtas <[email protected]>
[LFC] Float prev/next sibling should prevent top/bottom margin collapsing with parent.
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (234787 => 234788)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -621,6 +621,11 @@
m_value.valueID = CSSValueApplePayButton;
break;
#endif
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+ m_value.valueID = CSSValueColorWell;
+ break;
+#endif
}
}
Modified: trunk/Source/WebCore/css/CSSProperties.json (234787 => 234788)
--- trunk/Source/WebCore/css/CSSProperties.json 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/css/CSSProperties.json 2018-08-12 20:19:25 UTC (rev 234788)
@@ -3793,6 +3793,7 @@
"textarea",
"attachment",
"caps-lock-indicator",
+ "color-well",
"none"
],
"status": {
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (234787 => 234788)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2018-08-12 20:19:25 UTC (rev 234788)
@@ -836,6 +836,9 @@
#if defined(ENABLE_APPLE_PAY) && ENABLE_APPLE_PAY
-apple-pay-button
#endif
+#if defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR
+color-well
+#endif
textarea
#if defined(ENABLE_ATTACHMENT_ELEMENT) && ENABLE_ATTACHMENT_ELEMENT
attachment
Modified: trunk/Source/WebCore/css/html.css (234787 => 234788)
--- trunk/Source/WebCore/css/html.css 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/css/html.css 2018-08-12 20:19:25 UTC (rev 234788)
@@ -873,10 +873,11 @@
input[type="color"] {
#if !(defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS)
- -webkit-appearance: square-button;
+ -webkit-appearance: color-well;
#endif
width: 44px;
height: 23px;
+ outline: none;
}
input[type="color"]::-webkit-color-swatch-wrapper {
@@ -889,7 +890,7 @@
input[type="color"]::-webkit-color-swatch {
background-color: #000000;
- border: 1px solid #777777;
+ border: 1px solid #8A8A8A;
flex: 1;
}
Modified: trunk/Source/WebCore/html/ColorInputType.cpp (234787 => 234788)
--- trunk/Source/WebCore/html/ColorInputType.cpp 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/html/ColorInputType.cpp 2018-08-12 20:19:25 UTC (rev 234788)
@@ -104,6 +104,11 @@
return true;
}
+bool ColorInputType::isPresentingAttachedView() const
+{
+ return !!m_chooser;
+}
+
const AtomicString& ColorInputType::formControlType() const
{
return InputTypeNames::color();
@@ -185,6 +190,11 @@
endColorChooser();
}
+void ColorInputType::elementDidBlur()
+{
+ endColorChooser();
+}
+
bool ColorInputType::shouldRespectListAttribute()
{
return true;
@@ -214,6 +224,8 @@
void ColorInputType::didEndChooser()
{
m_chooser = nullptr;
+ if (element()->renderer())
+ element()->renderer()->repaint();
}
void ColorInputType::endColorChooser()
Modified: trunk/Source/WebCore/html/ColorInputType.h (234787 => 234788)
--- trunk/Source/WebCore/html/ColorInputType.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/html/ColorInputType.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -54,6 +54,7 @@
bool isMouseFocusable() const final;
bool isKeyboardFocusable(KeyboardEvent*) const final;
bool isColorControl() const final;
+ bool isPresentingAttachedView() const final;
const AtomicString& formControlType() const final;
bool supportsRequired() const final;
String fallbackValue() const final;
@@ -62,6 +63,7 @@
void setValue(const String&, bool valueChanged, TextFieldEventBehavior) final;
void handleDOMActivateEvent(Event&) final;
void detach() final;
+ void elementDidBlur() final;
bool shouldRespectListAttribute() final;
bool typeMismatchFor(const String&) const final;
bool shouldResetOnDocumentActivation() final;
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (234787 => 234788)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2018-08-12 20:19:25 UTC (rev 234788)
@@ -1631,6 +1631,11 @@
#endif // ENABLE(DATALIST_ELEMENT)
+bool HTMLInputElement::isPresentingAttachedView() const
+{
+ return m_inputType->isPresentingAttachedView();
+}
+
bool HTMLInputElement::isSteppable() const
{
return m_inputType->isSteppable();
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (234787 => 234788)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -93,6 +93,8 @@
WEBCORE_EXPORT ExceptionOr<void> stepUp(int = 1);
WEBCORE_EXPORT ExceptionOr<void> stepDown(int = 1);
+ bool isPresentingAttachedView() const;
+
// stepUp()/stepDown() for user-interaction.
bool isSteppable() const;
Modified: trunk/Source/WebCore/html/InputType.cpp (234787 => 234788)
--- trunk/Source/WebCore/html/InputType.cpp 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/html/InputType.cpp 2018-08-12 20:19:25 UTC (rev 234788)
@@ -941,6 +941,11 @@
return false;
}
+bool InputType::isPresentingAttachedView() const
+{
+ return false;
+}
+
bool InputType::supportsSelectionAPI() const
{
return false;
Modified: trunk/Source/WebCore/html/InputType.h (234787 => 234788)
--- trunk/Source/WebCore/html/InputType.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/html/InputType.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -263,6 +263,7 @@
virtual String defaultToolTip() const;
virtual bool matchesIndeterminatePseudoClass() const;
virtual bool shouldAppearIndeterminate() const;
+ virtual bool isPresentingAttachedView() const;
virtual bool supportsSelectionAPI() const;
virtual Color valueAsColor() const;
virtual void selectColor(StringView);
Modified: trunk/Source/WebCore/platform/ControlStates.h (234787 => 234788)
--- trunk/Source/WebCore/platform/ControlStates.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/platform/ControlStates.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -53,6 +53,7 @@
WindowInactiveState = 1 << 6,
IndeterminateState = 1 << 7,
SpinUpState = 1 << 8, // Sub-state for HoverState and PressedState.
+ PresentingState = 1 << 9,
AllStates = 0xffffffff
};
Modified: trunk/Source/WebCore/platform/ThemeTypes.h (234787 => 234788)
--- trunk/Source/WebCore/platform/ThemeTypes.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/platform/ThemeTypes.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -51,6 +51,9 @@
#if ENABLE(APPLE_PAY)
ApplePayButtonPart,
#endif
+#if ENABLE(INPUT_TYPE_COLOR)
+ ColorWellPart,
+#endif
TextAreaPart,
#if ENABLE(ATTACHMENT_ELEMENT)
AttachmentPart, BorderlessAttachmentPart,
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (234787 => 234788)
--- trunk/Source/WebCore/platform/mac/ThemeMac.mm 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm 2018-08-12 20:19:25 UTC (rev 234788)
@@ -212,6 +212,10 @@
[(NSButtonCell*)cell _setState:newState animated:useAnimation];
}
+ // Presenting state
+ if (states & ControlStates::PresentingState)
+ [(NSButtonCell*)cell _setHighlighted:YES animated:NO];
+
// Window inactive state does not need to be checked explicitly, since we paint parented to
// a view in a window whose key state can be detected.
}
@@ -492,7 +496,11 @@
{
// Set the control size based off the rectangle we're painting into.
const std::array<IntSize, 3>& sizes = buttonSizes();
- if (part == SquareButtonPart || zoomedSize.height() > buttonSizes()[NSControlSizeRegular].height() * zoomFactor) {
+ if (part == SquareButtonPart
+#if ENABLE(INPUT_TYPE_COLOR)
+ || part == ColorWellPart
+#endif
+ || zoomedSize.height() > buttonSizes()[NSControlSizeRegular].height() * zoomFactor) {
// Use the square button
if ([cell bezelStyle] != NSBezelStyleShadowlessSquare)
[cell setBezelStyle:NSBezelStyleShadowlessSquare];
@@ -699,6 +707,46 @@
return needsRepaint;
}
+// Color Well
+
+#if ENABLE(INPUT_TYPE_COLOR)
+static void paintColorWell(ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+
+ // Determine the width and height needed for the control and prepare the cell for painting.
+ ControlStates::States states = controlStates.states();
+ NSButtonCell *buttonCell = button(ColorWellPart, controlStates, IntSize(zoomedRect.size()), zoomFactor);
+ GraphicsContextStateSaver stateSaver(context);
+
+ NSControlSize controlSize = [buttonCell controlSize];
+ IntSize zoomedSize = buttonSizes()[controlSize];
+ zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored.
+ zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
+ FloatRect inflatedRect = zoomedRect;
+
+ LocalCurrentGraphicsContext localContext(context);
+
+ NSView *view = ThemeMac::ensuredView(scrollView, controlStates);
+ NSWindow *window = [view window];
+ NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell];
+
+ bool useImageBuffer = pageScaleFactor != 1.0f || zoomFactor != 1.0f;
+ bool needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(buttonCell, context, inflatedRect, view, true, states & ControlStates::FocusState, useImageBuffer, deviceScaleFactor);
+ if ([previousDefaultButtonCell isEqual:buttonCell])
+ [window setDefaultButtonCell:nil];
+
+ controlStates.setNeedsRepaint(needsRepaint);
+
+ [buttonCell setControlView:nil];
+
+ if (![previousDefaultButtonCell isEqual:buttonCell])
+ [window setDefaultButtonCell:previousDefaultButtonCell];
+
+ END_BLOCK_OBJC_EXCEPTIONS
+}
+#endif
+
// Theme overrides
int ThemeMac::baselinePositionAdjustment(ControlPart part) const
@@ -749,6 +797,9 @@
{
switch (part) {
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
return { { 0, Fixed }, { static_cast<int>(15 * zoomFactor), Fixed } };
@@ -766,6 +817,9 @@
{
switch (part) {
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
return LengthBox(0, zoomedBox.right().value(), 0, zoomedBox.left().value());
@@ -865,6 +919,11 @@
case SquareButtonPart:
paintButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor);
break;
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+ paintColorWell(states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor);
+ break;
+#endif
case InnerSpinButtonPart:
paintStepper(states, context, zoomedRect, zoomFactor, scrollView);
break;
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (234787 => 234788)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2018-08-12 20:19:25 UTC (rev 234788)
@@ -116,6 +116,9 @@
case RadioPart:
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart: {
// Border
@@ -200,6 +203,9 @@
return adjustRadioStyle(styleResolver, style, element);
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
return adjustButtonStyle(styleResolver, style, element);
@@ -300,6 +306,9 @@
case RadioPart:
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
case InnerSpinButtonPart:
@@ -322,6 +331,9 @@
return paintRadio(box, paintInfo, integralSnappedRect);
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
return paintButton(box, paintInfo, integralSnappedRect);
@@ -450,6 +462,9 @@
case RadioPart:
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
case MenulistPart:
@@ -503,6 +518,9 @@
case PushButtonPart:
return paintPushButtonDecorations(box, paintInfo, integralSnappedRect);
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
return paintSquareButtonDecorations(box, paintInfo, integralSnappedRect);
case ButtonPart:
return paintButtonDecorations(box, paintInfo, integralSnappedRect);
@@ -715,6 +733,9 @@
switch (style.appearance()) {
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
case ListboxPart:
@@ -801,6 +822,8 @@
states |= ControlStates::WindowInactiveState;
if (isIndeterminate(o))
states |= ControlStates::IndeterminateState;
+ if (isPresenting(o))
+ states |= ControlStates::PresentingState;
return states;
}
@@ -885,6 +908,11 @@
return downcast<SpinButtonElement>(*node).upDownState() == SpinButtonElement::Up;
}
+bool RenderTheme::isPresenting(const RenderObject& o) const
+{
+ return is<HTMLInputElement>(o.node()) && downcast<HTMLInputElement>(*o.node()).isPresentingAttachedView();
+}
+
bool RenderTheme::isDefault(const RenderObject& o) const
{
// A button should only have the default appearance if the page is active
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (234787 => 234788)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -404,6 +404,7 @@
bool isSpinUpButtonPartPressed(const RenderObject&) const;
bool isHovered(const RenderObject&) const;
bool isSpinUpButtonPartHovered(const RenderObject&) const;
+ bool isPresenting(const RenderObject&) const;
bool isReadOnlyControl(const RenderObject&) const;
bool isDefault(const RenderObject&) const;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (234787 => 234788)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2018-08-12 20:19:25 UTC (rev 234788)
@@ -872,6 +872,9 @@
case RadioPart:
case PushButtonPart:
case SquareButtonPart:
+#if ENABLE(INPUT_TYPE_COLOR)
+ case ColorWellPart:
+#endif
case DefaultButtonPart:
case ButtonPart:
case InnerSpinButtonPart:
Modified: trunk/Source/WebInspectorUI/ChangeLog (234787 => 234788)
--- trunk/Source/WebInspectorUI/ChangeLog 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-08-12 20:19:25 UTC (rev 234788)
@@ -1,3 +1,15 @@
+2018-08-12 Aditya Keerthi <[email protected]>
+
+ [macOS] Color wells should appear pressed when presenting a color picker
+ https://bugs.webkit.org/show_bug.cgi?id=188477
+
+ Reviewed by Tim Horton.
+
+ Add keyword completion for 'color-well'.
+
+ * UserInterface/External/CodeMirror/css.js:
+ * UserInterface/Models/CSSKeywordCompletions.js:
+
2018-08-09 Nikita Vasilyev <[email protected]>
Web Inspector: Dark Mode: SourceCodeTextEditor error/warning text widget is too light
Modified: trunk/Source/WebInspectorUI/UserInterface/External/CodeMirror/css.js (234787 => 234788)
--- trunk/Source/WebInspectorUI/UserInterface/External/CodeMirror/css.js 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebInspectorUI/UserInterface/External/CodeMirror/css.js 2018-08-12 20:19:25 UTC (rev 234788)
@@ -597,7 +597,7 @@
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
- "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
+ "col-resize", "collapse", "color", "color-burn", "color-dodge", "color-well", "column", "column-reverse",
"compact", "condensed", "contain", "content", "contents",
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js (234787 => 234788)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js 2018-08-12 20:19:25 UTC (rev 234788)
@@ -1040,7 +1040,7 @@
],
/*
"-webkit-appearance": [
- "none", "checkbox", "radio", "push-button", "square-button", "button", "button-bevel", "default-button", "inner-spin-button", "listbox", "listitem", "media-enter-fullscreen-button", "media-exit-fullscreen-button", "media-fullscreen-volume-slider", "media-fullscreen-volume-slider-thumb", "media-mute-button", "media-play-button", "media-overlay-play-button", "media-seek-back-button", "media-seek-forward-button", "media-rewind-button", "media-return-to-realtime-button", "media-toggle-closed-captions-button", "media-slider", "media-sliderthumb", "media-volume-slider-container", "media-volume-slider", "media-volume-sliderthumb", "media-volume-slider-mute-button", "media-controls
-background", "media-controls-fullscreen-background", "media-current-time-display", "media-time-remaining-display", "menulist", "menulist-button", "menulist-text", "menulist-textfield", "meter", "progress-bar", "progress-bar-value", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "caret", "searchfield", "searchfield-decoration", "searchfield-results-decoration", "searchfield-results-button", "searchfield-cancel-button", "snapshotted-plugin-overlay", "textfield", "relevancy-level-indicator", "continuous-capacity-level-indicator", "discrete-capacity-level-indicator", "rating-level-indicator", "textarea", "attachment", "caps-lock-indicator"
+ "none", "checkbox", "radio", "push-button", "square-button", "button", "button-bevel", "default-button", "inner-spin-button", "listbox", "listitem", "media-enter-fullscreen-button", "media-exit-fullscreen-button", "media-fullscreen-volume-slider", "media-fullscreen-volume-slider-thumb", "media-mute-button", "media-play-button", "media-overlay-play-button", "media-seek-back-button", "media-seek-forward-button", "media-rewind-button", "media-return-to-realtime-button", "media-toggle-closed-captions-button", "media-slider", "media-sliderthumb", "media-volume-slider-container", "media-volume-slider", "media-volume-sliderthumb", "media-volume-slider-mute-button", "media-controls-
background", "media-controls-fullscreen-background", "media-current-time-display", "media-time-remaining-display", "menulist", "menulist-button", "menulist-text", "menulist-textfield", "meter", "progress-bar", "progress-bar-value", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "caret", "searchfield", "searchfield-decoration", "searchfield-results-decoration", "searchfield-results-button", "searchfield-cancel-button", "snapshotted-plugin-overlay", "textfield", "relevancy-level-indicator", "continuous-capacity-level-indicator", "discrete-capacity-level-indicator", "rating-level-indicator", "textarea", "attachment", "caps-lock-indicator", "color-we
ll"
],
*/
"-webkit-animation-trigger": [
Modified: trunk/Source/WebKit/ChangeLog (234787 => 234788)
--- trunk/Source/WebKit/ChangeLog 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebKit/ChangeLog 2018-08-12 20:19:25 UTC (rev 234788)
@@ -1,3 +1,39 @@
+2018-08-12 Aditya Keerthi <[email protected]>
+
+ [macOS] Color wells should appear pressed when presenting a color picker
+ https://bugs.webkit.org/show_bug.cgi?id=188477
+
+ Reviewed by Tim Horton.
+
+ In order for the color well to accurately reflect the state of the picker, it is
+ necessary to ensure that the picker is destroyed at the appropriate time.
+
+ Added windowWillClose and didClosePopover delegate methods to destroy the picker
+ it has been closed. Also added a call to WebColorPicker::endPicker in
+ WebColorPickerMac's implementation of endPicker to ensure that the object is
+ destroyed. Removed redundant calls to endPicker in the WebPageProxy.
+
+ The hitTest method was overridden in WKPopoverColorWell to ensure that AppKit's
+ view does not block our drawn color well from receiving click events.
+
+ * UIProcess/WebColorPicker.cpp:
+ (WebKit::WebColorPicker::endPicker):
+ * UIProcess/WebColorPicker.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::endColorPicker):
+ (WebKit::WebPageProxy::didEndColorPicker):
+ (WebKit::WebPageProxy::resetState):
+ (WebKit::WebPageProxy::closeOverlayedViews):
+ * UIProcess/mac/WebColorPickerMac.mm:
+ (WebKit::WebColorPickerMac::~WebColorPickerMac):
+ (WebKit::WebColorPickerMac::endPicker):
+ (-[WKPopoverColorWell popoverDidClose:]):
+ (-[WKPopoverColorWell hitTest:]):
+ (-[WKColorPopoverMac setAndShowPicker:withColor:suggestions:]):
+ (-[WKColorPopoverMac invalidate]):
+ (-[WKColorPopoverMac windowWillClose:]):
+ (-[WKColorPopoverMac didClosePopover]):
+
2018-08-10 David Kilzer <[email protected]>
[Cocoa] WebKit::PlatformPopupMenuData should use member initialization
Modified: trunk/Source/WebKit/UIProcess/WebColorPicker.cpp (234787 => 234788)
--- trunk/Source/WebKit/UIProcess/WebColorPicker.cpp 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebKit/UIProcess/WebColorPicker.cpp 2018-08-12 20:19:25 UTC (rev 234788)
@@ -39,12 +39,6 @@
{
}
-void WebColorPicker::invalidate()
-{
- endPicker();
- m_client = 0;
-}
-
void WebColorPicker::endPicker()
{
if (!m_client)
@@ -51,6 +45,7 @@
return;
m_client->didEndColorPicker();
+ m_client = nullptr;
}
void WebColorPicker::setSelectedColor(const WebCore::Color& color)
Modified: trunk/Source/WebKit/UIProcess/WebColorPicker.h (234787 => 234788)
--- trunk/Source/WebKit/UIProcess/WebColorPicker.h 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebKit/UIProcess/WebColorPicker.h 2018-08-12 20:19:25 UTC (rev 234788)
@@ -56,8 +56,6 @@
virtual ~WebColorPicker();
- void invalidate();
-
virtual void endPicker();
virtual void setSelectedColor(const WebCore::Color&);
virtual void showColorPicker(const WebCore::Color&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (234787 => 234788)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-12 20:19:25 UTC (rev 234788)
@@ -4800,7 +4800,8 @@
void WebPageProxy::endColorPicker()
{
- ASSERT(m_colorPicker);
+ if (!m_colorPicker)
+ return;
m_colorPicker->endPicker();
}
@@ -4818,13 +4819,7 @@
if (!isValid())
return;
-#if ENABLE(INPUT_TYPE_COLOR)
- if (m_colorPicker) {
- m_colorPicker->invalidate();
- m_colorPicker = nullptr;
- }
-#endif
-
+ m_colorPicker = nullptr;
m_process->send(Messages::WebPage::DidEndColorPicker(), m_pageID);
}
#endif
@@ -6113,13 +6108,6 @@
m_touchEventTracking.reset();
#endif
-#if ENABLE(INPUT_TYPE_COLOR)
- if (m_colorPicker) {
- m_colorPicker->invalidate();
- m_colorPicker = nullptr;
- }
-#endif
-
#if ENABLE(GEOLOCATION)
m_geolocationPermissionRequestManager.invalidateRequests();
#endif
@@ -7657,8 +7645,7 @@
#endif
#if ENABLE(INPUT_TYPE_COLOR_POPOVER) && ENABLE(INPUT_TYPE_COLOR)
- if (m_colorPicker)
- endColorPicker();
+ endColorPicker();
#endif
}
Modified: trunk/Source/WebKit/UIProcess/mac/WebColorPickerMac.mm (234787 => 234788)
--- trunk/Source/WebKit/UIProcess/mac/WebColorPickerMac.mm 2018-08-12 16:36:51 UTC (rev 234787)
+++ trunk/Source/WebKit/UIProcess/mac/WebColorPickerMac.mm 2018-08-12 20:19:25 UTC (rev 234788)
@@ -52,14 +52,20 @@
static const CGFloat colorPickerMatrixSwatchWidth = 12.0;
static const CGFloat colorPickerMatrixBorderWidth = 1.0;
+@protocol WKPopoverColorWellDelegate <NSObject>
+- (void)didClosePopover;
+@end
+
@interface WKPopoverColorWell : NSPopoverColorWell {
RetainPtr<NSColorList> _suggestedColors;
}
+@property (nonatomic, weak) id<WKPopoverColorWellDelegate> webDelegate;
+
- (void)setSuggestedColors:(NSColorList *)suggestedColors;
@end
-@interface WKColorPopoverMac : NSObject<WKColorPickerUIMac, NSWindowDelegate> {
+@interface WKColorPopoverMac : NSObject<WKColorPickerUIMac, WKPopoverColorWellDelegate, NSWindowDelegate> {
@private
BOOL _lastChangedByUser;
WebColorPickerMac *_picker;
@@ -89,8 +95,10 @@
WebColorPickerMac::~WebColorPickerMac()
{
- if (m_colorPickerUI)
- endPicker();
+ if (m_colorPickerUI) {
+ [m_colorPickerUI invalidate];
+ m_colorPickerUI = nil;
+ }
}
WebColorPickerMac::WebColorPickerMac(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, Vector<WebCore::Color>&& suggestions, NSView *view)
@@ -108,6 +116,7 @@
{
[m_colorPickerUI invalidate];
m_colorPickerUI = nil;
+ WebColorPicker::endPicker();
}
void WebColorPickerMac::setSelectedColor(const WebCore::Color& color)
@@ -198,6 +207,15 @@
[popover showRelativeToRect:self.bounds ofView:self preferredEdge:NSMinYEdge];
}
+- (void)popoverDidClose:(NSNotification *)notification {
+ [self.webDelegate didClosePopover];
+}
+
+- (NSView *)hitTest:(NSPoint)point
+{
+ return nil;
+}
+
- (void)setSuggestedColors:(NSColorList *)suggestedColors
{
_suggestedColors = suggestedColors;
@@ -226,6 +244,7 @@
_picker = picker;
[_popoverWell setTarget:self];
+ [_popoverWell setWebDelegate:self];
[_popoverWell setAction:@selector(didChooseColor:)];
[_popoverWell setColor:color];
@@ -238,15 +257,11 @@
[_popoverWell setSuggestedColors:suggestedColors];
[_popoverWell _showPopover];
+
+ [[NSColorPanel sharedColorPanel] setDelegate:self];
_lastChangedByUser = YES;
}
-- (void)dealloc
-{
- ASSERT(!_popoverWell);
- ASSERT(!_picker);
- [super dealloc];
-}
- (void)invalidate
{
@@ -254,14 +269,26 @@
[_popoverWell setTarget:nil];
[_popoverWell setAction:nil];
[_popoverWell deactivate];
+
_popoverWell = nil;
_picker = nil;
+
+ NSColorPanel *panel = [NSColorPanel sharedColorPanel];
+ if (panel.delegate == self) {
+ panel.delegate = nil;
+ [panel close];
+ }
}
- (void)windowWillClose:(NSNotification *)notification
{
- _lastChangedByUser = YES;
- _picker->endPicker();
+ if (!_picker)
+ return;
+
+ if (notification.object == [NSColorPanel sharedColorPanel]) {
+ _lastChangedByUser = YES;
+ _picker->endPicker();
+ }
}
- (void)didChooseColor:(id)sender
@@ -284,6 +311,15 @@
[_popoverWell setColor:color];
}
+- (void)didClosePopover
+{
+ if (!_picker)
+ return;
+
+ if (![NSColorPanel sharedColorPanel].isVisible)
+ _picker->endPicker();
+}
+
@end
#else