Title: [200741] trunk/Source/WebCore
- Revision
- 200741
- Author
- cdu...@apple.com
- Date
- 2016-05-11 21:35:15 -0700 (Wed, 11 May 2016)
Log Message
Kill Node::ancestorElement()
https://bugs.webkit.org/show_bug.cgi?id=157599
Reviewed by Darin Adler.
Kill Node::ancestorElement() and use Node::parentElement() instead. If
our parent is not an Element then none of our ancestors will be.
* dom/Node.cpp:
(WebCore::Node::isDefaultNamespace):
(WebCore::Node::lookupPrefix):
(WebCore::Node::lookupNamespaceURI):
(WebCore::Node::lookupNamespacePrefix):
(WebCore::Node::convertToPage):
(WebCore::Node::convertFromPage):
(WebCore::Node::ancestorElement): Deleted.
* dom/Node.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (200740 => 200741)
--- trunk/Source/WebCore/ChangeLog 2016-05-12 04:32:54 UTC (rev 200740)
+++ trunk/Source/WebCore/ChangeLog 2016-05-12 04:35:15 UTC (rev 200741)
@@ -1,3 +1,23 @@
+2016-05-11 Chris Dumez <cdu...@apple.com>
+
+ Kill Node::ancestorElement()
+ https://bugs.webkit.org/show_bug.cgi?id=157599
+
+ Reviewed by Darin Adler.
+
+ Kill Node::ancestorElement() and use Node::parentElement() instead. If
+ our parent is not an Element then none of our ancestors will be.
+
+ * dom/Node.cpp:
+ (WebCore::Node::isDefaultNamespace):
+ (WebCore::Node::lookupPrefix):
+ (WebCore::Node::lookupNamespaceURI):
+ (WebCore::Node::lookupNamespacePrefix):
+ (WebCore::Node::convertToPage):
+ (WebCore::Node::convertFromPage):
+ (WebCore::Node::ancestorElement): Deleted.
+ * dom/Node.h:
+
2016-05-11 Zalan Bujtas <za...@apple.com>
Absolute positioned element is not placed properly when parent becomes the containing block.
Modified: trunk/Source/WebCore/dom/Node.cpp (200740 => 200741)
--- trunk/Source/WebCore/dom/Node.cpp 2016-05-12 04:32:54 UTC (rev 200740)
+++ trunk/Source/WebCore/dom/Node.cpp 2016-05-12 04:35:15 UTC (rev 200741)
@@ -1320,8 +1320,8 @@
}
}
- if (Element* ancestor = ancestorElement())
- return ancestor->isDefaultNamespace(namespaceURI);
+ if (auto* parent = parentElement())
+ return parent->isDefaultNamespace(namespaceURI);
return false;
}
@@ -1339,8 +1339,8 @@
return false;
}
default:
- if (Element* ancestor = ancestorElement())
- return ancestor->isDefaultNamespace(namespaceURI);
+ if (auto* parent = parentElement())
+ return parent->isDefaultNamespace(namespaceURI);
return false;
}
}
@@ -1370,8 +1370,8 @@
return String();
}
default:
- if (Element* ancestor = ancestorElement())
- return ancestor->lookupPrefix(namespaceURI);
+ if (auto* parent = parentElement())
+ return parent->lookupPrefix(namespaceURI);
return String();
}
}
@@ -1408,8 +1408,8 @@
}
}
}
- if (Element* ancestor = ancestorElement())
- return ancestor->lookupNamespaceURI(prefix);
+ if (auto* parent = parentElement())
+ return parent->lookupNamespaceURI(prefix);
return String();
}
case DOCUMENT_NODE:
@@ -1428,8 +1428,8 @@
return String();
}
default:
- if (Element* ancestor = ancestorElement())
- return ancestor->lookupNamespaceURI(prefix);
+ if (auto* parent = parentElement())
+ return parent->lookupNamespaceURI(prefix);
return String();
}
}
@@ -1452,8 +1452,8 @@
}
}
- if (Element* ancestor = ancestorElement())
- return ancestor->lookupNamespacePrefix(_namespaceURI, originalElement);
+ if (auto* parent = parentElement())
+ return parent->lookupNamespacePrefix(_namespaceURI, originalElement);
return String();
}
@@ -1530,15 +1530,6 @@
ASSERT_NOT_REACHED();
}
-Element* Node::ancestorElement() const
-{
- for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
- if (is<Element>(*ancestor))
- return downcast<Element>(ancestor);
- }
- return nullptr;
-}
-
bool Node::offsetInCharacters() const
{
return false;
@@ -1675,8 +1666,7 @@
return renderer()->localToAbsolute(p, UseTransforms);
// Otherwise go up the tree looking for a renderer
- Element *parent = ancestorElement();
- if (parent)
+ if (auto* parent = parentElement())
return parent->convertToPage(p);
// No parent - no conversion needed
@@ -1690,8 +1680,7 @@
return renderer()->absoluteToLocal(p, UseTransforms);
// Otherwise go up the tree looking for a renderer
- Element *parent = ancestorElement();
- if (parent)
+ if (auto* parent = parentElement())
return parent->convertFromPage(p);
// No parent - no conversion needed
Modified: trunk/Source/WebCore/dom/Node.h (200740 => 200741)
--- trunk/Source/WebCore/dom/Node.h 2016-05-12 04:32:54 UTC (rev 200740)
+++ trunk/Source/WebCore/dom/Node.h 2016-05-12 04:35:15 UTC (rev 200741)
@@ -675,8 +675,6 @@
void refEventTarget() override;
void derefEventTarget() override;
- Element* ancestorElement() const;
-
void trackForDebugging();
void materializeRareData();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes