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

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: Addressing the changes asked in patch set 4 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
Index: Source/core/rendering/RenderLayerScrollableArea.cpp
diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp
index d341b15c297482c8479e09e707bee5f24d4a2da6..bcc7346df2afc86e1acf2f5e38bde00913f07844 100644
--- a/Source/core/rendering/RenderLayerScrollableArea.cpp
+++ b/Source/core/rendering/RenderLayerScrollableArea.cpp
@@ -74,6 +74,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(RenderBox& box)
: m_box(box)
, m_inResizeMode(false)
@@ -714,6 +719,19 @@ static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
return overflow == OAUTO || overflow == OOVERLAY;
}
+IntSize RenderLayerScrollableArea::minimumSizeForResizing()
+{
+ int minimumWidth;
+ 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.
+
+ minimumWidth = intValueForLength(m_box.style()->logicalMinWidth(), m_box.containingBlock()->logicalWidth());
+ minimumHeight = intValueForLength(m_box.style()->logicalMinHeight(), m_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.
@@ -1352,8 +1370,6 @@ void RenderLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSiz
newOffset.setHeight(newOffset.height() / zoomFactor);
LayoutSize currentSize = LayoutSize(m_box.width() / zoomFactor, m_box.height() / zoomFactor);
- LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
- element->setMinimumSizeForResizing(minimumSize);
LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
if (m_box.style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
@@ -1361,7 +1377,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(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
bool isBoxSizingBorder = m_box.style()->boxSizing() == BORDER_BOX;

Powered by Google App Engine
This is Rietveld 408576698