Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 | 411 |
| 412 m_needsScrollbarsUpdate = frameSizeChanged; | 412 m_needsScrollbarsUpdate = frameSizeChanged; |
| 413 // TODO(wjmaclean): find out why scrollbars fail to resize for complex | 413 // TODO(wjmaclean): find out why scrollbars fail to resize for complex |
| 414 // subframes after changing the zoom level. For now always calling | 414 // subframes after changing the zoom level. For now always calling |
| 415 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to | 415 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to |
| 416 // discover the deeper cause of this. http://crbug.com/607987. | 416 // discover the deeper cause of this. http://crbug.com/607987. |
| 417 updateScrollbarsIfNeeded(); | 417 updateScrollbarsIfNeeded(); |
| 418 | 418 |
| 419 frameRectsChanged(); | 419 frameRectsChanged(); |
| 420 | 420 |
| 421 updateScrollableAreaSet(); | 421 updateParentScrollableAreaSet(); |
| 422 | 422 |
| 423 if (LayoutViewItem layoutView = this->layoutViewItem()) { | 423 if (LayoutViewItem layoutView = this->layoutViewItem()) { |
| 424 // TODO(majidvp): It seems that this only needs to be called when size | 424 // TODO(majidvp): It seems that this only needs to be called when size |
| 425 // is updated ignoring any change in the location. | 425 // is updated ignoring any change in the location. |
| 426 if (layoutView.usesCompositing()) | 426 if (layoutView.usesCompositing()) |
| 427 layoutView.compositor()->frameViewDidChangeSize(); | 427 layoutView.compositor()->frameViewDidChangeSize(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 if (frameSizeChanged) { | 430 if (frameSizeChanged) { |
| 431 viewportSizeChanged(newRect.width() != oldRect.width(), | 431 viewportSizeChanged(newRect.width() != oldRect.width(), |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 return; | 533 return; |
| 534 | 534 |
| 535 m_contentsSize = size; | 535 m_contentsSize = size; |
| 536 updateScrollbars(); | 536 updateScrollbars(); |
| 537 ScrollableArea::contentsResized(); | 537 ScrollableArea::contentsResized(); |
| 538 | 538 |
| 539 Page* page = frame().page(); | 539 Page* page = frame().page(); |
| 540 if (!page) | 540 if (!page) |
| 541 return; | 541 return; |
| 542 | 542 |
| 543 updateScrollableAreaSet(); | 543 updateParentScrollableAreaSet(); |
| 544 | 544 |
| 545 page->chromeClient().contentsSizeChanged(m_frame.get(), size); | 545 page->chromeClient().contentsSizeChanged(m_frame.get(), size); |
| 546 frame().loader().restoreScrollPositionAndViewState(); | 546 frame().loader().restoreScrollPositionAndViewState(); |
| 547 } | 547 } |
| 548 | 548 |
| 549 void FrameView::adjustViewSize() { | 549 void FrameView::adjustViewSize() { |
| 550 if (m_suppressAdjustViewSize) | 550 if (m_suppressAdjustViewSize) |
| 551 return; | 551 return; |
| 552 | 552 |
| 553 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 553 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2379 ScrollbarMode verticalMode; | 2379 ScrollbarMode verticalMode; |
| 2380 calculateScrollbarModes(horizontalMode, verticalMode, | 2380 calculateScrollbarModes(horizontalMode, verticalMode, |
| 2381 RulesFromWebContentOnly); | 2381 RulesFromWebContentOnly); |
| 2382 if (horizontalMode == ScrollbarAlwaysOff && | 2382 if (horizontalMode == ScrollbarAlwaysOff && |
| 2383 verticalMode == ScrollbarAlwaysOff) | 2383 verticalMode == ScrollbarAlwaysOff) |
| 2384 return NotScrollableExplicitlyDisabled; | 2384 return NotScrollableExplicitlyDisabled; |
| 2385 | 2385 |
| 2386 return Scrollable; | 2386 return Scrollable; |
| 2387 } | 2387 } |
| 2388 | 2388 |
| 2389 void FrameView::updateScrollableAreaSet() { | 2389 void FrameView::updateParentScrollableAreaSet() { |
| 2390 // That ensures that only inner frames are cached. | 2390 // That ensures that only inner frames are cached. |
| 2391 FrameView* parentFrameView = this->parentFrameView(); | 2391 FrameView* parentFrameView = this->parentFrameView(); |
| 2392 if (!parentFrameView) | 2392 if (!parentFrameView) |
| 2393 return; | 2393 return; |
| 2394 | 2394 |
| 2395 if (!isScrollable()) { | 2395 if (!isScrollable()) { |
| 2396 parentFrameView->removeScrollableArea(this); | 2396 parentFrameView->removeScrollableArea(this); |
| 2397 return; | 2397 return; |
| 2398 } | 2398 } |
| 2399 | 2399 |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3330 return; | 3330 return; |
| 3331 m_animatingScrollableAreas->remove(scrollableArea); | 3331 m_animatingScrollableAreas->remove(scrollableArea); |
| 3332 } | 3332 } |
| 3333 | 3333 |
| 3334 void FrameView::setParent(Widget* parentView) { | 3334 void FrameView::setParent(Widget* parentView) { |
| 3335 if (parentView == parent()) | 3335 if (parentView == parent()) |
| 3336 return; | 3336 return; |
| 3337 | 3337 |
| 3338 Widget::setParent(parentView); | 3338 Widget::setParent(parentView); |
| 3339 | 3339 |
| 3340 updateScrollableAreaSet(); | 3340 updateParentScrollableAreaSet(); |
| 3341 setNeedsUpdateViewportIntersection(); | 3341 setNeedsUpdateViewportIntersection(); |
| 3342 } | 3342 } |
| 3343 | 3343 |
| 3344 void FrameView::removeChild(Widget* child) { | 3344 void FrameView::removeChild(Widget* child) { |
| 3345 ASSERT(child->parent() == this); | 3345 ASSERT(child->parent() == this); |
| 3346 | 3346 |
| 3347 if (child->isFrameView()) | 3347 if (child->isFrameView()) |
| 3348 removeScrollableArea(toFrameView(child)); | 3348 removeScrollableArea(toFrameView(child)); |
| 3349 | 3349 |
| 3350 child->setParent(0); | 3350 child->setParent(0); |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4213 | 4213 |
| 4214 Widget::setParentVisible(visible); | 4214 Widget::setParentVisible(visible); |
| 4215 | 4215 |
| 4216 if (!isSelfVisible()) | 4216 if (!isSelfVisible()) |
| 4217 return; | 4217 return; |
| 4218 | 4218 |
| 4219 for (const auto& child : m_children) | 4219 for (const auto& child : m_children) |
| 4220 child->setParentVisible(visible); | 4220 child->setParentVisible(visible); |
| 4221 } | 4221 } |
| 4222 | 4222 |
| 4223 void FrameView::frameViewVisibilityChanged() { | |
|
majidvp
2016/11/02 14:15:17
This function seems superfulous. It is reducing on
MuVen
2016/11/02 17:07:47
Done.
| |
| 4224 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) | |
| 4225 scrollingCoordinator->frameViewVisibilityDidChange(); | |
| 4226 } | |
| 4227 | |
| 4223 void FrameView::show() { | 4228 void FrameView::show() { |
| 4224 if (!isSelfVisible()) { | 4229 if (!isSelfVisible()) { |
| 4225 setSelfVisible(true); | 4230 setSelfVisible(true); |
| 4231 frameViewVisibilityChanged(); | |
| 4226 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4232 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
| 4227 updateScrollableAreaSet(); | 4233 updateParentScrollableAreaSet(); |
| 4228 if (isParentVisible()) { | 4234 if (isParentVisible()) { |
| 4229 for (const auto& child : m_children) | 4235 for (const auto& child : m_children) |
| 4230 child->setParentVisible(true); | 4236 child->setParentVisible(true); |
| 4231 } | 4237 } |
| 4232 } | 4238 } |
| 4233 | 4239 |
| 4234 Widget::show(); | 4240 Widget::show(); |
| 4235 } | 4241 } |
| 4236 | 4242 |
| 4237 void FrameView::hide() { | 4243 void FrameView::hide() { |
| 4238 if (isSelfVisible()) { | 4244 if (isSelfVisible()) { |
| 4239 if (isParentVisible()) { | 4245 if (isParentVisible()) { |
| 4240 for (const auto& child : m_children) | 4246 for (const auto& child : m_children) |
| 4241 child->setParentVisible(false); | 4247 child->setParentVisible(false); |
| 4242 } | 4248 } |
| 4243 setSelfVisible(false); | 4249 setSelfVisible(false); |
| 4250 frameViewVisibilityChanged(); | |
| 4244 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4251 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
| 4245 updateScrollableAreaSet(); | 4252 updateParentScrollableAreaSet(); |
| 4246 } | 4253 } |
| 4247 | 4254 |
| 4248 Widget::hide(); | 4255 Widget::hide(); |
| 4249 } | 4256 } |
| 4250 | 4257 |
| 4251 int FrameView::viewportWidth() const { | 4258 int FrameView::viewportWidth() const { |
| 4252 int viewportWidth = layoutSize(IncludeScrollbars).width(); | 4259 int viewportWidth = layoutSize(IncludeScrollbars).width(); |
| 4253 return adjustForAbsoluteZoom(viewportWidth, layoutView()); | 4260 return adjustForAbsoluteZoom(viewportWidth, layoutView()); |
| 4254 } | 4261 } |
| 4255 | 4262 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4489 DCHECK(m_frame->isMainFrame()); | 4496 DCHECK(m_frame->isMainFrame()); |
| 4490 return m_initialViewportSize.width(); | 4497 return m_initialViewportSize.width(); |
| 4491 } | 4498 } |
| 4492 | 4499 |
| 4493 int FrameView::initialViewportHeight() const { | 4500 int FrameView::initialViewportHeight() const { |
| 4494 DCHECK(m_frame->isMainFrame()); | 4501 DCHECK(m_frame->isMainFrame()); |
| 4495 return m_initialViewportSize.height(); | 4502 return m_initialViewportSize.height(); |
| 4496 } | 4503 } |
| 4497 | 4504 |
| 4498 } // namespace blink | 4505 } // namespace blink |
| OLD | NEW |