- From: Kip Gilbert <kgilbert@mozilla.com>
- Date: Tue, 16 Sep 2014 11:05:55 -0700
- To: www-style@w3.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thank you for your feedback. Please advise if I have
captured this as you intended. I have also added details
on the interactions with CSSOM-View scroll-behavior
smooth scrolling...
In order to include writing-mode and rtl agnostic scroll
offset support, I propose that we create a new function,
Element.scrollTo, which takes a dictionary derived from
ScrollOptions.
Proposed WebIDL
- ---------------
dictionary ElementScrollOptions : ScrollOptions {
double left;
double top;
double right;
double bottom;
double blockStart;
double blockEnd;
double inlineStart;
double inlineEnd;
};
void scrollTo(optional ElementScrollOptions options);
Members
- -------
Various combinations of ElementScrollOptions members can
be passed to scrollTo to select the scroll destination
with a physical or abstract offset:
left:
- Number of pixels that an element’s content is scrolled
to the left. Equivalent to setting the
"Element.scrollLeft" attribute.
- If the direction of the element is ltr (left-to-right)
then "left" is 0 when the scrollbar is at its leftmost
position (at start of the scrolled content) and then
increases as you scroll towards the end of the
content.
- If the direction of the element is rtl (right-to-left)
then "left" is 0 when the scrollbar is at its
rightmost position (at start of the scrolled content)
and then increasingly negative as you scroll towards
the end of the content.
right:
- Number of pixels that an element’s content is scrolled
to the right.
- If the direction of the element is ltr (left-to-right)
then "right" is 0 when the scrollbar is at its
rightmost position (at the end of the scrolled content)
and then increasingly negative as you scroll towards
the start of the content.
- If the direction of the element is rtl (right-to-left)
then "right" is 0 when the scrollbar is at its
leftmost position (at the end of the scrolled content)
and then increases as you scroll towards the start of
the content.
top:
- Number of pixels that the content of an element is
scrolled upward. Equivalent to setting the
"Element.scrollLeft" attribute.
- "top" is 0 when the scrollbar is at its topmost
position (at the start of the scrolled content) and
then increases as you scroll towards the bottom of the
content.
bottom:
- Number of pixels that the content of an element is
scrolled downward.
- "bottom" is 0 when the scrollbar is at its bottommost
position (at the start of the scrolled content) and
then increasingly negative as you scroll towards the
top of the content.
blockStart:
- "blockStart" is an offset relative to the side that
comes earlier in the block progression, as determined
by the writing-mode property.
- In horizontal-tb mode, is equivalent to setting value
of "top".
- In vertical-rl mode, is equivalent to setting value
of "right".
- In vertical-lr mode, is equivalent to setting value
of "left".
inlineStart:
- "inlineStart" is an offset relative to the side from =
which text of the inline base direction would start.
- With a direction value of ltr, this is the line-left
side.
- With a direction value of rtl, this is the line-right
side.
blockEnd:
- "blockEnd" is an offset is relative to the side
opposite block-start.
inlineEnd:
- "inlineEnd" is an offset is relative to the side
opposite inline-start.
For a complete list of all combinations and their
equivalent physical mappings, see [2].
Rules
- -----
- - "left", "top", "right", and "bottom" represent physical
scrolling offsets.
- - "blockStart", "blockEnd", "inlineStart", and "inlineEnd"
represent offsets
in flow-relative directions [1].
- - Values assigned to "blockStart", "blockEnd",
"inlineStart", and "inlineEnd" are set
to the equivalent physical offsets of left, top, right,
and bottom as per
"6.4 Abstract-to-Physical Mappings" in the "CSS Writing
Modes Level 3"
specification [2].
- - If physical scrolling offsets are mixed with offsets in
flow-relative directions, an exception will be thrown.
- - If non-finite values (NaN, -Infinity, Infinity) are
passed to any member of ElementScrollOptions, an
exception will be thrown.
- - The scrolling offset is considered over-constrained if
more than one offset for any axis are passed
simultaneously.
- "left" and "right" are mutually exclusive
- "top" and "bottom" are mutually exclusive
- "blockStart" and "blockEnd" are mutually exclusive
- "inlineStart" and "inlineEnd" are mutually exclusive
- - If the scrolling offset is over-constrained, an
exception will be thrown.
- - If a scrolling offset for an axis is not passed, then
the position of that axis at the start of the scroll
will be used as the destination position for that axis.
- - If no scrolling offsets are included in
ElementScrollOptions, the scrollTo call will perform a
scroll with the destination set to the current scroll
offset. This may cause a smooth scroll [3] to be
interrupted. If ScrollOptions and the smooth-scroll
CSS property evaluate to a smooth scroll, then a smooth
scroll to the current position is performed to end the
scroll at the specified offset in a UA defined smooth
fashion.
[1] CSS Writing Modes Level 3 - Flow-relative directions
http://dev.w3.org/csswg/css-writing-modes/#block-start
[2] CSS Writing Modes Level 3 - 6.4 Abstract-to-Physical
Mappings
http://dev.w3.org/csswg/css-writing-modes/#logical-to-physical
[3] CSSOM View Module - 4.1 Scrolling
http://dev.w3.org/csswg/cssom-view/#scrolling
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJUGHwDAAoJEHziBT1mB5A7CKoH/1K7GlVaAOmF5IRHmAnEC64j
+FQLRMQd0bsLShGkLOk/B75XgNTF2irR4L0+hjmyXHs7I1AG9JZNkLugMz6FwdQH
OHJHkVIlyXOga8jIRbTv8mcfgb68/17nzRivleK7w1Jd9Gr1qeR9C7fO29mD/kwM
0vVKpTgF3Vo5BWo+aJ1wzq3B7EnW9/0dmBF8OinTLK0ijaMHheO+7ORNcLDs+rsp
xl1KZf9RN04gPT8UyUPScYGaB+9xzRy1cyT5yptWdpMWE/vyrnwUqNLXqYvpyGRt
MJYzB9mwdFH9nxKJRzwBwV61vcB407UzBlcFw2J8rxkHtzAnjr3Q30+699ztY1o=
=LpBB
-----END PGP SIGNATURE-----
Received on Tuesday, 16 September 2014 18:06:25 UTC