Title: [199512] trunk
Revision
199512
Author
[email protected]
Date
2016-04-13 13:40:07 -0700 (Wed, 13 Apr 2016)

Log Message

Non-resizable text field looks resizable
https://bugs.webkit.org/show_bug.cgi?id=152271

Reviewed by Darin Adler.

Source/WebCore:

The 'resizability' of an HTML element is controlled by its 'resize' CSS property value.
By default it is 'none', but certain HTML elements, including <textarea>, have it
set to 'both' by default (defined in html.css). These values mean no resize at all, and
resizable in both vertical and horizontal axis, respectively.
Additionally, 'vertical' and 'horizontal' values are also valid.

Problem here is that the way WebKit handles the 'resize' property on single line
input elements (e.g. <input>) is different than other engines (read Gecko, Blink and Presto):

- Match: WebKit, Firefox, Presto and Blink all force single line input elements to be non-resizable,
regardless of either the 'resize' properly is set or not.

- Mismatch: WebKit is the only engine that actually paints the resize control on single line
input elements, even it having no effect.

On WebKit, this happens because the 'resize' property is wrongly implemented as 'inheritable',
differently from other engines. In the way WebKit contructs its RenderTree, 'resize' property
ends up spilling out of <input> and entering its shadow representation, carrying the 'resize'
property on.

Patch fixes this by making the 'resize' properly be non-inherited, matching other vendors
and the spec [1].

[1] https://drafts.csswg.org/css-ui/#resize

Tests: fast/css/resize-not-inherited.html
       fast/css/resize-single-line-input-no-paint.html

* rendering/style/RenderStyle.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

* fast/css/resize-not-inherited-expected.html: Added.
* fast/css/resize-not-inherited.html: Added.
* fast/css/resize-single-line-input-no-paint-expected.html: Added.
* fast/css/resize-single-line-input-no-paint.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199511 => 199512)


--- trunk/LayoutTests/ChangeLog	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/LayoutTests/ChangeLog	2016-04-13 20:40:07 UTC (rev 199512)
@@ -1,3 +1,15 @@
+2016-04-13  Antonio Gomes  <[email protected]>
+
+        Non-resizable text field looks resizable
+        https://bugs.webkit.org/show_bug.cgi?id=152271
+
+        Reviewed by Darin Adler.
+
+        * fast/css/resize-not-inherited-expected.html: Added.
+        * fast/css/resize-not-inherited.html: Added.
+        * fast/css/resize-single-line-input-no-paint-expected.html: Added.
+        * fast/css/resize-single-line-input-no-paint.html: Added.
+
 2016-04-13  Mark Lam  <[email protected]>
 
         ES6: Implement RegExp.prototype[@@search].

Added: trunk/LayoutTests/fast/css/resize-not-inherited-expected.html (0 => 199512)


--- trunk/LayoutTests/fast/css/resize-not-inherited-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/resize-not-inherited-expected.html	2016-04-13 20:40:07 UTC (rev 199512)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<style>
+.container {
+  width:100px;
+  height:100px;
+  overflow:hidden;
+  position:absolute;
+  background-color:pink;
+}
+</style>
+
+<p>Test ensures that a 'resize' property is not inherited by its children. Test passes if the resizer (green square) is not seen at the bottom right.</p>
+<div>
+  <div class="container"></div>
+</div>

Added: trunk/LayoutTests/fast/css/resize-not-inherited.html (0 => 199512)


--- trunk/LayoutTests/fast/css/resize-not-inherited.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/resize-not-inherited.html	2016-04-13 20:40:07 UTC (rev 199512)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<style>
+.container {
+  width:100px;
+  height:100px;
+  overflow:hidden;
+  position:absolute;
+  background-color:pink;
+}
+
+.container::-webkit-resizer {
+  background-color: rgba(0, 127, 0, 0.5);
+}
+</style>
+
+<p>Test ensures that a 'resize' property is not inherited by its children. Test passes if the resizer (green square) is not seen at the bottom right.</p>
+<div style="resize:vertical;">
+  <div class="container"></div>
+</div>

Added: trunk/LayoutTests/fast/css/resize-single-line-input-no-paint-expected.html (0 => 199512)


--- trunk/LayoutTests/fast/css/resize-single-line-input-no-paint-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/resize-single-line-input-no-paint-expected.html	2016-04-13 20:40:07 UTC (rev 199512)
@@ -0,0 +1,4 @@
+<input type="text">
+<input type="text">
+<input type="text"> 
+<input type="text">

Added: trunk/LayoutTests/fast/css/resize-single-line-input-no-paint.html (0 => 199512)


--- trunk/LayoutTests/fast/css/resize-single-line-input-no-paint.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/resize-single-line-input-no-paint.html	2016-04-13 20:40:07 UTC (rev 199512)
@@ -0,0 +1,4 @@
+<input type="text" style="resize:vertical">
+<input type="text" style="resize:horizontal">
+<input type="text" style="resize:both">
+<input type="text" style="resize:none">

Modified: trunk/Source/WebCore/ChangeLog (199511 => 199512)


--- trunk/Source/WebCore/ChangeLog	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/Source/WebCore/ChangeLog	2016-04-13 20:40:07 UTC (rev 199512)
@@ -1,3 +1,48 @@
+2016-04-13  Antonio Gomes  <[email protected]>
+
+        Non-resizable text field looks resizable
+        https://bugs.webkit.org/show_bug.cgi?id=152271
+
+        Reviewed by Darin Adler.
+
+        The 'resizability' of an HTML element is controlled by its 'resize' CSS property value.
+        By default it is 'none', but certain HTML elements, including <textarea>, have it
+        set to 'both' by default (defined in html.css). These values mean no resize at all, and
+        resizable in both vertical and horizontal axis, respectively.
+        Additionally, 'vertical' and 'horizontal' values are also valid.
+
+        Problem here is that the way WebKit handles the 'resize' property on single line
+        input elements (e.g. <input>) is different than other engines (read Gecko, Blink and Presto):
+
+        - Match: WebKit, Firefox, Presto and Blink all force single line input elements to be non-resizable,
+        regardless of either the 'resize' properly is set or not.
+
+        - Mismatch: WebKit is the only engine that actually paints the resize control on single line
+        input elements, even it having no effect.
+
+        On WebKit, this happens because the 'resize' property is wrongly implemented as 'inheritable',
+        differently from other engines. In the way WebKit contructs its RenderTree, 'resize' property
+        ends up spilling out of <input> and entering its shadow representation, carrying the 'resize'
+        property on.
+
+        Patch fixes this by making the 'resize' properly be non-inherited, matching other vendors
+        and the spec [1].
+
+        [1] https://drafts.csswg.org/css-ui/#resize
+
+        Tests: fast/css/resize-not-inherited.html
+               fast/css/resize-single-line-input-no-paint.html
+
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator==):
+        * rendering/style/StyleRareInheritedData.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2016-04-13  Darin Adler  <[email protected]>
 
         Remove UsePointersEvenForNonNullableObjectArguments from DataTransfer

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (199511 => 199512)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2016-04-13 20:40:07 UTC (rev 199512)
@@ -999,7 +999,7 @@
     const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
     const AtomicString& locale() const { return fontDescription().locale(); }
     EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
-    EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
+    EResize resize() const { return static_cast<EResize>(rareNonInheritedData->m_resize); }
     ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(rareNonInheritedData->m_multiCol->m_axis); }
     bool hasInlineColumnAxis() const {
         ColumnAxis axis = columnAxis();
@@ -1573,7 +1573,7 @@
     void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); }
     void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
     void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
-    void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
+    void setResize(EResize r) { SET_VAR(rareNonInheritedData, m_resize, r); }
     void setColumnAxis(ColumnAxis axis) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_axis, axis); }
     void setColumnProgression(ColumnProgression progression) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_progression, progression); }
     void setColumnWidth(float f) { SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_autoWidth, false); SET_NESTED_VAR(rareNonInheritedData, m_multiCol, m_width, f); }

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (199511 => 199512)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2016-04-13 20:40:07 UTC (rev 199512)
@@ -85,7 +85,6 @@
     , overflowWrap(RenderStyle::initialOverflowWrap())
     , nbspMode(NBNORMAL)
     , lineBreak(LineBreakAuto)
-    , resize(RenderStyle::initialResize())
     , userSelect(RenderStyle::initialUserSelect())
     , speak(SpeakNormal)
     , hyphens(HyphensManual)
@@ -168,7 +167,6 @@
     , overflowWrap(o.overflowWrap)
     , nbspMode(o.nbspMode)
     , lineBreak(o.lineBreak)
-    , resize(o.resize)
     , userSelect(o.userSelect)
     , speak(o.speak)
     , hyphens(o.hyphens)
@@ -269,7 +267,6 @@
 #if ENABLE(IOS_TEXT_AUTOSIZING)
         && textSizeAdjust == o.textSizeAdjust
 #endif
-        && resize == o.resize
         && userSelect == o.userSelect
         && speak == o.speak
         && hyphens == o.hyphens

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (199511 => 199512)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2016-04-13 20:40:07 UTC (rev 199512)
@@ -92,7 +92,6 @@
     unsigned overflowWrap : 1; // EOverflowWrap
     unsigned nbspMode : 1; // ENBSPMode
     unsigned lineBreak : 3; // LineBreak
-    unsigned resize : 2; // EResize
     unsigned userSelect : 2; // EUserSelect
     unsigned colorSpace : 1; // ColorSpace
     unsigned speak : 3; // ESpeak

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (199511 => 199512)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2016-04-13 20:40:07 UTC (rev 199512)
@@ -108,6 +108,7 @@
     , m_breakBefore(RenderStyle::initialBreakBetween())
     , m_breakAfter(RenderStyle::initialBreakBetween())
     , m_breakInside(RenderStyle::initialBreakInside())
+    , m_resize(RenderStyle::initialResize())
 {
     m_maskBoxImage.setMaskDefaults();
 }
@@ -201,6 +202,7 @@
     , m_breakBefore(o.m_breakBefore)
     , m_breakAfter(o.m_breakAfter)
     , m_breakInside(o.m_breakInside)
+    , m_resize(o.m_resize)
 {
 }
 
@@ -304,7 +306,8 @@
         && m_objectFit == o.m_objectFit
         && m_breakAfter == o.m_breakAfter
         && m_breakBefore == o.m_breakBefore
-        && m_breakInside == o.m_breakInside;
+        && m_breakInside == o.m_breakInside
+        && m_resize == o.m_resize;
 }
 
 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (199511 => 199512)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2016-04-13 20:00:31 UTC (rev 199511)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2016-04-13 20:40:07 UTC (rev 199512)
@@ -225,6 +225,7 @@
     unsigned m_breakBefore : 4; // BreakBetween
     unsigned m_breakAfter : 4;
     unsigned m_breakInside : 3; // BreakInside
+    unsigned m_resize : 2; // EResize
 
 private:
     StyleRareNonInheritedData();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to