Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1480)

Unified Diff: Source/core/rendering/RenderLayerScrollableArea.cpp

Issue 239983004: Textarea resize-able only to larger; min-height and min-width properly set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and added shouldBeEqualToString() instead of shouldBe() in LayoutTest Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderLayerScrollableArea.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayerScrollableArea.cpp
diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp
index a89c991de7871f0d964197188dea146590fa9c87..ab372bf195cfadbd4ac0c6221ad7bfa2efc0c6e4 100644
--- a/Source/core/rendering/RenderLayerScrollableArea.cpp
+++ b/Source/core/rendering/RenderLayerScrollableArea.cpp
@@ -75,6 +75,11 @@ namespace WebCore {
const int ResizerControlExpandRatioForTouch = 2;
+// Default value is set to 15 as the default
+// minimum size used by firefox is 15x15.
+static const int defaultMinimumWidthForResizing = 15;
+static const int defaultMinimumHeightForResizing = 15;
+
RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer)
: m_layer(layer)
, m_inResizeMode(false)
@@ -722,6 +727,16 @@ static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
return overflow == OAUTO || overflow == OOVERLAY;
}
+IntSize RenderLayerScrollableArea::minimumSizeForResizing()
+{
+ int minimumWidth = intValueForLength(box().style()->logicalMinWidth(), box().containingBlock()->logicalWidth());
+ int minimumHeight = intValueForLength(box().style()->logicalMinHeight(), box().containingBlock()->logicalHeight());
+
+ minimumWidth = std::max(minimumWidth, defaultMinimumWidthForResizing);
+ minimumHeight = std::max(minimumHeight, defaultMinimumHeightForResizing);
+ return IntSize(minimumWidth, minimumHeight);
+}
+
void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldStyle)
{
// List box parts handle the scrollbars by themselves so we have nothing to do.
@@ -1380,8 +1395,6 @@ void RenderLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSiz
newOffset.setHeight(newOffset.height() / zoomFactor);
LayoutSize currentSize = LayoutSize(box().width() / zoomFactor, box().height() / zoomFactor);
- LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
- element->setMinimumSizeForResizing(minimumSize);
LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
@@ -1389,7 +1402,7 @@ void RenderLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSiz
adjustedOldOffset.setWidth(-adjustedOldOffset.width());
}
- LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
+ LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSizeForResizing()) - currentSize;
bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX;
« no previous file with comments | « Source/core/rendering/RenderLayerScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698