Merge from Chromium at DEPS revision r205460
This commit was generated by merge_to_master.py.
Change-Id: Id50fcfa40590db3bd322348190cb5192c432eadf
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 1f96a0e..16e663c 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1141,12 +1141,27 @@
}
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+bool Element::isDateTimeEditElement() const
+{
+ return false;
+}
+
bool Element::isDateTimeFieldElement() const
{
return false;
}
+
+bool Element::isPickerIndicatorElement() const
+{
+ return false;
+}
#endif
+bool Element::isClearButtonElement() const
+{
+ return false;
+}
+
bool Element::wasChangedSinceLastFormControlChangeEvent() const
{
return false;
@@ -1347,17 +1362,22 @@
return false;
}
-PassRefPtr<RenderStyle> Element::styleForRenderer()
+PassRefPtr<RenderStyle> Element::styleForRenderer(int childIndex)
{
if (hasCustomStyleCallbacks()) {
if (RefPtr<RenderStyle> style = customStyleForRenderer())
return style.release();
}
- return document()->styleResolver()->styleForElement(this);
+ return originalStyleForRenderer(childIndex);
}
-void Element::recalcStyle(StyleChange change)
+PassRefPtr<RenderStyle> Element::originalStyleForRenderer(int childIndex)
+{
+ return document()->styleResolver()->styleForElement(this, childIndex);
+}
+
+void Element::recalcStyle(StyleChange change, int childIndex)
{
ASSERT(document()->inStyleRecalc());
@@ -1381,7 +1401,7 @@
// FIXME: This still recalcs style twice when changing display types, but saves
// us from recalcing twice when going from none -> anything else which is more
// common, especially during lazy attach.
- newStyle = styleForRenderer();
+ newStyle = styleForRenderer(childIndex);
localChange = Node::diff(currentStyle.get(), newStyle.get(), document());
}
if (localChange == Detach) {
@@ -1437,7 +1457,9 @@
// without doing way too much re-resolution.
bool forceCheckOfNextElementSibling = false;
bool forceCheckOfAnyElementSibling = false;
+ int indexForChild = 0;
for (Node *n = firstChild(); n; n = n->nextSibling()) {
+ ++indexForChild;
if (n->isTextNode()) {
toText(n)->recalcTextStyle(change);
continue;
@@ -1448,21 +1470,28 @@
bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() == FullStyleChange;
if ((forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling))
element->setNeedsStyleRecalc();
- if (shouldRecalcStyle(change, element)) {
- parentPusher.push();
- element->recalcStyle(change);
- }
forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
}
+ // FIXME: Reversing the loop we call recalcStyle avoids an N^2 walk through the DOM to find the next renderer
+ // to insert before. The logic in NodeRenderingContext should be improved to make this unnecessary.
+ for (Node *n = lastChild(); n; n = n->previousSibling()) {
+ if (!n->isElementNode())
+ continue;
+ Element* element = toElement(n);
+ if (shouldRecalcStyle(change, element)) {
+ parentPusher.push();
+ element->recalcStyle(change, indexForChild);
+ }
+ --indexForChild;
+ }
if (shouldRecalcStyle(change, this))
updatePseudoElement(AFTER, change);
- setAttached();
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();
-
+
if (hasCustomStyleCallbacks())
didRecalcStyle(change);
InspectorInstrumentation::didRecalculateStyleForElement(this);