WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
259018
Potentially redundant condition in LocalFrameView style functions
https://bugs.webkit.org/show_bug.cgi?id=259018
Summary
Potentially redundant condition in LocalFrameView style functions
Luke Warlow
Reported
2023-07-08 14:18:05 PDT
horizontalOverscrollBehavior(), verticalOverscrollBehavior() and scrollbarWidthStyle() inside of LocalFrameView have an if (scrollingObject && renderView()) condition before accessing the respective style values. The renderView() check may be redundant. scrollbarWidthStyle() has it as it's a copy of the overscrollBehavior functions. They appear to have it as a left over from when they accessed a function inside of renderView() which was subsequently removed. Check if this is needed for any of these functions and remove as appropriate.
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2023-07-08 16:13:08 PDT
Do you want to expand scope of this bug? I think we can add more checks in 'addScrollableArea' and 'containsScrollableArea' to also assert to confirm we have 'ScrollableArea'. bool LocalFrameView::addScrollableArea(ScrollableArea* scrollableArea) { ASSERT(scrollableArea); _________ bool LocalFrameView::containsScrollableArea(ScrollableArea* scrollableArea) const { ASSERT(scrollableArea); if (!m_scrollableAreas || !scrollableArea) return false; ^ Kind of early return, if we don't have scrollableArea. _____ I think it would make scroll code bit more robust as well. ________ If not, I am happy to separate PR, above compiles in my local build. :-)
Ahmad Saleem
Comment 2
2023-07-08 16:15:58 PDT
(In reply to Ahmad Saleem from
comment #1
)
> Do you want to expand scope of this bug? > > I think we can add more checks in 'addScrollableArea' and > 'containsScrollableArea' to also assert to confirm we have 'ScrollableArea'. > > > bool LocalFrameView::addScrollableArea(ScrollableArea* scrollableArea) > { > ASSERT(scrollableArea); > > > _________ > > bool LocalFrameView::containsScrollableArea(ScrollableArea* scrollableArea) > const > { > > ASSERT(scrollableArea); > if (!m_scrollableAreas || !scrollableArea) > return false; > > ^ Kind of early return, if we don't have scrollableArea. > > _____ > > I think it would make scroll code bit more robust as well. > > ________ > > > If not, I am happy to separate PR, above compiles in my local build. :-)
Although 'containsScrollableArea' is not used much as well. (If we can also explore, if we can remove it).
Ahmad Saleem
Comment 3
2023-07-08 16:16:04 PDT
(In reply to Ahmad Saleem from
comment #1
)
> Do you want to expand scope of this bug? > > I think we can add more checks in 'addScrollableArea' and > 'containsScrollableArea' to also assert to confirm we have 'ScrollableArea'. > > > bool LocalFrameView::addScrollableArea(ScrollableArea* scrollableArea) > { > ASSERT(scrollableArea); > > > _________ > > bool LocalFrameView::containsScrollableArea(ScrollableArea* scrollableArea) > const > { > > ASSERT(scrollableArea); > if (!m_scrollableAreas || !scrollableArea) > return false; > > ^ Kind of early return, if we don't have scrollableArea. > > _____ > > I think it would make scroll code bit more robust as well. > > ________ > > > If not, I am happy to separate PR, above compiles in my local build. :-)
Although 'containsScrollableArea' is not used much as well. (If we can also explore, if we can remove it).
Luke Warlow
Comment 4
2023-07-08 16:23:51 PDT
Could you do this as a separate PR please. Not quite sure if this bug is actionable currently just something Darin spotted during a code review. Your changes look reasonable with my limited understanding.
Radar WebKit Bug Importer
Comment 5
2023-07-15 14:19:16 PDT
<
rdar://problem/112331229
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug