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; | |
725 int minimumHeight; | |
Julien - ping for review
2014/04/29 22:13:54
No need for C89 style declaration. It's better to
harpreet.sk
2014/04/30 10:12:53
Done.
| |
726 | |
727 minimumWidth = intValueForLength(m_box.style()->logicalMinWidth(), m_box.con tainingBlock()->logicalWidth()); | |
728 minimumHeight = intValueForLength(m_box.style()->logicalMinHeight(), m_box.c ontainingBlock()->logicalHeight()); | |
729 | |
730 minimumWidth = std::max(minimumWidth, defaultMinimumWidthForResizing); | |
731 minimumHeight = std::max(minimumHeight, defaultMinimumHeightForResizing); | |
732 return IntSize(minimumWidth, minimumHeight); | |
733 } | |
734 | |
717 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty le) | 735 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty le) |
718 { | 736 { |
719 // List box parts handle the scrollbars by themselves so we have nothing to do. | 737 // List box parts handle the scrollbars by themselves so we have nothing to do. |
720 if (m_box.style()->appearance() == ListboxPart) | 738 if (m_box.style()->appearance() == ListboxPart) |
721 return; | 739 return; |
722 | 740 |
723 // RenderView shouldn't provide scrollbars on its own. | 741 // RenderView shouldn't provide scrollbars on its own. |
724 if (m_box.isRenderView()) | 742 if (m_box.isRenderView()) |
725 return; | 743 return; |
726 | 744 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1345 ASSERT_NOT_REACHED(); | 1363 ASSERT_NOT_REACHED(); |
1346 } | 1364 } |
1347 | 1365 |
1348 float zoomFactor = m_box.style()->effectiveZoom(); | 1366 float zoomFactor = m_box.style()->effectiveZoom(); |
1349 | 1367 |
1350 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte nts(pos)); | 1368 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte nts(pos)); |
1351 newOffset.setWidth(newOffset.width() / zoomFactor); | 1369 newOffset.setWidth(newOffset.width() / zoomFactor); |
1352 newOffset.setHeight(newOffset.height() / zoomFactor); | 1370 newOffset.setHeight(newOffset.height() / zoomFactor); |
1353 | 1371 |
1354 LayoutSize currentSize = LayoutSize(m_box.width() / zoomFactor, m_box.height () / zoomFactor); | 1372 LayoutSize currentSize = LayoutSize(m_box.width() / zoomFactor, m_box.height () / zoomFactor); |
1355 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS ize); | |
1356 element->setMinimumSizeForResizing(minimumSize); | |
1357 | 1373 |
1358 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol dOffset.height() / zoomFactor); | 1374 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol dOffset.height() / zoomFactor); |
1359 if (m_box.style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 1375 if (m_box.style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
1360 newOffset.setWidth(-newOffset.width()); | 1376 newOffset.setWidth(-newOffset.width()); |
1361 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); | 1377 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); |
1362 } | 1378 } |
1363 | 1379 |
1364 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand edTo(minimumSize) - currentSize; | 1380 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand edTo(LayoutSize(minimumSizeForResizing())) - currentSize; |
Julien - ping for review
2014/04/29 22:13:54
Do we really need this explicit conversion? If we
harpreet.sk
2014/04/30 10:12:53
I cross checked that expandTo() takes LayoutSize a
| |
1365 | 1381 |
1366 bool isBoxSizingBorder = m_box.style()->boxSizing() == BORDER_BOX; | 1382 bool isBoxSizingBorder = m_box.style()->boxSizing() == BORDER_BOX; |
1367 | 1383 |
1368 EResize resize = m_box.style()->resize(); | 1384 EResize resize = m_box.style()->resize(); |
1369 if (resize != RESIZE_VERTICAL && difference.width()) { | 1385 if (resize != RESIZE_VERTICAL && difference.width()) { |
1370 if (element->isFormControlElement()) { | 1386 if (element->isFormControlElement()) { |
1371 // Make implicit margins from the theme explicit (see <http://bugs.w ebkit.org/show_bug.cgi?id=9547>). | 1387 // 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); | 1388 element->setInlineStyleProperty(CSSPropertyMarginLeft, m_box.marginL eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
1373 element->setInlineStyleProperty(CSSPropertyMarginRight, m_box.margin Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1389 element->setInlineStyleProperty(CSSPropertyMarginRight, m_box.margin Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
1374 } | 1390 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1522 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo sitedScrollingMode mode) | 1538 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo sitedScrollingMode mode) |
1523 { | 1539 { |
1524 if (m_forceNeedsCompositedScrolling == mode) | 1540 if (m_forceNeedsCompositedScrolling == mode) |
1525 return; | 1541 return; |
1526 | 1542 |
1527 m_forceNeedsCompositedScrolling = mode; | 1543 m_forceNeedsCompositedScrolling = mode; |
1528 layer()->didUpdateNeedsCompositedScrolling(); | 1544 layer()->didUpdateNeedsCompositedScrolling(); |
1529 } | 1545 } |
1530 | 1546 |
1531 } // Namespace WebCore | 1547 } // Namespace WebCore |
OLD | NEW |