Changeset 155408 in webkit
- Timestamp:
- Sep 9, 2013 6:08:47 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r155404 r155408 1 2013-09-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Remove HTMLTextFormControl::fixPlaceholderRenderer 4 https://bugs.webkit.org/show_bug.cgi?id=121058 5 6 Reviewed by Kent Tamura. 7 8 Rebaseline tests now that the placeholder appears before the inner text element. 9 10 * fast/forms/placeholder-position-expected.txt: 11 * platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt: 12 * platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt: 13 * platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt: 14 * platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.txt: 15 * platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.txt: 16 1 17 2013-09-09 Mark Lam <mark.lam@apple.com> 2 18 -
trunk/LayoutTests/fast/forms/placeholder-position-expected.txt
r155324 r155408 74 74 layer at (10,102) size 161x32 clip at (11,103) size 159x30 75 75 RenderTextControl {TEXTAREA} at (2,94) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 76 RenderBlock {DIV} at (3,3) size 155x13 76 77 RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9] 77 78 RenderText {#text} at (0,0) size 63x13 78 79 text run at (0,0) width 63: "placeholder" 79 RenderBlock {DIV} at (3,3) size 155x1380 80 layer at (13,141) size 117x13 81 81 RenderBlock {DIV} at (3,3) size 117x13 [color=#A9A9A9] … … 86 86 layer at (10,175) size 161x45 clip at (11,176) size 159x43 87 87 RenderTextControl {TEXTAREA} at (2,167) size 161x45 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 88 RenderBlock {DIV} at (3,16) size 155x13 88 89 RenderBlock {DIV} at (3,16) size 155x13 [color=#A9A9A9] 89 90 RenderText {#text} at (0,0) size 63x13 90 91 text run at (0,0) width 63: "placeholder" 91 RenderBlock {DIV} at (3,16) size 155x1392 92 layer at (19,233) size 162x18 93 93 RenderBlock {DIV} at (6,6) size 162x18 [color=#A9A9A9] -
trunk/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt
r139198 r155408 17 17 layer at (13,47) size 117x13 18 18 RenderBlock {DIV} at (3,3) size 117x13 19 caret: position 0 of child 0{DIV} of {#document-fragment} of child 1 {INPUT} of child 3 {DIV} of body19 caret: position 0 of child 1 {DIV} of {#document-fragment} of child 1 {INPUT} of child 3 {DIV} of body -
trunk/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt
r139198 r155408 18 18 RenderBlock {DIV} at (3,3) size 117x13 19 19 RenderBR {BR} at (0,0) size 0x13 20 caret: position 0 of child 0 {BR} of child 0{DIV} of {#document-fragment} of child 1 {INPUT} of child 3 {DIV} of body20 caret: position 0 of child 0 {BR} of child 1 {DIV} of {#document-fragment} of child 1 {INPUT} of child 3 {DIV} of body -
trunk/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
r118751 r155408 16 16 layer at (10,28) size 161x32 clip at (11,29) size 159x30 17 17 RenderTextControl {TEXTAREA} at (2,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 18 RenderBlock {DIV} at (3,3) size 155x13 18 19 RenderBlock {DIV} at (3,3) size 155x13 [color=#640000] 19 20 RenderText {#text} at (0,0) size 22x13 20 21 text run at (0,0) width 22: "text" 21 RenderBlock {DIV} at (3,3) size 155x1322 22 layer at (179,28) size 161x32 clip at (180,29) size 159x30 23 23 RenderTextControl {TEXTAREA} at (171,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 24 RenderBlock {DIV} at (3,3) size 155x13 [color=#545454] 24 25 RenderBlock {DIV} at (3,3) size 155x13 [color=#640000] 25 26 RenderText {#text} at (0,0) size 70x13 26 27 text run at (0,0) width 70: "disabled text" 27 RenderBlock {DIV} at (3,3) size 155x13 [color=#545454]28 28 layer at (348,28) size 161x32 clip at (349,29) size 159x30 29 29 RenderTextControl {TEXTAREA} at (340,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 30 RenderBlock {DIV} at (3,3) size 155x13 30 31 RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9] 31 32 RenderText {#text} at (0,0) size 38x13 32 33 text run at (0,0) width 38: "default" 33 RenderBlock {DIV} at (3,3) size 155x1334 34 layer at (517,28) size 161x32 clip at (518,29) size 159x30 35 35 RenderTextControl {TEXTAREA} at (509,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 36 RenderBlock {DIV} at (3,3) size 155x13 [color=#545454] 36 37 RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9] 37 38 RenderText {#text} at (0,0) size 86x13 38 39 text run at (0,0) width 86: "default disabled" 39 RenderBlock {DIV} at (3,3) size 155x13 [color=#545454] -
trunk/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.txt
r139198 r155408 12 12 layer at (10,44) size 161x32 clip at (11,45) size 159x30 13 13 RenderTextControl {TEXTAREA} at (2,2) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 14 RenderBlock {DIV} at (3,3) size 155x13 15 RenderBR {BR} at (0,0) size 0x13 14 16 RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9] 15 17 RenderText {#text} at (0,0) size 62x13 16 18 text run at (0,0) width 62: "Placeholder" 17 RenderBlock {DIV} at (3,3) size 155x1318 RenderBR {BR} at (0,0) size 0x1319 19 caret: position 0 of child 0 {BR} of child 0 {DIV} of {#document-fragment} of child 1 {TEXTAREA} of child 3 {DIV} of body -
trunk/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.txt
r139198 r155408 12 12 layer at (10,44) size 161x32 clip at (11,45) size 159x30 13 13 RenderTextControl {TEXTAREA} at (2,2) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 14 RenderBlock {DIV} at (3,3) size 155x13 14 15 RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9] 15 16 RenderText {#text} at (0,0) size 62x13 16 17 text run at (0,0) width 62: "Placeholder" 17 RenderBlock {DIV} at (3,3) size 155x1318 18 caret: position 0 of child 0 {DIV} of {#document-fragment} of child 1 {TEXTAREA} of child 3 {DIV} of body -
trunk/Source/WebCore/ChangeLog
r155398 r155408 1 2013-09-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Remove HTMLTextFormControl::fixPlaceholderRenderer 4 https://bugs.webkit.org/show_bug.cgi?id=121058 5 6 Reviewed by Kent Tamura. 7 8 HTMLTextFormControl::fixPlaceholderRenderer was added in r118733 to swap the order in which placeholder appears. 9 Namely, when a text form control element is focused, placeholder should be rendered behind the text for the caret 10 to render on top of, not behind, the placeholder text. However, we can achieve the same effect by changing 11 the order of elements in the shadow DOM instead of manually manipuating the render tree as the assertion failure 12 mentioned in the change log is a bogus one. 13 14 Cleaned up the code by removing HTMLTextFormControl::fixPlaceholderRenderer and changed the order in which inner 15 text element and placeholder element appear. Also fixed the assertion in Position's constructor. 16 17 * dom/Position.cpp: 18 (WebCore::Position::Position): The original assertion was bogus. What we don't want have is for a Position to be 19 before or after a shadow root. It's fine for it be anchroed against the shadow root as long as it's inside. 20 21 * html/HTMLTextAreaElement.cpp: 22 (WebCore::HTMLTextAreaElement::updatePlaceholderText): Insert the placeholder before the inner text element. 23 * html/HTMLTextAreaElement.h: 24 * html/HTMLTextFormControlElement.cpp: 25 * html/HTMLTextFormControlElement.h: 26 * html/TextFieldInputType.cpp: 27 (WebCore::TextFieldInputType::updatePlaceholderText): Ditto. 28 * html/TextFieldInputType.h: 29 1 30 2013-09-09 Andreas Kling <akling@apple.com> 2 31 -
trunk/Source/WebCore/dom/Position.cpp
r155366 r155408 86 86 { 87 87 #if ENABLE(SHADOW_DOM) 88 ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled()) 89 || !m_anchorNode || !m_anchorNode->isShadowRoot()); 88 ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled()) || !m_anchorNode || !m_anchorNode->isShadowRoot() || m_anchorNode == containerNode()); 90 89 #else 91 ASSERT(!m_anchorNode || !m_anchorNode->isShadowRoot() );90 ASSERT(!m_anchorNode || !m_anchorNode->isShadowRoot() || m_anchorNode == containerNode()); 92 91 #endif 93 92 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement()); … … 101 100 { 102 101 #if ENABLE(SHADOW_DOM) 103 ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled()) 104 || !m_anchorNode || !m_anchorNode->isShadowRoot()); 102 ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled()) || !m_anchorNode || !m_anchorNode->isShadowRoot() || m_anchorNode == containerNode()); 105 103 #else 106 ASSERT(!m_anchorNode || !m_anchorNode->isShadowRoot() );104 ASSERT(!m_anchorNode || !m_anchorNode->isShadowRoot() || m_anchorNode == containerNode()); 107 105 #endif 108 106 -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r154962 r155408 518 518 } 519 519 520 void HTMLTextAreaElement::didAttachRenderers()521 {522 HTMLTextFormControlElement::didAttachRenderers();523 fixPlaceholderRenderer(m_placeholder, innerTextElement());524 }525 526 520 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const 527 521 { … … 548 542 m_placeholder = placeholder.get(); 549 543 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral)); 550 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling() , ASSERT_NO_EXCEPTION);544 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling()); 551 545 } 552 546 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); 553 fixPlaceholderRenderer(m_placeholder, innerTextElement()); 554 } 555 556 } 547 } 548 549 } -
trunk/Source/WebCore/html/HTMLTextAreaElement.h
r155155 r155408 112 112 113 113 virtual bool shouldUseInputMethod() OVERRIDE; 114 virtual void didAttachRenderers() OVERRIDE;115 114 virtual bool matchesReadOnlyPseudoClass() const OVERRIDE; 116 115 virtual bool matchesReadWritePseudoClass() const OVERRIDE; -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r154877 r155408 169 169 } 170 170 171 void HTMLTextFormControlElement::fixPlaceholderRenderer(HTMLElement* placeholder, HTMLElement* siblingElement)172 {173 // FIXME: We should change the order of DOM nodes. But it makes an assertion174 // failure in editing code.175 if (!placeholder || !placeholder->renderer())176 return;177 RenderObject* placeholderRenderer = placeholder->renderer();178 RenderObject* siblingRenderer = siblingElement->renderer();179 if (!siblingRenderer)180 return;181 if (placeholderRenderer->nextSibling() == siblingRenderer)182 return;183 RenderObject* parentRenderer = placeholderRenderer->parent();184 ASSERT(siblingRenderer->parent() == parentRenderer);185 parentRenderer->removeChild(placeholderRenderer);186 parentRenderer->addChild(placeholderRenderer, siblingRenderer);187 }188 189 171 void HTMLTextFormControlElement::setSelectionStart(int start) 190 172 { -
trunk/Source/WebCore/html/HTMLTextFormControlElement.h
r154868 r155408 55 55 virtual HTMLElement* placeholderElement() const = 0; 56 56 void updatePlaceholderVisibility(bool); 57 static void fixPlaceholderRenderer(HTMLElement* placeholder, HTMLElement* siblingElement);58 57 59 58 int indexForVisiblePosition(const VisiblePosition&) const; -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r154877 r155408 419 419 m_placeholder = HTMLDivElement::create(&element()->document()); 420 420 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral)); 421 element()->userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container ->nextSibling() : innerTextElement()->nextSibling(), ASSERT_NO_EXCEPTION);421 element()->userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container.get() : innerTextElement(), ASSERT_NO_EXCEPTION); 422 422 } 423 423 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); 424 element()->fixPlaceholderRenderer(m_placeholder.get(), m_container ? m_container.get() : m_innerText.get());425 }426 427 void TextFieldInputType::attach()428 {429 InputType::attach();430 // If container exists, the container should not have any content data.431 ASSERT(!m_container || !m_container->renderStyle() || !m_container->renderStyle()->hasContent());432 433 element()->fixPlaceholderRenderer(m_placeholder.get(), m_container ? m_container.get() : m_innerText.get());434 424 } 435 425 -
trunk/Source/WebCore/html/TextFieldInputType.h
r154721 r155408 58 58 59 59 protected: 60 virtual void attach() OVERRIDE;61 60 virtual bool needsContainer() const; 62 61 virtual bool shouldHaveSpinButton() const;
Note: See TracChangeset
for help on using the changeset viewer.