Title: [174283] trunk/Source/WebCore
- Revision
- 174283
- Author
- [email protected]
- Date
- 2014-10-03 13:27:28 -0700 (Fri, 03 Oct 2014)
Log Message
webkit-appearance: default-button styling does not set the button font color to white
https://bugs.webkit.org/show_bug.cgi?id=137399
rdar://problem/17788616
Reviewed by Dave Hyatt.
When a button is styled with -webkit-appearance: default-button, it should
use the CSSValueActivebuttontext value for its text color when the window
is active, and the normal value when the window is inactive.
Since activating (focus/blur) windows doesn't cause a style recalculation, this
is applied as a paint-time operation. However, the render tree children that
paint the text don't know that they are contained within a RenderButton
and that the button is a default type. So I added an inherited flag, similar
to what we use for visited links, to remember if we're in a button. And then
computeTextPaintStyle chooses the correct value.
We can't test this because our LayoutTest system doesn't have
an active window, and thus the default button renders like a normal
button. This should cause no regressions though. Also, the appearance is
protected behind an SPI (or Setting), so this is not exposed to the Web.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle): Set the flag if we're inside a default button.
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle): If we're in a default button inside an active window,
use the CSSValueActivebuttontext color.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::RenderStyle): Add and expose the new inherited flag: ._insideDefaultButton.
(WebCore::RenderStyle::changeRequiresRepaint): Ditto.
* rendering/style/RenderStyle.h: Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (174282 => 174283)
--- trunk/Source/WebCore/ChangeLog 2014-10-03 20:26:41 UTC (rev 174282)
+++ trunk/Source/WebCore/ChangeLog 2014-10-03 20:27:28 UTC (rev 174283)
@@ -1,3 +1,37 @@
+2014-10-03 Dean Jackson <[email protected]>
+
+ webkit-appearance: default-button styling does not set the button font color to white
+ https://bugs.webkit.org/show_bug.cgi?id=137399
+ rdar://problem/17788616
+
+ Reviewed by Dave Hyatt.
+
+ When a button is styled with -webkit-appearance: default-button, it should
+ use the CSSValueActivebuttontext value for its text color when the window
+ is active, and the normal value when the window is inactive.
+
+ Since activating (focus/blur) windows doesn't cause a style recalculation, this
+ is applied as a paint-time operation. However, the render tree children that
+ paint the text don't know that they are contained within a RenderButton
+ and that the button is a default type. So I added an inherited flag, similar
+ to what we use for visited links, to remember if we're in a button. And then
+ computeTextPaintStyle chooses the correct value.
+
+ We can't test this because our LayoutTest system doesn't have
+ an active window, and thus the default button renders like a normal
+ button. This should cause no regressions though. Also, the appearance is
+ protected behind an SPI (or Setting), so this is not exposed to the Web.
+
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustStyle): Set the flag if we're inside a default button.
+ * rendering/TextPaintStyle.cpp:
+ (WebCore::computeTextPaintStyle): If we're in a default button inside an active window,
+ use the CSSValueActivebuttontext color.
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::RenderStyle): Add and expose the new inherited flag: ._insideDefaultButton.
+ (WebCore::RenderStyle::changeRequiresRepaint): Ditto.
+ * rendering/style/RenderStyle.h: Ditto.
+
2014-09-28 Myles C. Maxfield <[email protected]>
[SVG -> OTF Converter] Support non-BMP codepoints
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (174282 => 174283)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2014-10-03 20:26:41 UTC (rev 174282)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2014-10-03 20:27:28 UTC (rev 174283)
@@ -177,6 +177,8 @@
if (style.setFontDescription(controlFont))
style.font().update(0);
}
+
+ style.setInsideDefaultButton(part == DefaultButtonPart);
}
break;
default:
Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (174282 => 174283)
--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp 2014-10-03 20:26:41 UTC (rev 174282)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp 2014-10-03 20:27:28 UTC (rev 174283)
@@ -26,11 +26,14 @@
#include "config.h"
#include "TextPaintStyle.h"
+#include "FocusController.h"
#include "Frame.h"
#include "GraphicsContext.h"
+#include "Page.h"
#include "PaintInfo.h"
#include "RenderStyle.h"
#include "RenderText.h"
+#include "RenderTheme.h"
#include "RenderView.h"
#include "Settings.h"
@@ -86,6 +89,15 @@
paintStyle.emphasisMarkColor = paintInfo.forcedTextColor();
return paintStyle;
}
+
+ if (lineStyle.insideDefaultButton()) {
+ Page* page = renderer.frame().page();
+ if (page && page->focusController().isActive()) {
+ paintStyle.fillColor = renderer.theme().systemColor(CSSValueActivebuttontext);
+ return paintStyle;
+ }
+ }
+
paintStyle.fillColor = lineStyle.visitedDependentColor(CSSPropertyWebkitTextFillColor);
bool forceBackgroundToWhite = false;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (174282 => 174283)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2014-10-03 20:26:41 UTC (rev 174282)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2014-10-03 20:27:28 UTC (rev 174283)
@@ -149,6 +149,7 @@
inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
inherited_flags._pointerEvents = initialPointerEvents();
inherited_flags._insideLink = NotInsideLink;
+ inherited_flags._insideDefaultButton = false;
inherited_flags.m_writingMode = initialWritingMode();
static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags does not grow");
@@ -714,6 +715,7 @@
if (inherited_flags._visibility != other->inherited_flags._visibility
|| inherited_flags.m_printColorAdjust != other->inherited_flags.m_printColorAdjust
|| inherited_flags._insideLink != other->inherited_flags._insideLink
+ || inherited_flags._insideDefaultButton != other->inherited_flags._insideDefaultButton
|| surround->border != other->surround->border
|| !m_background->isEquivalentForPainting(*other->m_background)
|| rareInheritedData->userModify != other->rareInheritedData->userModify
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (174282 => 174283)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2014-10-03 20:26:41 UTC (rev 174282)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2014-10-03 20:27:28 UTC (rev 174283)
@@ -436,6 +436,7 @@
&& (m_printColorAdjust == other.m_printColorAdjust)
&& (_pointerEvents == other._pointerEvents)
&& (_insideLink == other._insideLink)
+ && (_insideDefaultButton == other._insideDefaultButton)
&& (m_writingMode == other.m_writingMode);
}
@@ -464,11 +465,12 @@
unsigned m_printColorAdjust : PrintColorAdjustBits;
unsigned _pointerEvents : 4; // EPointerEvents
unsigned _insideLink : 2; // EInsideLink
- // 43 bits
+ unsigned _insideDefaultButton : 1;
+ // 44 bits
// CSS Text Layout Module Level 3: Vertical writing support
unsigned m_writingMode : 2; // WritingMode
- // 45 bits
+ // 46 bits
} inherited_flags;
// don't inherit
@@ -855,6 +857,8 @@
EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
bool isLink() const { return noninherited_flags.isLink(); }
+ bool insideDefaultButton() const { return inherited_flags._insideDefaultButton; }
+
short widows() const { return rareInheritedData->widows; }
short orphans() const { return rareInheritedData->orphans; }
bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; }
@@ -1415,6 +1419,8 @@
void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
void setIsLink(bool b) { noninherited_flags.setIsLink(b); }
+ void setInsideDefaultButton(bool insideDefaultButton) { inherited_flags._insideDefaultButton = insideDefaultButton; }
+
PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); }
void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes