<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161850] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161850">161850</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2014-01-12 18:27:42 -0800 (Sun, 12 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add type checking to isEqual methods
https://bugs.webkit.org/show_bug.cgi?id=126862
Reviewed by Anders Carlsson.
Source/WebCore:
* page/ios/WebEventRegion.mm:
(-[WebEventRegion isEqual:]): Add type checking on the argument.
Add a FIXME about the lack of a hash method override. Formatted to match
the usual WebKit coding style.
Source/WebKit/ios:
* WebCoreSupport/WebVisiblePosition.mm:
(-[WebVisiblePosition isEqual:]): Add type checking on the argument.
Add a FIXME about the lack of a hash method override. Simplified by
removing the unneeded local variables.
Source/WebKit/mac:
* WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin isEqual:]): Added a FIXME about the lack of a hash method
override. Tweaked formatting.
* WebView/WebDashboardRegion.mm:
(-[WebDashboardRegion isEqual:]): Added type checking on the argument. Added a
FIXME about the lack of a hash method override.
Source/WebKit2:
* UIProcess/API/ios/WKInteractionView.mm:
(-[WKTextRange isEqual:]): Added type checking for the argument. The old
code asserted instead, and it's not clear what guarantees that assertion is
true. Added a FIXME about the lack of a hash method. Added another FIXME
about the fact that this method ignores much of the object state. Removed
an unneeded extra fetch of the isRange property. Deleted some dead code.
(-[WKTextPosition isEqual:]): Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageiosWebEventRegionmm">trunk/Source/WebCore/page/ios/WebEventRegion.mm</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebVisiblePositionmm">trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebSecurityOriginmm">trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDashboardRegionmm">trunk/Source/WebKit/mac/WebView/WebDashboardRegion.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKInteractionViewmm">trunk/Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebCore/ChangeLog        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-01-12 Darin Adler <darin@apple.com>
+
+ Add type checking to isEqual methods
+ https://bugs.webkit.org/show_bug.cgi?id=126862
+
+ Reviewed by Anders Carlsson.
+
+ * page/ios/WebEventRegion.mm:
+ (-[WebEventRegion isEqual:]): Add type checking on the argument.
+ Add a FIXME about the lack of a hash method override. Formatted to match
+ the usual WebKit coding style.
+
</ins><span class="cx"> 2014-01-12 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Try to fix the 32-bit build.
</span></span></pre></div>
<a id="trunkSourceWebCorepageiosWebEventRegionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ios/WebEventRegion.mm (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ios/WebEventRegion.mm        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebCore/page/ios/WebEventRegion.mm        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -66,12 +66,16 @@
</span><span class="cx"> return [self quad].containsPoint(point);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into an NSSet or is the key in an NSDictionary,
+// since two equal objects could have different hashes.
</ins><span class="cx"> - (BOOL)isEqual:(id)other
</span><span class="cx"> {
</span><del>- return CGPointEqualToPoint(p1, ((WebEventRegion *)other)->p1) &&
- CGPointEqualToPoint(p2, ((WebEventRegion *)other)->p2) &&
- CGPointEqualToPoint(p3, ((WebEventRegion *)other)->p3) &&
- CGPointEqualToPoint(p4, ((WebEventRegion *)other)->p4);
</del><ins>+ if (![other isKindOfClass:[WebEventRegion class]])
+ return NO;
+ return CGPointEqualToPoint(p1, ((WebEventRegion *)other)->p1)
+ && CGPointEqualToPoint(p2, ((WebEventRegion *)other)->p2)
+ && CGPointEqualToPoint(p3, ((WebEventRegion *)other)->p3)
+ && CGPointEqualToPoint(p4, ((WebEventRegion *)other)->p4);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (FloatQuad)quad
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit/ios/ChangeLog        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-01-12 Darin Adler <darin@apple.com>
+
+ Add type checking to isEqual methods
+ https://bugs.webkit.org/show_bug.cgi?id=126862
+
+ Reviewed by Anders Carlsson.
+
+ * WebCoreSupport/WebVisiblePosition.mm:
+ (-[WebVisiblePosition isEqual:]): Add type checking on the argument.
+ Add a FIXME about the lack of a hash method override. Simplified by
+ removing the unneeded local variables.
+
</ins><span class="cx"> 2014-01-02 Andy Estes <aestes@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Upstream remainder of minimal-ui viewport changes
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebVisiblePositionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebVisiblePosition.mm        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -87,11 +87,13 @@
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (BOOL)isEqual:(WebVisiblePosition *)other
</del><ins>+// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into an NSSet or is the key in an NSDictionary,
+// since two equal objects could have different hashes.
+- (BOOL)isEqual:(id)other
</ins><span class="cx"> {
</span><del>- VisiblePosition myVP = [self _visiblePosition];
- VisiblePosition otherVP = [other _visiblePosition];
- return (myVP == otherVP);
</del><ins>+ if (![other isKindOfClass:[WebVisiblePosition class]])
+ return NO;
+ return [self _visiblePosition] == [(WebVisiblePosition *)other _visiblePosition];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSComparisonResult)compare:(WebVisiblePosition *)other
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-01-12 Darin Adler <darin@apple.com>
+
+ Add type checking to isEqual methods
+ https://bugs.webkit.org/show_bug.cgi?id=126862
+
+ Reviewed by Anders Carlsson.
+
+ * WebCoreSupport/WebSecurityOrigin.mm:
+ (-[WebSecurityOrigin isEqual:]): Added a FIXME about the lack of a hash method
+ override. Tweaked formatting.
+
+ * WebView/WebDashboardRegion.mm:
+ (-[WebDashboardRegion isEqual:]): Added type checking on the argument. Added a
+ FIXME about the lack of a hash method override.
+
</ins><span class="cx"> 2014-01-11 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> [Mac] [Windows] Stop scheduling network requests in WebCore
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebSecurityOriginmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -89,11 +89,12 @@
</span><span class="cx"> return reinterpret_cast<SecurityOrigin*>(_private)->port();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into an NSSet or is the key in an NSDictionary,
+// since two equal objects could have different hashes.
</ins><span class="cx"> - (BOOL)isEqual:(id)anObject
</span><span class="cx"> {
</span><del>- if (![anObject isMemberOfClass:[WebSecurityOrigin class]]) {
</del><ins>+ if (![anObject isMemberOfClass:[WebSecurityOrigin class]])
</ins><span class="cx"> return NO;
</span><del>- }
</del><span class="cx">
</span><span class="cx"> return [self _core]->equal([anObject _core]);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDashboardRegionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDashboardRegion.mm (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDashboardRegion.mm        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit/mac/WebView/WebDashboardRegion.mm        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -80,9 +80,13 @@
</span><span class="cx"> return [NSString stringWithFormat:@"rect:%@ clip:%@ type:%s", NSStringFromRect(rect), NSStringFromRect(clip), typeName(type)];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into a NSSet or is the key in an NSDictionary.
</del><ins>+// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into an NSSet or is the key in an NSDictionary,
+// since two equal objects could have different hashes.
</ins><span class="cx"> - (BOOL)isEqual:(id)other
</span><span class="cx"> {
</span><ins>+ if (![other isKindOfClass:[WebDashboardRegion class]])
+ return NO;
+
</ins><span class="cx"> return NSEqualRects(rect, [other dashboardRegionRect]) && NSEqualRects(clip, [other dashboardRegionClip]) && type == [other dashboardRegionType];
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-01-12 Darin Adler <darin@apple.com>
+
+ Add type checking to isEqual methods
+ https://bugs.webkit.org/show_bug.cgi?id=126862
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/API/ios/WKInteractionView.mm:
+ (-[WKTextRange isEqual:]): Added type checking for the argument. The old
+ code asserted instead, and it's not clear what guarantees that assertion is
+ true. Added a FIXME about the lack of a hash method. Added another FIXME
+ about the fact that this method ignores much of the object state. Removed
+ an unneeded extra fetch of the isRange property. Deleted some dead code.
+ (-[WKTextPosition isEqual:]): Ditto.
+
</ins><span class="cx"> 2014-01-12 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove the last remaining uses of AtomicallyInitializedStatic
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKInteractionViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm (161849 => 161850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm        2014-01-13 02:23:52 UTC (rev 161849)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm        2014-01-13 02:27:42 UTC (rev 161850)
</span><span class="lines">@@ -1515,24 +1515,31 @@
</span><span class="cx"> return !self.isRange;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into an NSSet or is the key in an NSDictionary,
+// since two equal items could have different hashes.
</ins><span class="cx"> - (BOOL)isEqual:(id)other
</span><span class="cx"> {
</span><del>- assert([other isKindOfClass:[WKTextRange class]]);
</del><ins>+ if (![other isKindOfClass:[WKTextRange class]])
+ return NO;
+
</ins><span class="cx"> WKTextRange *otherRange = (WKTextRange *)other;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (self == other)
</span><span class="cx"> return YES;
</span><del>-
</del><ins>+
+ // FIXME: Probably incorrect for equality to ignore so much of the object state.
+ // It ignores isNone, isEditable, selectedTextLength, and selectionRects.
+
</ins><span class="cx"> if (self.isRange) {
</span><span class="cx"> if (!otherRange.isRange)
</span><span class="cx"> return NO;
</span><span class="cx"> return CGRectEqualToRect(self.startRect, otherRange.startRect) && CGRectEqualToRect(self.endRect, otherRange.endRect);
</span><del>- } else if (!self.isRange) {
</del><ins>+ } else {
</ins><span class="cx"> if (otherRange.isRange)
</span><span class="cx"> return NO;
</span><ins>+ // FIXME: Do we need to check isNone here?
</ins><span class="cx"> return CGRectEqualToRect(self.startRect, otherRange.startRect);
</span><span class="cx"> }
</span><del>- return otherRange.isNone;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -1548,9 +1555,13 @@
</span><span class="cx"> return [pos autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into a NSSet or is the key in an NSDictionary,
+// since two equal items could have different hashes.
</ins><span class="cx"> - (BOOL)isEqual:(id)other
</span><span class="cx"> {
</span><del>- assert([other isKindOfClass:[self class]]);
</del><ins>+ if (![object isKindOfClass:[WKTextPosition class]])
+ return NO;
+
</ins><span class="cx"> return CGRectEqualToRect(self.positionRect, ((WKTextPosition *)other).positionRect);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>