mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-11 14:28:42 +00:00
Bug 962249 part 1 - Add Element.scroll{Top,Left}Min (chrome-only) and convert most of scrollLeftMax uses and part of scrollTopMax uses to combinations with the new properties. r=roc,bz
--HG-- extra : source : 06ea81fe3f64c072d100e42b76678eaa9fb7448c
This commit is contained in:
parent
19425ba626
commit
9c39f97e15
@ -4086,7 +4086,7 @@ OverflowableToolbar.prototype = {
|
||||
|
||||
let child = this._target.lastChild;
|
||||
|
||||
while (child && this._target.scrollLeftMax > 0) {
|
||||
while (child && this._target.scrollLeftMin != this._target.scrollLeftMax) {
|
||||
let prevChild = child.previousSibling;
|
||||
|
||||
if (child.getAttribute("overflows") != "false") {
|
||||
@ -4166,7 +4166,7 @@ OverflowableToolbar.prototype = {
|
||||
if (!this._enabled)
|
||||
return;
|
||||
|
||||
if (this._target.scrollLeftMax > 0) {
|
||||
if (this._target.scrollLeftMin != this._target.scrollLeftMax) {
|
||||
this.onOverflow();
|
||||
} else {
|
||||
this._moveItemsBackToTheirOrigin();
|
||||
|
@ -1181,7 +1181,7 @@ PlacesToolbar.prototype = {
|
||||
},
|
||||
|
||||
updateOverflowStatus: function() {
|
||||
if (this._rootElt.scrollLeftMax > 0) {
|
||||
if (this._rootElt.scrollLeftMin != this._rootElt.scrollLeftMax) {
|
||||
this._onOverflow();
|
||||
} else {
|
||||
this._onUnderflow();
|
||||
|
@ -777,6 +777,12 @@ public:
|
||||
{
|
||||
return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().height);
|
||||
}
|
||||
int32_t ScrollTopMin()
|
||||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
return sf ?
|
||||
nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().y) : 0;
|
||||
}
|
||||
int32_t ScrollTopMax()
|
||||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
@ -784,6 +790,12 @@ public:
|
||||
nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().YMost()) :
|
||||
0;
|
||||
}
|
||||
int32_t ScrollLeftMin()
|
||||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
return sf ?
|
||||
nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().x) : 0;
|
||||
}
|
||||
int32_t ScrollLeftMax()
|
||||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
|
@ -348,8 +348,10 @@ const ContentPanningAPZDisabled = {
|
||||
let isScrollableTextarea = (node.tagName == 'TEXTAREA' &&
|
||||
(node.scrollHeight > node.clientHeight ||
|
||||
node.scrollWidth > node.clientWidth ||
|
||||
('scrollLeftMax' in node && node.scrollLeftMax > 0) ||
|
||||
('scrollTopMax' in node && node.scrollTopMax > 0)));
|
||||
('scrollLeftMin' in node && 'scrollLeftMax' in node &&
|
||||
node.scrollLeftMin != node.scrollLeftMax) ||
|
||||
('scrollTopMin' in node && 'scrollTopMax' in node &&
|
||||
node.scrollTopMin != node.scrollTopMax)));
|
||||
if (isScroll || isAuto || isScrollableTextarea) {
|
||||
return node;
|
||||
}
|
||||
|
@ -199,11 +199,13 @@ partial interface Element {
|
||||
readonly attribute long clientHeight;
|
||||
|
||||
// Mozilla specific stuff
|
||||
/* The maximum offset that the element can be scrolled to
|
||||
/* The minimum/maximum offset that the element can be scrolled to
|
||||
(i.e., the value that scrollLeft/scrollTop would be clamped to if they were
|
||||
set to arbitrarily large values. */
|
||||
readonly attribute long scrollTopMax;
|
||||
readonly attribute long scrollLeftMax;
|
||||
[ChromeOnly] readonly attribute long scrollTopMin;
|
||||
readonly attribute long scrollTopMax;
|
||||
[ChromeOnly] readonly attribute long scrollLeftMin;
|
||||
readonly attribute long scrollLeftMax;
|
||||
};
|
||||
|
||||
// http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
|
||||
|
@ -5090,7 +5090,8 @@ var BrowserEventHandler = {
|
||||
* - It's a select element showing multiple rows
|
||||
*/
|
||||
if (checkElem) {
|
||||
if ((elem.scrollTopMax > 0 || elem.scrollLeftMax > 0) &&
|
||||
if ((elem.scrollTopMin != elem.scrollTopMin ||
|
||||
elem.scrollLeftMin != elem.scrollLeftMax) &&
|
||||
(this._hasScrollableOverflow(elem) ||
|
||||
elem.matches("textarea")) ||
|
||||
(elem instanceof HTMLInputElement && elem.mozIsTextField(false)) ||
|
||||
|
@ -93,7 +93,7 @@ var ClickEventHandler = {
|
||||
// do not allow horizontal scrolling for select elements, it leads
|
||||
// to visual artifacts and is not the expected behavior anyway
|
||||
if (!(this._scrollable instanceof content.HTMLSelectElement) &&
|
||||
this._scrollable.scrollLeftMax &&
|
||||
this._scrollable.scrollLeftMin != this._scrollable.scrollLeftMax &&
|
||||
scrollingAllowed.indexOf(overflowx) >= 0) {
|
||||
this._scrolldir = scrollVert ? "NSEW" : "EW";
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user