| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "platform/graphics/GraphicsContextStateSaver.h" | 68 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 69 #include "platform/graphics/GraphicsLayer.h" | 69 #include "platform/graphics/GraphicsLayer.h" |
| 70 #include "platform/scroll/ScrollAnimator.h" | 70 #include "platform/scroll/ScrollAnimator.h" |
| 71 #include "platform/scroll/ScrollbarTheme.h" | 71 #include "platform/scroll/ScrollbarTheme.h" |
| 72 #include "public/platform/Platform.h" | 72 #include "public/platform/Platform.h" |
| 73 | 73 |
| 74 namespace WebCore { | 74 namespace WebCore { |
| 75 | 75 |
| 76 const int ResizerControlExpandRatioForTouch = 2; | 76 const int ResizerControlExpandRatioForTouch = 2; |
| 77 | 77 |
| 78 // Default value is set to 15 as the default |
| 79 // minimum size used by firefox is 15x15. |
| 80 static const int defaultMinimumWidthForResizing = 15; |
| 81 static const int defaultMinimumHeightForResizing = 15; |
| 82 |
| 78 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) | 83 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) |
| 79 : m_layer(layer) | 84 : m_layer(layer) |
| 80 , m_inResizeMode(false) | 85 , m_inResizeMode(false) |
| 81 , m_scrollsOverflow(false) | 86 , m_scrollsOverflow(false) |
| 82 , m_scrollDimensionsDirty(true) | 87 , m_scrollDimensionsDirty(true) |
| 83 , m_inOverflowRelayout(false) | 88 , m_inOverflowRelayout(false) |
| 84 , m_needsCompositedScrolling(false) | 89 , m_needsCompositedScrolling(false) |
| 85 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) | 90 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) |
| 86 , m_scrollCorner(0) | 91 , m_scrollCorner(0) |
| 87 , m_resizer(0) | 92 , m_resizer(0) |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 static bool overflowRequiresScrollbar(EOverflow overflow) | 720 static bool overflowRequiresScrollbar(EOverflow overflow) |
| 716 { | 721 { |
| 717 return overflow == OSCROLL; | 722 return overflow == OSCROLL; |
| 718 } | 723 } |
| 719 | 724 |
| 720 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 725 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
| 721 { | 726 { |
| 722 return overflow == OAUTO || overflow == OOVERLAY; | 727 return overflow == OAUTO || overflow == OOVERLAY; |
| 723 } | 728 } |
| 724 | 729 |
| 730 IntSize RenderLayerScrollableArea::minimumSizeForResizing() |
| 731 { |
| 732 int minimumWidth = intValueForLength(box().style()->logicalMinWidth(), box()
.containingBlock()->logicalWidth()); |
| 733 int minimumHeight = intValueForLength(box().style()->logicalMinHeight(), box
().containingBlock()->logicalHeight()); |
| 734 |
| 735 minimumWidth = std::max(minimumWidth, defaultMinimumWidthForResizing); |
| 736 minimumHeight = std::max(minimumHeight, defaultMinimumHeightForResizing); |
| 737 return IntSize(minimumWidth, minimumHeight); |
| 738 } |
| 739 |
| 725 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) | 740 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) |
| 726 { | 741 { |
| 727 // List box parts handle the scrollbars by themselves so we have nothing to
do. | 742 // List box parts handle the scrollbars by themselves so we have nothing to
do. |
| 728 if (box().style()->appearance() == ListboxPart) | 743 if (box().style()->appearance() == ListboxPart) |
| 729 return; | 744 return; |
| 730 | 745 |
| 731 // RenderView shouldn't provide scrollbars on its own. | 746 // RenderView shouldn't provide scrollbars on its own. |
| 732 if (box().isRenderView()) | 747 if (box().isRenderView()) |
| 733 return; | 748 return; |
| 734 | 749 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 ASSERT_NOT_REACHED(); | 1388 ASSERT_NOT_REACHED(); |
| 1374 } | 1389 } |
| 1375 | 1390 |
| 1376 float zoomFactor = box().style()->effectiveZoom(); | 1391 float zoomFactor = box().style()->effectiveZoom(); |
| 1377 | 1392 |
| 1378 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); | 1393 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); |
| 1379 newOffset.setWidth(newOffset.width() / zoomFactor); | 1394 newOffset.setWidth(newOffset.width() / zoomFactor); |
| 1380 newOffset.setHeight(newOffset.height() / zoomFactor); | 1395 newOffset.setHeight(newOffset.height() / zoomFactor); |
| 1381 | 1396 |
| 1382 LayoutSize currentSize = LayoutSize(box().width() / zoomFactor, box().height
() / zoomFactor); | 1397 LayoutSize currentSize = LayoutSize(box().width() / zoomFactor, box().height
() / zoomFactor); |
| 1383 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS
ize); | |
| 1384 element->setMinimumSizeForResizing(minimumSize); | |
| 1385 | 1398 |
| 1386 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); | 1399 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); |
| 1387 if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 1400 if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
| 1388 newOffset.setWidth(-newOffset.width()); | 1401 newOffset.setWidth(-newOffset.width()); |
| 1389 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); | 1402 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); |
| 1390 } | 1403 } |
| 1391 | 1404 |
| 1392 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand
edTo(minimumSize) - currentSize; | 1405 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand
edTo(minimumSizeForResizing()) - currentSize; |
| 1393 | 1406 |
| 1394 bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX; | 1407 bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX; |
| 1395 | 1408 |
| 1396 EResize resize = box().style()->resize(); | 1409 EResize resize = box().style()->resize(); |
| 1397 if (resize != RESIZE_VERTICAL && difference.width()) { | 1410 if (resize != RESIZE_VERTICAL && difference.width()) { |
| 1398 if (element->isFormControlElement()) { | 1411 if (element->isFormControlElement()) { |
| 1399 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). | 1412 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). |
| 1400 element->setInlineStyleProperty(CSSPropertyMarginLeft, box().marginL
eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1413 element->setInlineStyleProperty(CSSPropertyMarginLeft, box().marginL
eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
| 1401 element->setInlineStyleProperty(CSSPropertyMarginRight, box().margin
Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1414 element->setInlineStyleProperty(CSSPropertyMarginRight, box().margin
Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
| 1402 } | 1415 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo
sitedScrollingMode mode) | 1564 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo
sitedScrollingMode mode) |
| 1552 { | 1565 { |
| 1553 if (m_forceNeedsCompositedScrolling == mode) | 1566 if (m_forceNeedsCompositedScrolling == mode) |
| 1554 return; | 1567 return; |
| 1555 | 1568 |
| 1556 m_forceNeedsCompositedScrolling = mode; | 1569 m_forceNeedsCompositedScrolling = mode; |
| 1557 layer()->didUpdateNeedsCompositedScrolling(); | 1570 layer()->didUpdateNeedsCompositedScrolling(); |
| 1558 } | 1571 } |
| 1559 | 1572 |
| 1560 } // Namespace WebCore | 1573 } // Namespace WebCore |
| OLD | NEW |