Changeset 59045 in webkit


Ignore:
Timestamp:
May 8, 2010 8:05:46 PM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

Spatial Navigation: create a getter for the "fudgeFactor"
https://bugs.webkit.org/show_bug.cgi?id=38488

Reviewed by Kenneth Christiansen.
Patch by Antonio Gomes <tonikitoo@webkit.org>

A couple of places in the Spatial Navigation code make use of a "fudge factor"
to improve precision by working around outline focus metrics and such. Patch adds
a helper method for unify getter operations of this value, instead of having it
declared locally in the various methods it is used.

No behaviour change.

  • page/SpatialNavigation.cpp:

(WebCore::scrollIntoView):
(WebCore::deflateIfOverlapped):

  • page/SpatialNavigation.h:

(WebCore::fudgeFactor):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r59039 r59045  
     12010-05-03  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Kenneth Christiansen.
     4
     5        Spatial Navigation: create a getter for the "fudgeFactor"
     6        https://bugs.webkit.org/show_bug.cgi?id=38488
     7
     8        A couple of places in the Spatial Navigation code make use of a "fudge factor"
     9        to improve precision by working around outline focus metrics and such. Patch adds
     10        a helper method for unify getter operations of this value, instead of having it
     11        declared locally in the various methods it is used.
     12
     13        No behaviour change.
     14
     15        * page/SpatialNavigation.cpp:
     16        (WebCore::scrollIntoView):
     17        (WebCore::deflateIfOverlapped):
     18        * page/SpatialNavigation.h:
     19        (WebCore::fudgeFactor):
     20
    1212010-05-08  Stuart Morgan  <stuartmorgan@chromium.org>
    222
  • trunk/WebCore/page/SpatialNavigation.cpp

    r57663 r59045  
    478478    // scrolling it for accurate reason.
    479479    // Element's scrollIntoView method does not provide this flexibility.
    480     static const int fudgeFactor = 2;
    481480    IntRect bounds = element->getRect();
    482     bounds.inflate(fudgeFactor);
     481    bounds.inflate(fudgeFactor());
    483482    element->renderer()->enclosingLayer()->scrollRectToVisible(bounds);
    484483}
     
    498497        return;
    499498
    500     static const int fudgeFactor = -2;
     499    int deflateFactor = -fudgeFactor();
    501500
    502501    // Avoid negative width or height values.
    503     if ((a.width() + 2 * fudgeFactor > 0) && (a.height() + 2 * fudgeFactor > 0))
    504         a.inflate(fudgeFactor);
    505 
    506     if ((b.width() + 2 * fudgeFactor > 0) && (b.height() + 2 * fudgeFactor > 0))
    507         b.inflate(fudgeFactor);
     502    if ((a.width() + 2 * deflateFactor > 0) && (a.height() + 2 * deflateFactor > 0))
     503        a.inflate(deflateFactor);
     504
     505    if ((b.width() + 2 * deflateFactor > 0) && (b.height() + 2 * deflateFactor > 0))
     506        b.inflate(deflateFactor);
    508507}
    509508
  • trunk/WebCore/page/SpatialNavigation.h

    r57061 r59045  
    3939{
    4040    return numeric_limits<long long>::max();
     41}
     42
     43inline unsigned int fudgeFactor()
     44{
     45    return 2;
    4146}
    4247
Note: See TracChangeset for help on using the changeset viewer.