Changeset 112109 in webkit
- Timestamp:
- Mar 26, 2012 9:19:02 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112108 r112109 1 2012-03-26 Kent Tamura <tkent@chromium.org> 2 3 Add a notification function for detaching to TextFieldDecorator 4 https://bugs.webkit.org/show_bug.cgi?id=82142 5 6 Reviewed by Dimitri Glazkov. 7 8 Add willDetach() functio to TextFieldDecorator. This will be 9 needed if a decorator opens a popup UI on handleClick(), and the 10 popup UI should be closed when the attaching text field is 11 detached. 12 13 No new tests because of no behavior changes in any platforms. 14 15 * html/shadow/TextFieldDecorationElement.cpp: 16 (WebCore::TextFieldDecorationElement::hostInput): 17 Added. A utilify function to get an HTMLInputElement*. 18 (WebCore::TextFieldDecorationElement::updateImage): Use hostInput(). 19 (WebCore::TextFieldDecorationElement::customStyleForRenderer): ditto. 20 (WebCore::TextFieldDecorationElement::detach): Added. Calls TextFieldDecorator::willDetach(). 21 (WebCore::TextFieldDecorationElement::defaultEventHandler): Use hostInput(). 22 * html/shadow/TextFieldDecorationElement.h: 23 (TextFieldDecorator): 24 (TextFieldDecorationElement): 25 1 26 2012-03-26 Dan Bernstein <mitz@apple.com> 2 27 -
trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp
r112016 r112109 39 39 namespace WebCore { 40 40 41 using namespace HTMLNames; 42 41 43 // TextFieldDecorator ---------------------------------------------------------------- 42 44 … … 60 62 } 61 63 64 inline HTMLInputElement* TextFieldDecorationElement::hostInput() 65 { 66 ASSERT(shadowAncestorNode()); 67 ASSERT(shadowAncestorNode()->hasTagName(inputTag)); 68 return static_cast<HTMLInputElement*>(shadowAncestorNode()); 69 } 70 62 71 bool TextFieldDecorationElement::isTextFieldDecoration() const 63 72 { … … 70 79 return; 71 80 RenderImageResource* resource = toRenderImage(renderer())->imageResource(); 72 HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());73 81 CachedImage* image; 74 if ( input->disabled())82 if (hostInput()->disabled()) 75 83 image = m_textFieldDecorator->imageForDisabledState(); 76 else if ( input->readOnly())84 else if (hostInput()->readOnly()) 77 85 image = m_textFieldDecorator->imageForReadonlyState(); 78 86 else … … 85 93 { 86 94 RefPtr<RenderStyle> style = RenderStyle::create(); 87 RenderStyle* inputStyle = shadowAncestorNode()->renderStyle();95 RenderStyle* inputStyle = hostInput()->renderStyle(); 88 96 ASSERT(inputStyle); 89 97 style->setWidth(Length(inputStyle->fontSize(), Fixed)); … … 106 114 } 107 115 116 void TextFieldDecorationElement::detach() 117 { 118 m_textFieldDecorator->willDetach(hostInput()); 119 HTMLDivElement::detach(); 120 } 121 108 122 bool TextFieldDecorationElement::isMouseFocusable() const 109 123 { … … 113 127 void TextFieldDecorationElement::defaultEventHandler(Event* event) 114 128 { 115 RefPtr<HTMLInputElement> input( static_cast<HTMLInputElement*>(shadowAncestorNode()));129 RefPtr<HTMLInputElement> input(hostInput()); 116 130 if (input->disabled() || input->readOnly() || !event->isMouseEvent()) { 117 131 if (!event->defaultHandled()) -
trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h
r111930 r112109 53 53 54 54 virtual void handleClick(HTMLInputElement*) = 0; 55 virtual void willDetach(HTMLInputElement*) = 0; 55 56 56 57 virtual ~TextFieldDecorator(); … … 70 71 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; 71 72 virtual void attach() OVERRIDE; 73 virtual void detach() OVERRIDE; 72 74 virtual bool isMouseFocusable() const OVERRIDE; 73 75 virtual void defaultEventHandler(Event*) OVERRIDE; 74 76 77 HTMLInputElement* hostInput(); 75 78 void updateImage(); 76 79
Note: See TracChangeset
for help on using the changeset viewer.