Commit 6fd3c05c authored by wtc@chromium.org's avatar wtc@chromium.org

Fix a FORWARD_NULL defect reported by Coverity.

We never construct a ScrollView object with a null horiz_sb_ 
or vert_sb_ member, and we already dereference horiz_sb_ and 
vert_sb_ without null checking in many places (including the 
destructor), so all the null checks for horiz_sb_ and vert_sb_ 
are unnecessary. 

Original review URL: http://codereview.chromium.org/155980/

R=ben@chromium.org
BUG=17101 
TEST=none

Review URL: http://codereview.chromium.org/8827007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113350 0039d316-1c4b-4281-b951-d872f2087c98
parent 6c166772
......@@ -262,17 +262,15 @@ gfx::Rect ScrollView::GetVisibleRect() const {
return gfx::Rect();
const int x =
(horiz_sb_ && horiz_sb_->IsVisible()) ? horiz_sb_->GetPosition() : 0;
horiz_sb_->IsVisible() ? horiz_sb_->GetPosition() : 0;
const int y =
(vert_sb_ && vert_sb_->IsVisible()) ? vert_sb_->GetPosition() : 0;
vert_sb_->IsVisible() ? vert_sb_->GetPosition() : 0;
return gfx::Rect(x, y, viewport_->width(), viewport_->height());
}
void ScrollView::ScrollContentsRegionToBeVisible(const gfx::Rect& rect) {
if (!contents_ || ((!horiz_sb_ || !horiz_sb_->IsVisible()) &&
(!vert_sb_ || !vert_sb_->IsVisible()))) {
if (!contents_ || (!horiz_sb_->IsVisible() && !vert_sb_->IsVisible()))
return;
}
// Figure out the maximums for this scroll view.
const int contents_max_x =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment