[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Thu Apr 8 02:10:26 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 8fc5f5509d9509f86d4b8de0db21dedb76d03438
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Mar 4 22:31:15 2010 +0000

    2010-03-04  Simon Fraser  <simon.fraser at apple.com>
    
            Build fix.
    
            const long long cMaxDistance = numeric_limits<long long>::max() created global
            initializers at the call sites, so replace with an inline function.
    
            * page/FocusController.cpp:
            (WebCore::updateFocusCandidateIfCloser):
            * page/SpatialNavigation.cpp:
            (WebCore::distanceInDirection):
            * page/SpatialNavigation.h:
            (WebCore::maxDistance):
            (WebCore::FocusCandidate::FocusCandidate):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55554 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b07116e..07f7887 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-04  Simon Fraser  <simon.fraser at apple.com>
+
+        Build fix.
+        
+        const long long cMaxDistance = numeric_limits<long long>::max() created global
+        initializers at the call sites, so replace with an inline function.
+
+        * page/FocusController.cpp:
+        (WebCore::updateFocusCandidateIfCloser):
+        * page/SpatialNavigation.cpp:
+        (WebCore::distanceInDirection):
+        * page/SpatialNavigation.h:
+        (WebCore::maxDistance):
+        (WebCore::FocusCandidate::FocusCandidate):
+
 2010-03-04  Antonio Gomes  <tonikitoo at webkit.org>
 
         Unreviewed attempt to fix Windows build.
diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp
index cd9aa4d..59ac593 100644
--- a/WebCore/page/FocusController.cpp
+++ b/WebCore/page/FocusController.cpp
@@ -351,7 +351,7 @@ static void updateFocusCandidateIfCloser(Node* focusedNode, Node* candidate, lon
         && distance < closestFocusCandidate.parentDistance) {
         closestFocusCandidate.node = candidate;
         closestFocusCandidate.distance = distance;
-        closestFocusCandidate.parentDistance = cMaxDistance;
+        closestFocusCandidate.parentDistance = maxDistance();
     } else if (focusedNode->document() != candidate->document()) {
         // If the |focusedNode| is in an inner document and the |candidate| is
         // in a different document, we only consider to change focus if there is
diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp
index 4c4fafa..c7f16ae 100644
--- a/WebCore/page/SpatialNavigation.cpp
+++ b/WebCore/page/SpatialNavigation.cpp
@@ -51,11 +51,11 @@ long long distanceInDirection(Node* start, Node* dest, FocusDirection direction,
 {
     RenderObject* startRender = start->renderer();
     if (!startRender)
-        return cMaxDistance;
+        return maxDistance();
 
     RenderObject* destRender = dest->renderer();
     if (!destRender)
-        return cMaxDistance;
+        return maxDistance();
 
     IntRect curRect = renderRectRelativeToRootDocument(startRender);
     IntRect targetRect  = renderRectRelativeToRootDocument(destRender);
@@ -66,10 +66,10 @@ long long distanceInDirection(Node* start, Node* dest, FocusDirection direction,
 
     if ((curRect.isEmpty() || targetRect.isEmpty())
         || (targetRect.x() < 0 || targetRect.y() < 0))
-        return cMaxDistance;
+        return maxDistance();
 
     if (!isRectInDirection(direction, curRect, targetRect))
-        return cMaxDistance;
+        return maxDistance();
 
     // The distance between two nodes is not to be considered alone when evaluating/looking
     // for the best focus candidate node. Alignment of rects can be also a good point to be
@@ -79,9 +79,9 @@ long long distanceInDirection(Node* start, Node* dest, FocusDirection direction,
     bool sameDocument = candidate.node && dest->document() == candidate.node->document();
     if (sameDocument) {
         if (candidate.alignment > alignment || (candidate.parentAlignment && alignment > candidate.parentAlignment))
-            return cMaxDistance;
+            return maxDistance();
     } else if (candidate.alignment > alignment && (candidate.parentAlignment && alignment > candidate.parentAlignment))
-        return cMaxDistance;
+        return maxDistance();
 
     // FIXME_tonikitoo: simplify the logic here !
     if (alignment != None
@@ -93,7 +93,7 @@ long long distanceInDirection(Node* start, Node* dest, FocusDirection direction,
         // |distance| so we force it to be bigger than the result we will get from
         // |spatialDistance| (see below).
         if (candidate.alignment < alignment && candidate.parentAlignment < alignment)
-            candidate.distance = cMaxDistance;
+            candidate.distance = maxDistance();
 
         candidate.alignment = alignment;
     }
diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h
index 6b65de4..3a73d29 100644
--- a/WebCore/page/SpatialNavigation.h
+++ b/WebCore/page/SpatialNavigation.h
@@ -34,7 +34,10 @@ class RenderObject;
 
 using namespace std;
 
-const long long cMaxDistance = numeric_limits<long long>::max();
+inline long long maxDistance()
+{
+    return numeric_limits<long long>::max();
+}
 
 // Spatially speaking, two given elements in a web page can be:
 // 1) Fully aligned: There is a full intersection between the rects, either
@@ -88,8 +91,8 @@ enum RectsAlignment {
 struct FocusCandidate {
     FocusCandidate()
         : node(0)
-        , distance(cMaxDistance)
-        , parentDistance(cMaxDistance)
+        , distance(maxDistance())
+        , parentDistance(maxDistance())
         , alignment(None)
         , parentAlignment(None)
     {
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b8c0002..8d5953b 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,11 @@
 2010-03-04  Simon Fraser  <simon.fraser at apple.com>
 
+        Revert the exceptions I just added, and make the error clearer.
+
+        * Scripts/check-for-global-initializers:
+
+2010-03-04  Simon Fraser  <simon.fraser at apple.com>
+
         Build fix: add exceptions to the check-for-global-initializers script
         for FocusController and SpatialNavigation, and improve the script
         to actually print out the globals found.
diff --git a/WebKitTools/Scripts/check-for-global-initializers b/WebKitTools/Scripts/check-for-global-initializers
index 38dcb32..0472901 100755
--- a/WebKitTools/Scripts/check-for-global-initializers
+++ b/WebKitTools/Scripts/check-for-global-initializers
@@ -118,10 +118,6 @@ for my $file (sort @files) {
                 next if $shortName eq "SubresourceLoader.o";
                 next if $shortName eq "SVGElementInstance.o";
                 next if $shortName eq "XMLHttpRequest.o";
-
-                #FIXME: check to see if these are legit.
-                next if $shortName eq "FocusController.o";
-                next if $shortName eq "SpatialNavigation.o";
             }
             if ($target eq "WebKit") {
                 next if $shortName eq "HostedNetscapePluginStream.o";
@@ -129,8 +125,7 @@ for my $file (sort @files) {
             }
         }
 
-        print "ERROR: $shortName has a global initializer in it! ($file)\n";
-        print "ERROR: @globals\n";
+        print "ERROR: $shortName has one or more global initializers in it! ($file), near @globals\n";
         $sawError = 1;
     }
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list