Changeset 127108 in webkit
- Timestamp:
- Aug 30, 2012 12:19:55 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 13 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127107 r127108 1 2012-08-30 Shinya Kawanaka <shinyak@chromium.org> 2 3 AuthorShadowDOM support for textarea element. 4 https://bugs.webkit.org/show_bug.cgi?id=91485 5 6 Reviewed by Dimitri Glazkov. 7 8 We have the following tests. 9 (1) having only <shadow> insertion point. 10 (2) not having <shadow> insertion point. 11 (3) having <shadow> and <content> insertion point. 12 (4) with rows/cols attribute 13 (5) with placeholder attribute 14 15 * fast/dom/shadow/shadow-disable-expected.txt: 16 * fast/dom/shadow/shadow-disable.html: 17 * fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html: 18 * fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html: 19 * fast/dom/shadow/shadowdom-for-textarea-expected.html: Added. 20 * fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html: 21 * fast/dom/shadow/shadowdom-for-textarea-only-shadow.html: 22 * fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html. 23 * fast/dom/shadow/shadowdom-for-textarea-with-attribute.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html. 24 * fast/dom/shadow/shadowdom-for-textarea-with-placeholder-expected.html: Added. 25 * fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html: Added. 26 * fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html: Added. 27 * fast/dom/shadow/shadowdom-for-textarea-with-style.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html. 28 * fast/dom/shadow/shadowdom-for-textarea-without-shadow.html: 29 * fast/dom/shadow/shadowdom-for-textarea.html: Added. 30 * platform/chromium/TestExpectations: 31 * platform/efl/TestExpectations: 32 1 33 2012-08-29 Andrei Bucur <abucur@adobe.com> 2 34 -
trunk/LayoutTests/fast/dom/shadow/shadow-disable-expected.txt
r124027 r127108 18 18 SELECT 19 19 PASS new WebKitShadowRoot(element) is not null 20 TEXTAREA 21 PASS new WebKitShadowRoot(element) is not null 20 22 INPUT 21 PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.22 TEXTAREA23 23 PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3. 24 24 tref -
trunk/LayoutTests/fast/dom/shadow/shadow-disable.html
r124027 r127108 27 27 document.createElement('audio'), 28 28 document.createElement('video'), 29 document.createElement('select') 29 document.createElement('select'), 30 document.createElement('textarea') 30 31 ]; 31 32 32 33 var elementsToFail = [ 33 34 document.createElement('input'), 34 document.createElement('textarea'),35 35 document.getElementById('tref') 36 36 ]; -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html
r123713 r127108 1 1 <!DOCTYPE html> 2 <script src="resources/polyfill.js"></script> 2 <html> 3 <head> 4 <style> 5 .textarea-like { 6 width: 255px; 7 height: 96px; 8 border: 1px solid black; 9 overflow-y: scroll; 10 position: relative; 11 top: 2px; 12 margin: 2px 2px 2px 2px; 13 padding: 2px 2px 2px 2px; 14 white-space: pre-wrap; 15 word-wrap: break-word; 16 font: -webkit-small-control; 17 font-family: monospace; 18 } 19 </style> 20 </head> 21 <body> 3 22 4 23 <p>A mixed case of a shadow element and content element.</p> 5 24 <form> 6 hogehoge<div style="margin: 20px"> 7 <textarea></textarea> 8 </div> 9 <input id="submit" type="submit" value="Submit"> 25 <div class="textarea-like">textarea<p>paragraph<b>bold</b>paragraph</p><div style="margin: 20px">textarea</div></div> 10 26 </form> 27 28 </body> 29 </html> -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html
r123713 r127108 1 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5 textarea { 6 resize: none; 7 } 8 </style> 9 </head> 10 <body> 2 11 <script src="resources/polyfill.js"></script> 3 12 4 13 <p>A mixed case of a shadow element and content element.</p> 5 14 <form> 6 <textarea id="host">hogehoge</textarea> 7 <input id="submit" type="submit" value="Submit"> 15 <textarea id="host" rows="6" cols="30">textarea</textarea> 8 16 </form> 9 17 10 18 <script> 11 var host = document.getElementById('host'); 19 var p = document.createElement('p'); 20 p.innerHTML = "paragraph<b>bold</b>paragraph"; 21 host.appendChild(p); 22 12 23 var shadowRoot = new WebKitShadowRoot(host); 13 shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>" 24 25 // <content></content><div style="margin: 20px"><shadow></shadow></div> 26 shadowRoot.appendChild(document.createElement('content')); 27 var div = document.createElement('div'); 28 div.setAttribute('style', 'margin: 20px'); 29 div.appendChild(document.createElement('shadow')); 30 shadowRoot.appendChild(div); 14 31 </script> 32 33 </body> 34 </html> -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html
r123713 r127108 4 4 <p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> 5 5 <form> 6 <textarea id="host">Something in the air</textarea> 7 <input id="submit" type="submit" value="Submit"> 6 <textarea>Something in the air</textarea> 8 7 </form> 8 -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html
r123713 r127108 5 5 <form> 6 6 <textarea id="host">Something in the air</textarea> 7 <input id="submit" type="submit" value="Submit">8 7 </form> 9 8 10 9 <script> 11 var host = document.getElementById('host');12 10 var shadowRoot = new WebKitShadowRoot(host); 13 shadowRoot. innerHTML = "<shadow></shadow>"11 shadowRoot.appendChild(document.createElement('shadow')); 14 12 </script> -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html
r127107 r127108 4 4 <p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> 5 5 <form> 6 <textarea id="host">Something in the air</textarea> 7 <input id="submit" type="submit" value="Submit"> 6 <textarea rows="8" cols="20">Something in the air</textarea> 8 7 </form> -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html
r127107 r127108 4 4 <p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> 5 5 <form> 6 <textarea id="host">Something in the air</textarea> 7 <input id="submit" type="submit" value="Submit"> 6 <textarea id="host" rows="8" cols="20">Something in the air</textarea> 8 7 </form> 9 8 10 9 <script> 11 var host = document.getElementById('host');12 10 var shadowRoot = new WebKitShadowRoot(host); 13 shadowRoot. innerHTML = "<shadow></shadow>"11 shadowRoot.appendChild(document.createElement('shadow')); 14 12 </script> -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html
r127107 r127108 1 1 <!DOCTYPE html> 2 <html> 3 <head> 4 textarea { 5 margin: 10px; 6 border: 2px dashed black; 7 padding: 10px; 8 } 9 </head> 10 <body> 2 11 <script src="resources/polyfill.js"></script> 3 12 … … 5 14 <form> 6 15 <textarea id="host">Something in the air</textarea> 7 <input id="submit" type="submit" value="Submit">8 16 </form> 9 17 10 18 <script> 11 var host = document.getElementById('host');12 19 var shadowRoot = new WebKitShadowRoot(host); 13 shadowRoot. innerHTML = "<shadow></shadow>"20 shadowRoot.appendChild(document.createElement('shadow')); 14 21 </script> 22 </body> 23 </html> -
trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html
r123713 r127108 9 9 10 10 <script> 11 var select = document.getElementById('select'); 12 var shadowRoot = new WebKitShadowRoot(select); 11 var shadowRoot = new WebKitShadowRoot(host); 13 12 </script> -
trunk/LayoutTests/platform/chromium/TestExpectations
r127107 r127108 3247 3247 BUGWK90860 : fast/dom/shadow/shadowdom-for-object-only-shadow.html = IMAGE 3248 3248 BUGWK90860 : fast/dom/shadow/shadowdom-for-object-without-shadow.html = IMAGE 3249 BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html = IMAGE3250 BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-without-shadow.html = IMAGE3251 3249 BUGWK91487 : fast/dom/shadow/shadowdom-for-select-complex-shadow.html = IMAGE 3252 3250 BUGWK91487 : fast/dom/shadow/shadowdom-for-select-without-shadow.html = IMAGE -
trunk/LayoutTests/platform/efl/TestExpectations
r127101 r127108 770 770 BUGWK90860 : fast/dom/shadow/shadowdom-for-object-only-shadow.html = IMAGE 771 771 BUGWK90860 : fast/dom/shadow/shadowdom-for-object-without-shadow.html = IMAGE 772 BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html = IMAGE773 BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-only-shadow.html = IMAGE774 BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-without-shadow.html = IMAGE775 772 BUGWK91487 : fast/dom/shadow/shadowdom-for-select-complex-shadow.html = IMAGE 776 773 BUGWK91487 : fast/dom/shadow/shadowdom-for-select-without-shadow.html = IMAGE -
trunk/Source/WebCore/ChangeLog
r127106 r127108 1 2012-08-30 Shinya Kawanaka <shinyak@chromium.org> 2 3 AuthorShadowDOM support for textarea element. 4 https://bugs.webkit.org/show_bug.cgi?id=91485 5 6 Reviewed by Dimitri Glazkov. 7 8 We add AuthorShadowDOM support for textarea element. 9 10 Unlike other replaced elements (e.g. meter, progress, img), we do not need to add 11 extra RenderBlock when we add AuthorShadowDOM. However, since inner element will not have 12 renderer when AuthorShadowDOM does not have any shadow insertion point, we have to check 13 the existence of the renderer of inner element. 14 15 Tests: fast/dom/shadow/shadowdom-for-textarea-with-attribute.html 16 fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html 17 fast/dom/shadow/shadowdom-for-textarea-with-style.html 18 fast/dom/shadow/shadowdom-for-textarea.html 19 20 * dom/ShadowRoot.cpp: 21 (WebCore::allowsAuthorShadowRoot): Needs allow textarea to have AuthorShadowRoot. 22 * rendering/RenderTextControl.cpp: When AuthorShadowDOM does not have any insertion point, 23 innerTextElement() will not have any renderer. We have to tweak these renderers not to be crashed. 24 (WebCore::RenderTextControl::textBlockWidth): 25 (WebCore::RenderTextControl::updateFromElement): 26 (WebCore::RenderTextControl::computeLogicalHeight): 27 (WebCore::RenderTextControl::hitInnerTextElement): 28 (WebCore::RenderTextControl::computePreferredLogicalWidths): 29 1 30 2012-08-29 Adam Barth <abarth@webkit.org> 2 31 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r126127 r127108 89 89 // textarea element also. 90 90 // https://bugs.webkit.org/show_bug.cgi?id=92608 91 if (isHTMLInputElement(element) || isHTMLTextAreaElement(element))91 if (isHTMLInputElement(element)) 92 92 return false; 93 93 -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r126359 r127108 111 111 Element* innerText = innerTextElement(); 112 112 ASSERT(innerText); 113 return width() - borderAndPaddingWidth() - innerText->renderBox()->paddingLeft() - innerText->renderBox()->paddingRight(); 113 114 LayoutUnit unitWidth = width() - borderAndPaddingWidth(); 115 if (innerText->renderer()) 116 unitWidth -= innerText->renderBox()->paddingLeft() + innerText->renderBox()->paddingRight(); 117 118 return unitWidth; 114 119 } 115 120 … … 117 122 { 118 123 Element* innerText = innerTextElement(); 119 if (innerText )124 if (innerText && innerText->renderer()) 120 125 updateUserModifyProperty(node(), innerText->renderer()->style()); 121 126 } … … 144 149 HTMLElement* innerText = innerTextElement(); 145 150 ASSERT(innerText); 146 RenderBox* innerTextBox = innerText->renderBox(); 147 LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight(); 148 setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight()); 149 150 // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap. 151 if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && innerText->renderer()->style()->wordWrap() == NormalWordWrap)) 152 setHeight(height() + scrollbarThickness()); 151 if (RenderBox* innerTextBox = innerText->renderBox()) { 152 LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight(); 153 setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight()); 154 155 // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap. 156 if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && innerText->renderer()->style()->wordWrap() == NormalWordWrap)) 157 setHeight(height() + scrollbarThickness()); 158 } 153 159 154 160 RenderBlock::computeLogicalHeight(); … … 158 164 { 159 165 HTMLElement* innerText = innerTextElement(); 166 if (!innerText->renderer()) 167 return; 168 160 169 LayoutPoint adjustedLocation = accumulatedOffset + location(); 161 170 LayoutPoint localPoint = pointInContainer - toLayoutSize(adjustedLocation + innerText->renderBox()->location()); … … 258 267 // Use average character width. Matches IE. 259 268 AtomicString family = style()->font().family().family(); 260 RenderBox* innerTextRenderBox = innerTextElement()->renderBox(); 261 m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)) + innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight(); 269 m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)); 270 if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox()) 271 m_maxPreferredLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight(); 262 272 } 263 273
Note: See TracChangeset
for help on using the changeset viewer.