Title: [136575] trunk/Source/WebCore
- Revision
- 136575
- Author
- [email protected]
- Date
- 2012-12-04 14:43:26 -0800 (Tue, 04 Dec 2012)
Log Message
setIsInTopLayer is not really a setter
https://bugs.webkit.org/show_bug.cgi?id=103912
Patch by Elliott Sprehn <[email protected]> on 2012-12-04
Reviewed by Eric Seidel.
Element::setInTopLayer isn't just a setter, it also adds the element
to the top layer vector in the document which changes it's display and
causes a reattach.
To make this more obvious make HTMLDialogElement use the methods on
Document and make those update the state boolean.
There also doesn't seem to be any reason for setInTopLayer
or isInTopLayer to be virtual, it appears it was a typo.
No new tests, just refactoring.
* dom/Document.cpp:
(WebCore::Document::addToTopLayer):
(WebCore::Document::removeFromTopLayer):
* dom/Element.cpp:
(WebCore::Element::setIsInTopLayer):
* dom/Element.h:
* html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::close):
(WebCore::HTMLDialogElement::showModal):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136574 => 136575)
--- trunk/Source/WebCore/ChangeLog 2012-12-04 22:42:57 UTC (rev 136574)
+++ trunk/Source/WebCore/ChangeLog 2012-12-04 22:43:26 UTC (rev 136575)
@@ -1,5 +1,34 @@
2012-12-04 Elliott Sprehn <[email protected]>
+ setIsInTopLayer is not really a setter
+ https://bugs.webkit.org/show_bug.cgi?id=103912
+
+ Reviewed by Eric Seidel.
+
+ Element::setInTopLayer isn't just a setter, it also adds the element
+ to the top layer vector in the document which changes it's display and
+ causes a reattach.
+
+ To make this more obvious make HTMLDialogElement use the methods on
+ Document and make those update the state boolean.
+
+ There also doesn't seem to be any reason for setInTopLayer
+ or isInTopLayer to be virtual, it appears it was a typo.
+
+ No new tests, just refactoring.
+
+ * dom/Document.cpp:
+ (WebCore::Document::addToTopLayer):
+ (WebCore::Document::removeFromTopLayer):
+ * dom/Element.cpp:
+ (WebCore::Element::setIsInTopLayer):
+ * dom/Element.h:
+ * html/HTMLDialogElement.cpp:
+ (WebCore::HTMLDialogElement::close):
+ (WebCore::HTMLDialogElement::showModal):
+
+2012-12-04 Elliott Sprehn <[email protected]>
+
Automatically handle suspend and resume of post attach callbacks
https://bugs.webkit.org/show_bug.cgi?id=103910
Modified: trunk/Source/WebCore/dom/Document.cpp (136574 => 136575)
--- trunk/Source/WebCore/dom/Document.cpp 2012-12-04 22:42:57 UTC (rev 136574)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-12-04 22:43:26 UTC (rev 136575)
@@ -5425,15 +5425,21 @@
#if ENABLE(DIALOG_ELEMENT)
void Document::addToTopLayer(Element* element)
{
+ if (element->isInTopLayer())
+ return;
ASSERT(!m_topLayerElements.contains(element));
m_topLayerElements.append(element);
+ element->setIsInTopLayer(true);
}
void Document::removeFromTopLayer(Element* element)
{
+ if (!element->isInTopLayer())
+ return;
size_t position = m_topLayerElements.find(element);
ASSERT(position != notFound);
m_topLayerElements.remove(position);
+ element->setIsInTopLayer(false);
}
#endif
Modified: trunk/Source/WebCore/dom/Element.cpp (136574 => 136575)
--- trunk/Source/WebCore/dom/Element.cpp 2012-12-04 22:42:57 UTC (rev 136574)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-12-04 22:43:26 UTC (rev 136575)
@@ -2230,15 +2230,7 @@
void Element::setIsInTopLayer(bool inTopLayer)
{
- if (isInTopLayer() == inTopLayer)
- return;
-
ensureElementRareData()->setIsInTopLayer(inTopLayer);
-
- if (inTopLayer)
- document()->addToTopLayer(this);
- else
- document()->removeFromTopLayer(this);
setNeedsStyleRecalc(SyntheticStyleChange);
}
#endif
Modified: trunk/Source/WebCore/dom/Element.h (136574 => 136575)
--- trunk/Source/WebCore/dom/Element.h 2012-12-04 22:42:57 UTC (rev 136574)
+++ trunk/Source/WebCore/dom/Element.h 2012-12-04 22:43:26 UTC (rev 136575)
@@ -437,8 +437,8 @@
#endif
#if ENABLE(DIALOG_ELEMENT)
- virtual bool isInTopLayer() const;
- virtual void setIsInTopLayer(bool);
+ bool isInTopLayer() const;
+ void setIsInTopLayer(bool);
#endif
#if ENABLE(POINTER_LOCK)
Modified: trunk/Source/WebCore/html/HTMLDialogElement.cpp (136574 => 136575)
--- trunk/Source/WebCore/html/HTMLDialogElement.cpp 2012-12-04 22:42:57 UTC (rev 136574)
+++ trunk/Source/WebCore/html/HTMLDialogElement.cpp 2012-12-04 22:43:26 UTC (rev 136575)
@@ -53,7 +53,7 @@
return;
}
setBooleanAttribute(openAttr, false);
- setIsInTopLayer(false);
+ document()->removeFromTopLayer(this);
}
void HTMLDialogElement::show()
@@ -70,7 +70,7 @@
return;
}
setBooleanAttribute(openAttr, true);
- setIsInTopLayer(true);
+ document()->addToTopLayer(this);
}
bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes