Changeset 87123 in webkit
- Timestamp:
- May 23, 2011 8:31:34 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87122 r87123 1 2011-05-20 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 [Refactoring] attach() following detach() should be replaced with Node::reattach() 6 https://bugs.webkit.org/show_bug.cgi?id=61011 7 8 - Renamed forceReattach() to reattach() 9 - Introduced reattachIfAttached() as a variant. 10 11 No new tests. No behavior change. 12 13 * dom/CharacterData.cpp: 14 (WebCore::CharacterData::updateRenderer): 15 * dom/Element.cpp: 16 (WebCore::Element::recalcStyle): 17 * dom/Node.h: 18 (WebCore::Node::reattach): 19 (WebCore::Node::reattachIfAttached): 20 * dom/Text.cpp: 21 (WebCore::Text::recalcStyle): 22 * html/HTMLDetailsElement.cpp: 23 (WebCore::HTMLDetailsElement::refreshMainSummary): 24 (WebCore::HTMLDetailsElement::parseMappedAttribute): 25 * html/HTMLInputElement.cpp: 26 (WebCore::HTMLInputElement::parseMappedAttribute): 27 * html/HTMLObjectElement.cpp: 28 (WebCore::HTMLObjectElement::renderFallbackContent): 29 * html/HTMLPlugInImageElement.cpp: 30 (WebCore::HTMLPlugInImageElement::recalcStyle): 31 * html/HTMLSelectElement.cpp: 32 (WebCore::HTMLSelectElement::parseMappedAttribute): 33 1 34 2011-05-23 Mark Rowe <mrowe@apple.com> 2 35 -
trunk/Source/WebCore/dom/CharacterData.cpp
r85030 r87123 183 183 { 184 184 if ((!renderer() || !rendererIsNeeded(renderer()->style())) && attached()) { 185 detach(); 186 attach(); 185 reattach(); 187 186 } else if (renderer()) 188 187 toRenderText(renderer())->setTextWithOffset(m_data, offsetOfReplacedData, lengthOfReplacedData); -
trunk/Source/WebCore/dom/Element.cpp
r87067 r87123 1087 1087 StyleChange ch = diff(currentStyle.get(), newStyle.get()); 1088 1088 if (ch == Detach || !currentStyle) { 1089 if (attached()) 1090 detach(); 1091 attach(); // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along. 1089 // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along. 1090 reattach(); 1092 1091 // attach recalulates the style for all children. No need to do it twice. 1093 1092 clearNeedsStyleRecalc(); -
trunk/Source/WebCore/dom/Node.h
r87079 r87123 452 452 virtual void detach(); 453 453 454 void forceReattach(); 454 void reattach(); 455 void reattachIfAttached(); 455 456 456 457 virtual void willRemove(); … … 740 741 } 741 742 742 inline void Node:: forceReattach()743 inline void Node::reattach() 743 744 { 744 if (!attached()) 745 return; 746 detach(); 745 if (attached()) 746 detach(); 747 747 attach(); 748 } 749 750 inline void Node::reattachIfAttached() 751 { 752 if (attached()) 753 reattach(); 748 754 } 749 755 -
trunk/Source/WebCore/dom/ShadowContentSelector.cpp
r86726 r87123 63 63 continue; 64 64 65 child-> forceReattach();65 child->reattach(); 66 66 m_children[i] = 0; 67 67 } -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r86726 r87123 85 85 { 86 86 if (hasContentElement()) 87 forceReattach();87 reattach(); 88 88 else { 89 89 for (Node* n = firstChild(); n; n = n->nextSibling()) -
trunk/Source/WebCore/dom/Text.cpp
r85256 r87123 266 266 if (renderer()->isText()) 267 267 toRenderText(renderer())->setText(dataImpl()); 268 } else { 269 if (attached()) 270 detach(); 271 attach(); 272 } 268 } else 269 reattach(); 273 270 } 274 271 clearNeedsStyleRecalc(); -
trunk/Source/WebCore/html/HTMLDetailsElement.cpp
r86726 r87123 147 147 return; 148 148 149 if (oldSummary && oldSummary->parentNodeForRenderingAndStyle()) { 150 oldSummary->detach(); 151 oldSummary->attach(); 152 } 153 154 if (m_mainSummary && refreshRenderer == RefreshRendererAllowed) { 155 m_mainSummary->detach(); 156 m_mainSummary->attach(); 157 } 149 if (oldSummary && oldSummary->parentNodeForRenderingAndStyle()) 150 oldSummary->reattach(); 151 if (m_mainSummary && refreshRenderer == RefreshRendererAllowed) 152 m_mainSummary->reattach(); 158 153 } 159 154 … … 197 192 bool oldValue = m_isOpen; 198 193 m_isOpen = !attr->value().isNull(); 199 if (attached() && oldValue != m_isOpen) { 200 detach(); 201 attach(); 202 } 194 if (oldValue != m_isOpen) 195 reattachIfAttached(); 203 196 } else 204 197 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r87067 r87123 722 722 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right 723 723 // time to relayout for this change. 724 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) && attached()) { 725 detach(); 726 attach(); 727 } 724 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0)) 725 reattachIfAttached(); 728 726 setNeedsStyleRecalc(); 729 727 } else if (attr->name() == autosaveAttr || attr->name() == incrementalAttr) -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r87115 r87123 379 379 if (!isImageType()) { 380 380 // If we don't think we have an image type anymore, then clear the image from the loader. 381 m_imageLoader->setImage(0); 382 detach(); 383 attach(); 381 m_imageLoader->setImage(0); 382 reattach(); 384 383 return; 385 384 } -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r82001 r87123 125 125 { 126 126 // FIXME: Why is this necessary? Manual re-attach is almost always wrong. 127 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType()) { 128 detach(); 129 attach(); 130 } 127 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType()) 128 reattach(); 131 129 HTMLPlugInElement::recalcStyle(ch); 132 130 } -
trunk/Source/WebCore/html/HTMLSelectElement.cpp
r86827 r87123 265 265 setNeedsValidityCheck(); 266 266 if ((oldUsesMenuList != m_data.usesMenuList() || (!oldUsesMenuList && m_data.size() != oldSize)) && attached()) { 267 detach(); 268 attach(); 267 reattach(); 269 268 setRecalcListItems(); 270 269 }
Note: See TracChangeset
for help on using the changeset viewer.