WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch v1
0001-Spatial-Navigation-create-a-getter-for-the-fudgeFa.patch (text/plain), 4.57 KB, created by
Antonio Gomes
on 2010-05-03 14:46:06 PDT
(
hide
)
Description:
patch v1
Filename:
MIME Type:
Creator:
Antonio Gomes
Created:
2010-05-03 14:46:06 PDT
Size:
4.57 KB
patch
obsolete
>From 967294bc151cc5fba13a3aae496fd89f5057adcc Mon Sep 17 00:00:00 2001 >From: Antonio Gomes <tonikitoo@webkit.org> >Date: Mon, 3 May 2010 17:41:41 -0400 >Subject: [PATCH] Spatial Navigation: create a getter for the "fudgeFactor" > https://bugs.webkit.org/show_bug.cgi?id=38488 > >Reviewed by NOBODY (OOPS!). >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): > >diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index cbde94a..92363f1 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,8 +1,28 @@ >+2010-05-03 Antonio Gomes <tonikitoo@webkit.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Spatial Navigation: create a getter for the "fudgeFactor" >+ https://bugs.webkit.org/show_bug.cgi?id=38488 >+ >+ 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): >+ > 2010-05-02 Antonio Gomes <tonikitoo@webkit.org> > > Reviewed by NOBODY (OOPS!). > > Spatial Navigation: use a static var in maxDistance method ( SpatialNavigation.h ) > https://bugs.webkit.org/show_bug.cgi?id=37633 > > This value will not change, so keep it in a static local var. >diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp >index 890eacd..e5ee6f6 100644 >--- a/WebCore/page/SpatialNavigation.cpp >+++ b/WebCore/page/SpatialNavigation.cpp >@@ -472,19 +472,18 @@ bool scrollInDirection(Frame* frame, FocusDirection direction) > } > > void scrollIntoView(Element* element) > { > // NOTE: Element's scrollIntoView method could had been used here, but > // it is preferable to inflate |element|'s bounding rect a bit before > // scrolling it for accurate reason. > // Element's scrollIntoView method does not provide this flexibility. >- static const int fudgeFactor = 2; > IntRect bounds = element->getRect(); >- bounds.inflate(fudgeFactor); >+ bounds.inflate(-fudgeFactor()); > element->renderer()->enclosingLayer()->scrollRectToVisible(bounds); > } > > bool isInRootDocument(Node* node) > { > if (!node) > return false; > >@@ -492,24 +491,22 @@ bool isInRootDocument(Node* node) > return node->document() == rootDocument; > } > > static void deflateIfOverlapped(IntRect& a, IntRect& b) > { > if (!a.intersects(b) || a.contains(b) || b.contains(a)) > return; > >- static const int fudgeFactor = -2; >- > // Avoid negative width or height values. >- if ((a.width() + 2 * fudgeFactor > 0) && (a.height() + 2 * fudgeFactor > 0)) >- a.inflate(fudgeFactor); >+ if ((a.width() + 2 * fudgeFactor() > 0) && (a.height() + 2 * fudgeFactor() > 0)) >+ a.inflate(fudgeFactor()); > >- if ((b.width() + 2 * fudgeFactor > 0) && (b.height() + 2 * fudgeFactor > 0)) >- b.inflate(fudgeFactor); >+ if ((b.width() + 2 * fudgeFactor() > 0) && (b.height() + 2 * fudgeFactor() > 0)) >+ b.inflate(fudgeFactor()); > } > > static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect) > { > ASSERT(node || node->renderer()); > > if (curRect.x() > 0 && curRect.y() > 0) > return true; >diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h >index 8b3261f..df0acb4 100644 >--- a/WebCore/page/SpatialNavigation.h >+++ b/WebCore/page/SpatialNavigation.h >@@ -36,16 +36,21 @@ class RenderObject; > using namespace std; > > inline long long maxDistance() > { > static long long max = numeric_limits<long long>::max(); > return max; > } > >+inline int fudgeFactor() >+{ >+ return -2; >+} >+ > // Spatially speaking, two given elements in a web page can be: > // 1) Fully aligned: There is a full intersection between the rects, either > // vertically or horizontally. > // > // * Horizontally * Vertically > // _ > // |_| _ _ _ _ _ _ > // |_|...... _ |_|_|_|_|_|_| >-- >1.6.0.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 38488
:
54961
|
55409
|
55443