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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "platform/graphics/GraphicsContextStateSaver.h" | 67 #include "platform/graphics/GraphicsContextStateSaver.h" |
68 #include "platform/graphics/GraphicsLayer.h" | 68 #include "platform/graphics/GraphicsLayer.h" |
69 #include "platform/scroll/ScrollAnimator.h" | 69 #include "platform/scroll/ScrollAnimator.h" |
70 #include "platform/scroll/ScrollbarTheme.h" | 70 #include "platform/scroll/ScrollbarTheme.h" |
71 #include "public/platform/Platform.h" | 71 #include "public/platform/Platform.h" |
72 | 72 |
73 namespace WebCore { | 73 namespace WebCore { |
74 | 74 |
75 const int ResizerControlExpandRatioForTouch = 2; | 75 const int ResizerControlExpandRatioForTouch = 2; |
76 | 76 |
| 77 // Default value is set to 15 as the default |
| 78 // minimum size used by firefox is 15x15. |
| 79 static const int defaultMinimumWidthForResizing = 15; |
| 80 static const int defaultMinimumHeightForResizing = 15; |
| 81 |
77 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderBox& box) | 82 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderBox& box) |
78 : m_box(box) | 83 : m_box(box) |
79 , m_inResizeMode(false) | 84 , m_inResizeMode(false) |
80 , m_scrollsOverflow(false) | 85 , m_scrollsOverflow(false) |
81 , m_scrollDimensionsDirty(true) | 86 , m_scrollDimensionsDirty(true) |
82 , m_inOverflowRelayout(false) | 87 , m_inOverflowRelayout(false) |
83 , m_needsCompositedScrolling(false) | 88 , m_needsCompositedScrolling(false) |
84 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) | 89 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) |
85 , m_scrollCorner(0) | 90 , m_scrollCorner(0) |
86 , m_resizer(0) | 91 , m_resizer(0) |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 static bool overflowRequiresScrollbar(EOverflow overflow) | 712 static bool overflowRequiresScrollbar(EOverflow overflow) |
708 { | 713 { |
709 return overflow == OSCROLL; | 714 return overflow == OSCROLL; |
710 } | 715 } |
711 | 716 |
712 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 717 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
713 { | 718 { |
714 return overflow == OAUTO || overflow == OOVERLAY; | 719 return overflow == OAUTO || overflow == OOVERLAY; |
715 } | 720 } |
716 | 721 |
| 722 IntSize RenderLayerScrollableArea::minimumSizeForResizing() |
| 723 { |
| 724 int minimumWidth = intValueForLength(m_box.style()->logicalMinWidth(), m_box
.containingBlock()->logicalWidth()); |
| 725 int minimumHeight = intValueForLength(m_box.style()->logicalMinHeight(), m_b
ox.containingBlock()->logicalHeight()); |
| 726 |
| 727 minimumWidth = std::max(minimumWidth, defaultMinimumWidthForResizing); |
| 728 minimumHeight = std::max(minimumHeight, defaultMinimumHeightForResizing); |
| 729 return IntSize(minimumWidth, minimumHeight); |
| 730 } |
| 731 |
717 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) | 732 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) |
718 { | 733 { |
719 // List box parts handle the scrollbars by themselves so we have nothing to
do. | 734 // List box parts handle the scrollbars by themselves so we have nothing to
do. |
720 if (m_box.style()->appearance() == ListboxPart) | 735 if (m_box.style()->appearance() == ListboxPart) |
721 return; | 736 return; |
722 | 737 |
723 // RenderView shouldn't provide scrollbars on its own. | 738 // RenderView shouldn't provide scrollbars on its own. |
724 if (m_box.isRenderView()) | 739 if (m_box.isRenderView()) |
725 return; | 740 return; |
726 | 741 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 ASSERT_NOT_REACHED(); | 1360 ASSERT_NOT_REACHED(); |
1346 } | 1361 } |
1347 | 1362 |
1348 float zoomFactor = m_box.style()->effectiveZoom(); | 1363 float zoomFactor = m_box.style()->effectiveZoom(); |
1349 | 1364 |
1350 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); | 1365 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); |
1351 newOffset.setWidth(newOffset.width() / zoomFactor); | 1366 newOffset.setWidth(newOffset.width() / zoomFactor); |
1352 newOffset.setHeight(newOffset.height() / zoomFactor); | 1367 newOffset.setHeight(newOffset.height() / zoomFactor); |
1353 | 1368 |
1354 LayoutSize currentSize = LayoutSize(m_box.width() / zoomFactor, m_box.height
() / zoomFactor); | 1369 LayoutSize currentSize = LayoutSize(m_box.width() / zoomFactor, m_box.height
() / zoomFactor); |
1355 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS
ize); | |
1356 element->setMinimumSizeForResizing(minimumSize); | |
1357 | 1370 |
1358 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); | 1371 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); |
1359 if (m_box.style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 1372 if (m_box.style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
1360 newOffset.setWidth(-newOffset.width()); | 1373 newOffset.setWidth(-newOffset.width()); |
1361 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); | 1374 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); |
1362 } | 1375 } |
1363 | 1376 |
1364 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand
edTo(minimumSize) - currentSize; | 1377 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand
edTo(minimumSizeForResizing()) - currentSize; |
1365 | 1378 |
1366 bool isBoxSizingBorder = m_box.style()->boxSizing() == BORDER_BOX; | 1379 bool isBoxSizingBorder = m_box.style()->boxSizing() == BORDER_BOX; |
1367 | 1380 |
1368 EResize resize = m_box.style()->resize(); | 1381 EResize resize = m_box.style()->resize(); |
1369 if (resize != RESIZE_VERTICAL && difference.width()) { | 1382 if (resize != RESIZE_VERTICAL && difference.width()) { |
1370 if (element->isFormControlElement()) { | 1383 if (element->isFormControlElement()) { |
1371 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). | 1384 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). |
1372 element->setInlineStyleProperty(CSSPropertyMarginLeft, m_box.marginL
eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1385 element->setInlineStyleProperty(CSSPropertyMarginLeft, m_box.marginL
eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
1373 element->setInlineStyleProperty(CSSPropertyMarginRight, m_box.margin
Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1386 element->setInlineStyleProperty(CSSPropertyMarginRight, m_box.margin
Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
1374 } | 1387 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo
sitedScrollingMode mode) | 1535 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo
sitedScrollingMode mode) |
1523 { | 1536 { |
1524 if (m_forceNeedsCompositedScrolling == mode) | 1537 if (m_forceNeedsCompositedScrolling == mode) |
1525 return; | 1538 return; |
1526 | 1539 |
1527 m_forceNeedsCompositedScrolling = mode; | 1540 m_forceNeedsCompositedScrolling = mode; |
1528 layer()->didUpdateNeedsCompositedScrolling(); | 1541 layer()->didUpdateNeedsCompositedScrolling(); |
1529 } | 1542 } |
1530 | 1543 |
1531 } // Namespace WebCore | 1544 } // Namespace WebCore |
OLD | NEW |