зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1347815 - part1.1: fix some obvious nits for the implementations of ScrollFrameHelper. r=heycam
MozReview-Commit-ID: BOoqj7wzo8o --HG-- extra : rebase_source : 0aae9871950dc7934df1025e25a7bfa7fbb369a6
This commit is contained in:
Родитель
0fc4331924
Коммит
bcda6f5517
|
@ -2531,8 +2531,9 @@ void ScrollFrameHelper::MarkNotRecentlyScrolled()
|
|||
void ScrollFrameHelper::MarkRecentlyScrolled()
|
||||
{
|
||||
mHasBeenScrolledRecently = true;
|
||||
if (IsAlwaysActive())
|
||||
if (IsAlwaysActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mActivityExpirationState.IsTracked()) {
|
||||
gScrollFrameActivityTracker->MarkUsed(this);
|
||||
|
@ -2708,9 +2709,10 @@ ScrollFrameHelper::ScheduleSyntheticMouseMove()
|
|||
{
|
||||
if (!mScrollActivityTimer) {
|
||||
mScrollActivityTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if (!mScrollActivityTimer)
|
||||
if (!mScrollActivityTimer) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mScrollActivityTimer->InitWithFuncCallback(
|
||||
ScrollActivityCallback, this, 100, nsITimer::TYPE_ONE_SHOT);
|
||||
|
@ -3055,8 +3057,9 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|||
AutoTArray<nsIFrame*, 3> scrollParts;
|
||||
for (nsIFrame* kid : mOuter->PrincipalChildList()) {
|
||||
if (kid == mScrolledFrame ||
|
||||
(kid->IsAbsPosContainingBlock() || overlayScrollbars) != aPositioned)
|
||||
(kid->IsAbsPosContainingBlock() || overlayScrollbars) != aPositioned) {
|
||||
continue;
|
||||
}
|
||||
|
||||
scrollParts.AppendElement(kid);
|
||||
}
|
||||
|
@ -4042,8 +4045,7 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta,
|
|||
}
|
||||
|
||||
if (aUnit == nsIScrollableFrame::DEVICE_PIXELS &&
|
||||
!nsLayoutUtils::AsyncPanZoomEnabled(mOuter))
|
||||
{
|
||||
!nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
|
||||
// When APZ is disabled, we must track the velocity
|
||||
// on the main thread; otherwise, the APZC will manage this.
|
||||
mVelocityQueue.Sample(GetScrollPosition());
|
||||
|
@ -4304,8 +4306,7 @@ ScrollFrameHelper::FireScrollPortEvent()
|
|||
orient = InternalScrollPortEvent::eBoth;
|
||||
mHorizontalOverflow = newHorizontalOverflow;
|
||||
mVerticalOverflow = newVerticalOverflow;
|
||||
}
|
||||
else if (vertChanged) {
|
||||
} else if (vertChanged) {
|
||||
orient = InternalScrollPortEvent::eVertical;
|
||||
mVerticalOverflow = newVerticalOverflow;
|
||||
if (horizChanged) {
|
||||
|
@ -4314,8 +4315,7 @@ ScrollFrameHelper::FireScrollPortEvent()
|
|||
// the frame.
|
||||
PostOverflowEvent();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
orient = InternalScrollPortEvent::eHorizontal;
|
||||
mHorizontalOverflow = newHorizontalOverflow;
|
||||
}
|
||||
|
@ -4753,8 +4753,9 @@ ScrollFrameHelper::FireScrollEvent()
|
|||
void
|
||||
ScrollFrameHelper::PostScrollEvent()
|
||||
{
|
||||
if (mScrollEvent)
|
||||
if (mScrollEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The ScrollEvent constructor registers itself with the refresh driver.
|
||||
mScrollEvent = new ScrollEvent(this);
|
||||
|
@ -4773,8 +4774,9 @@ ScrollFrameHelper::AsyncScrollPortEvent::Run()
|
|||
bool
|
||||
nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom)
|
||||
{
|
||||
if (!mHelper.mHScrollbarBox)
|
||||
if (!mHelper.mHScrollbarBox) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return AddRemoveScrollbar(aState, aOnBottom, true, true);
|
||||
}
|
||||
|
@ -4782,8 +4784,9 @@ nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBotto
|
|||
bool
|
||||
nsXULScrollFrame::AddVerticalScrollbar(nsBoxLayoutState& aState, bool aOnRight)
|
||||
{
|
||||
if (!mHelper.mVScrollbarBox)
|
||||
if (!mHelper.mVScrollbarBox) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return AddRemoveScrollbar(aState, aOnRight, false, true);
|
||||
}
|
||||
|
@ -4926,8 +4929,9 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
|
|||
|
||||
void ScrollFrameHelper::PostOverflowEvent()
|
||||
{
|
||||
if (mAsyncScrollPortEvent.IsPending())
|
||||
if (mAsyncScrollPortEvent.IsPending()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep this in sync with FireScrollPortEvent().
|
||||
nsSize scrollportSize = mScrollPort.Size();
|
||||
|
@ -4944,8 +4948,9 @@ void ScrollFrameHelper::PostOverflowEvent()
|
|||
}
|
||||
|
||||
nsRootPresContext* rpc = mOuter->PresContext()->GetRootPresContext();
|
||||
if (!rpc)
|
||||
if (!rpc) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAsyncScrollPortEvent = new AsyncScrollPortEvent(this);
|
||||
rpc->AddWillPaintObserver(mAsyncScrollPortEvent.get());
|
||||
|
@ -4966,16 +4971,18 @@ ScrollFrameHelper::GetFrameForDir() const
|
|||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
|
||||
if (htmlDoc) {
|
||||
Element *bodyElement = document->GetBodyElement();
|
||||
if (bodyElement)
|
||||
if (bodyElement) {
|
||||
root = bodyElement; // we can trust the document to hold on to it
|
||||
}
|
||||
}
|
||||
|
||||
if (root) {
|
||||
nsIFrame *rootsFrame = root->GetPrimaryFrame();
|
||||
if (rootsFrame)
|
||||
if (rootsFrame) {
|
||||
frame = rootsFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
@ -5444,8 +5451,9 @@ ScrollFrameHelper::AdjustScrollbarRectForResizer(
|
|||
nsIFrame* aFrame, nsPresContext* aPresContext,
|
||||
nsRect& aRect, bool aHasResizer, bool aVertical)
|
||||
{
|
||||
if ((aVertical ? aRect.width : aRect.height) == 0)
|
||||
if ((aVertical ? aRect.width : aRect.height) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if a content resizer is present, use its size. Otherwise, check if the
|
||||
// widget has a resizer.
|
||||
|
@ -5457,8 +5465,9 @@ ScrollFrameHelper::AdjustScrollbarRectForResizer(
|
|||
nsPoint offset;
|
||||
nsIWidget* widget = aFrame->GetNearestWidget(offset);
|
||||
LayoutDeviceIntRect widgetRect;
|
||||
if (!widget || !widget->ShowsResizeIndicator(&widgetRect))
|
||||
if (!widget || !widget->ShowsResizeIndicator(&widgetRect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
resizerRect = nsRect(aPresContext->DevPixelsToAppUnits(widgetRect.x) - offset.x,
|
||||
aPresContext->DevPixelsToAppUnits(widgetRect.y) - offset.y,
|
||||
|
@ -5575,8 +5584,7 @@ ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
|||
}
|
||||
|
||||
nsBoxFrame::LayoutChildAt(aState, mResizerBox, r);
|
||||
}
|
||||
else if (mResizerBox) {
|
||||
} else if (mResizerBox) {
|
||||
// otherwise lay out the resizer with an empty rectangle
|
||||
nsBoxFrame::LayoutChildAt(aState, mResizerBox, nsRect());
|
||||
}
|
||||
|
@ -5681,8 +5689,9 @@ ScrollFrameHelper::SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom,
|
|||
nsAutoString newValue;
|
||||
newValue.AppendInt(pixelSize);
|
||||
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, aAtom, newValue, eCaseMatters))
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, aAtom, newValue, eCaseMatters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoWeakFrame weakFrame(mOuter);
|
||||
nsCOMPtr<nsIContent> kungFuDeathGrip = aContent;
|
||||
|
@ -5909,8 +5918,7 @@ ScrollFrameHelper::GetCoordAttribute(nsIFrame* aBox, nsIAtom* aAtom,
|
|||
|
||||
nsAutoString value;
|
||||
content->GetAttr(kNameSpaceID_None, aAtom, value);
|
||||
if (!value.IsEmpty())
|
||||
{
|
||||
if (!value.IsEmpty()) {
|
||||
nsresult error;
|
||||
// convert it to appunits
|
||||
nscoord result = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
|
||||
|
|
Загрузка…
Ссылка в новой задаче