Re: [csswg-drafts] [css-nav-1] Consider candidates on the navigation direction. (#4483)

I'm trying to apply new direction rule to chromium likes below. (https://chromium-review.googlesource.com/c/chromium/src/+/1905297/14/)

**AS-IS**
```
// if both edges of |a| are below the respective ones of |b|.
static inline bool Below(const PhysicalRect& a, const PhysicalRect& b) {
  return a.Y() >= b.Bottom() || (a.Y() >= b.Y() && a.Bottom() > b.Bottom() &&
                                 a.X() < b.Right() && a.Right() > b.X());
}
// For overlapping rects, |a| is considered to be on the right of |b|
// if both edges of |a| are on the right of the respective ones of |b|.
static inline bool RightOf(const PhysicalRect& a, const PhysicalRect& b) {
  return a.X() >= b.Right() || (a.X() >= b.X() && a.Right() > b.Right() &&
                                a.Y() < b.Bottom() && a.Bottom() > b.Y());
```
**TO-BE**
```// For overlapping rects, |a| is considered to be below |b|,
// if the top edge of |a| is below the top edge of |b|.
static inline bool Below(const PhysicalRect& a, const PhysicalRect& b) {
  return a.Y() >= b.Bottom() ||
         (a.Y() > b.Y() && a.X() < b.Right() && a.Right() > b.X());
}

// For overlapping rects, |a| is considered to be above |b|,
// if the bottom edge of |a| is above the bottom edge of |b|.
static inline bool Above(const PhysicalRect& a, const PhysicalRect& b) {
  return a.Bottom() <= b.Y() ||
         (a.Bottom() < b.Bottom() && a.Right() > b.X() && a.X() < b.Right());
}

// For overlapping rects, |a| is considered to be on the right of |b|,
// if the left edge of |a| is on the right of the left edge of |b|.
static inline bool RightOf(const PhysicalRect& a, const PhysicalRect& b) {
  return a.X() >= b.Right() ||
         (a.X() > b.X() && a.Y() < b.Bottom() && a.Bottom() > b.Y());
}

// Return true if rect |a| is on the left of |b|. False otherwise.
// For overlapping rects, |a| is considered to be on the left of |b|,
// if the right edge of |a| is on the left of the right edge of |b|.
static inline bool LeftOf(const PhysicalRect& a, const PhysicalRect& b) {
  return a.Right() <= b.X() ||
         (a.Right() < b.Right() && a.Bottom() > b.Y() && a.Y() < b.Bottom());
}```


But @hugoholgersson seems to have a different opinion.
I hope to make agreement here.

In below picture, 
![image](https://user-images.githubusercontent.com/34676178/72042688-8e5aa100-32f2-11ea-9de2-430065238037.png)

**Let's assue we press DOWN key on "A", "C", "E"**
1. "B" is next target from A?
2. "D" is next target from C?
3. "F" is next target from E?

**Let's assue we press UP key on "B", "D", "F"**
4. "A" is next target from B?
5. "C" is next target from D?
6. "E" is next target from F?

In my opinion and by spec, SpatNav consider only top edge when user press down.
So 1~3, 5~6 are wrong.


@hugoholgersson 
I wonder, your idea about the rules.



-- 
GitHub Notification of comment by jeonghee27
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4483#issuecomment-572409631 using your GitHub account

Received on Thursday, 9 January 2020 06:23:22 UTC