OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 setHasVerticalScrollbar(false); | 837 setHasVerticalScrollbar(false); |
838 return; | 838 return; |
839 } | 839 } |
840 | 840 |
841 EOverflow overflowX = box().style()->overflowX(); | 841 EOverflow overflowX = box().style()->overflowX(); |
842 EOverflow overflowY = box().style()->overflowY(); | 842 EOverflow overflowY = box().style()->overflowY(); |
843 | 843 |
844 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep
any automatic scrollbar that was already present. | 844 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep
any automatic scrollbar that was already present. |
845 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines
AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); | 845 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines
AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); |
846 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto
maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); | 846 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto
maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); |
| 847 |
| 848 // Look for the scrollbarModes and reset the needs Horizontal & vertical Scr
ollbar values based on scrollbarModes, as during force style change |
| 849 // StyleResolver::styleForDocument returns documentStyle with no overflow v
alues, due to which we are destorying the scrollbars that was |
| 850 // already present. |
| 851 if (box().isLayoutView()) { |
| 852 if (LocalFrame* frame = box().frame()) { |
| 853 if (FrameView* frameView = frame->view()) { |
| 854 ScrollbarMode hMode; |
| 855 ScrollbarMode vMode; |
| 856 frameView->calculateScrollbarModes(hMode, vMode); |
| 857 if (hMode == ScrollbarAlwaysOn && !needsHorizontalScrollbar) |
| 858 needsHorizontalScrollbar = true; |
| 859 if (vMode == ScrollbarAlwaysOn && !needsVerticalScrollbar) |
| 860 needsVerticalScrollbar = true; |
| 861 } |
| 862 } |
| 863 } |
| 864 |
847 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 865 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
848 setHasVerticalScrollbar(needsVerticalScrollbar); | 866 setHasVerticalScrollbar(needsVerticalScrollbar); |
849 | 867 |
850 // With overflow: scroll, scrollbars are always visible but may be disabled. | 868 // With overflow: scroll, scrollbars are always visible but may be disabled. |
851 // When switching to another value, we need to re-enable them (see bug 11985
). | 869 // When switching to another value, we need to re-enable them (see bug 11985
). |
852 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL
&& overflowX != OSCROLL) { | 870 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL
&& overflowX != OSCROLL) { |
853 ASSERT(hasHorizontalScrollbar()); | 871 ASSERT(hasHorizontalScrollbar()); |
854 m_hBar->setEnabled(true); | 872 m_hBar->setEnabled(true); |
855 } | 873 } |
856 | 874 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 return false; | 1502 return false; |
1485 | 1503 |
1486 LocalFrame* frame = box().frame(); | 1504 LocalFrame* frame = box().frame(); |
1487 if (!frame || !frame->isMainFrame() || !frame->settings()) | 1505 if (!frame || !frame->isMainFrame() || !frame->settings()) |
1488 return false; | 1506 return false; |
1489 | 1507 |
1490 return frame->settings()->viewportMetaEnabled(); | 1508 return frame->settings()->viewportMetaEnabled(); |
1491 } | 1509 } |
1492 | 1510 |
1493 } // namespace blink | 1511 } // namespace blink |
OLD | NEW |