[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
adele at apple.com
adele at apple.com
Thu Dec 3 13:25:10 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 3353a74b508241f15553d3757333337248adf8c4
Author: adele at apple.com <adele at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 3 02:07:51 2009 +0000
Fix for <rdar://problem/7038305> REGRESSION (Safari 4.0.2 - ToT): After navigating back to a known phishy page, the "Ignore warning" button appears highlighted (along with the "Go Back" button)
Reviewed by Darin Adler.
This bug is timing dependent, and not always reproducible. I could not think of a way to add a
layout test that would demonstrate the problem and fix.
* platform/mac/ThemeMac.mm:
(WebCore::checkbox): Update style.
(WebCore::paintCheckbox): ditto.
(WebCore::radio): ditto.
(WebCore::paintRadio): ditto.
(WebCore::setupButtonCell): Added convenience method.
(WebCore::button): Use a separate NSButtonCell for defaultButtons and regular buttons.
(WebCore::paintButton): Don't check for the key window here. Consider that when deciding if the button should have the default style in RenderTheme.
* rendering/RenderTheme.cpp: (WebCore::RenderTheme::isDefault): Only consider a button to be default if the page is active. This fixes
a problem I noticed where the button would flicker crazily if the page with the default button was in the background.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bae6942..4ba7f0c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-02 Adele Peterson <adele at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix for <rdar://problem/7038305> REGRESSION (Safari 4.0.2 - ToT): After navigating back to a known phishy page, the "Ignore warning" button appears highlighted (along with the "Go Back" button)
+
+ This bug is timing dependent, and not always reproducible. I could not think of a way to add a
+ layout test that would demonstrate the problem and fix.
+
+ * platform/mac/ThemeMac.mm:
+ (WebCore::checkbox): Update style.
+ (WebCore::paintCheckbox): ditto.
+ (WebCore::radio): ditto.
+ (WebCore::paintRadio): ditto.
+ (WebCore::setupButtonCell): Added convenience method.
+ (WebCore::button): Use a separate NSButtonCell for defaultButtons and regular buttons.
+ (WebCore::paintButton): Don't check for the key window here. Consider that when deciding if the button should have the default style in RenderTheme.
+ * rendering/RenderTheme.cpp: (WebCore::RenderTheme::isDefault): Only consider a button to be default if the page is active. This fixes
+ a problem I noticed where the button would flicker crazily if the page with the default button was in the background.
+
2009-11-02 Dan Bernstein <mitz at apple.com>
Reviewed by Anders Carlsson.
diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm
index fd2f944..a95fee4 100644
--- a/WebCore/platform/mac/ThemeMac.mm
+++ b/WebCore/platform/mac/ThemeMac.mm
@@ -173,9 +173,9 @@ static LengthSize checkboxSize(const Font& font, const LengthSize& zoomedSize, f
return sizeFromFont(font, zoomedSize, zoomFactor, checkboxSizes());
}
-static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- static NSButtonCell* checkboxCell;
+ static NSButtonCell *checkboxCell;
if (!checkboxCell) {
checkboxCell = [[NSButtonCell alloc] init];
[checkboxCell setButtonType:NSSwitchButton];
@@ -199,7 +199,7 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const
BEGIN_BLOCK_OBJC_EXCEPTIONS
// Determine the width and height needed for the control and prepare the cell for painting.
- NSButtonCell* checkboxCell = checkbox(states, zoomedRect, zoomFactor);
+ NSButtonCell *checkboxCell = checkbox(states, zoomedRect, zoomFactor);
context->save();
@@ -254,9 +254,9 @@ static LengthSize radioSize(const Font& font, const LengthSize& zoomedSize, floa
return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes());
}
-static NSButtonCell* radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- static NSButtonCell* radioCell;
+ static NSButtonCell *radioCell;
if (!radioCell) {
radioCell = [[NSButtonCell alloc] init];
[radioCell setButtonType:NSRadioButton];
@@ -276,7 +276,7 @@ static NSButtonCell* radio(ControlStates states, const IntRect& zoomedRect, floa
static void paintRadio(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
{
// Determine the width and height needed for the control and prepare the cell for painting.
- NSButtonCell* radioCell = radio(states, zoomedRect, zoomFactor);
+ NSButtonCell *radioCell = radio(states, zoomedRect, zoomFactor);
context->save();
@@ -330,14 +330,14 @@ static const int* buttonMargins(NSControlSize controlSize)
return margins[controlSize];
}
-static NSButtonCell* button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+static void setupButtonCell(NSButtonCell *&buttonCell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- static NSButtonCell *buttonCell;
- static bool defaultButton;
if (!buttonCell) {
buttonCell = [[NSButtonCell alloc] init];
[buttonCell setTitle:nil];
[buttonCell setButtonType:NSMomentaryPushInButton];
+ if (states & DefaultState)
+ [buttonCell setKeyEquivalent:@"\r"];
}
// Set the control size based off the rectangle we're painting into.
@@ -357,15 +357,16 @@ static NSButtonCell* button(ControlPart part, ControlStates states, const IntRec
setControlSize(buttonCell, buttonSizes(), zoomedRect.size(), zoomFactor);
- if (defaultButton != (states & DefaultState)) {
- defaultButton = !defaultButton;
- [buttonCell setKeyEquivalent:(defaultButton ? @"\r" : @"")];
- }
-
// Update the various states we respond to.
updateStates(buttonCell, states);
+}
- return buttonCell;
+static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+{
+ bool isDefault = states & DefaultState;
+ static NSButtonCell *cells[2];
+ setupButtonCell(cells[isDefault], part, states, zoomedRect, zoomFactor);
+ return cells[isDefault];
}
static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
@@ -408,7 +409,7 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
NSWindow *window = [view window];
NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell];
- if ((states & DefaultState) && [window isKeyWindow]) {
+ if (states & DefaultState) {
[window setDefaultButtonCell:buttonCell];
wkAdvanceDefaultButtonPulseAnimation(buttonCell);
} else if ([previousDefaultButtonCell isEqual:buttonCell])
diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp
index 5ee01e4..81f9052 100644
--- a/WebCore/rendering/RenderTheme.cpp
+++ b/WebCore/rendering/RenderTheme.cpp
@@ -701,6 +701,10 @@ bool RenderTheme::isHovered(const RenderObject* o) const
bool RenderTheme::isDefault(const RenderObject* o) const
{
+ // A button should only have the default appearance if the page is active
+ if (!isActive(o))
+ return false;
+
if (!o->document())
return false;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list