Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2919283002: [css-conditional] CSS.supports with one string should accept paren-less declaration. (Closed)
Patch Set: Don't skip display: contents nodes in TextIterator. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
index eaba282bc2a36b646182928e68ca129a293e369c..65ac5ee573bc2d74d39a2710ec3428c0eddca4a2 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -79,10 +79,14 @@ TextIteratorBehavior AdjustBehaviorFlags<EditingInFlatTreeStrategy>(
.Build();
}
+static inline bool HasDisplayContents(const Node& node) {
+ return node.IsElementNode() && ToElement(node).HasDisplayContentsStyle();
+}
+
// Checks if |advance()| skips the descendants of |node|, which is the case if
// |node| is neither a shadow root nor the owner of a layout object.
static bool NotSkipping(const Node& node) {
- return node.GetLayoutObject() ||
+ return node.GetLayoutObject() || HasDisplayContents(node) ||
(node.IsShadowRoot() && node.OwnerShadowHost()->GetLayoutObject());
}
@@ -293,13 +297,13 @@ void TextIteratorAlgorithm<Strategy>::Advance() {
LayoutObject* layout_object = node_->GetLayoutObject();
if (!layout_object) {
- if (node_->IsShadowRoot()) {
- // A shadow root doesn't have a layoutObject, but we want to visit
- // children anyway.
+ if (node_->IsShadowRoot() || HasDisplayContents(*node_)) {
+ // Shadow roots or display: contents elements don't have LayoutObjects,
+ // but we want to visit children anyway.
iteration_progress_ = iteration_progress_ < kHandledNode
? kHandledNode
: iteration_progress_;
- handle_shadow_root_ = true;
+ handle_shadow_root_ = node_->IsShadowRoot();
} else {
iteration_progress_ = kHandledChildren;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698