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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2450093005: Support display: contents for elements, first-line and first-letter pseudos. (Closed)
Patch Set: Allow text as child of the LayoutView, since it can happen with display: contents Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 WritingMode rootWritingMode = documentElementStyle->getWritingMode(); 1723 WritingMode rootWritingMode = documentElementStyle->getWritingMode();
1724 TextDirection rootDirection = documentElementStyle->direction(); 1724 TextDirection rootDirection = documentElementStyle->direction();
1725 1725
1726 HTMLElement* body = this->body(); 1726 HTMLElement* body = this->body();
1727 RefPtr<ComputedStyle> bodyStyle; 1727 RefPtr<ComputedStyle> bodyStyle;
1728 1728
1729 if (body) { 1729 if (body) {
1730 bodyStyle = body->mutableComputedStyle(); 1730 bodyStyle = body->mutableComputedStyle();
1731 if (didRecalcDocumentElement) 1731 if (didRecalcDocumentElement)
1732 body->clearAnimationStyleChange(); 1732 body->clearAnimationStyleChange();
1733 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) 1733 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) {
1734 bodyStyle = ensureStyleResolver().styleForElement( 1734 bodyStyle = ensureStyleResolver().styleForElement(
1735 body, documentElementStyle.get()); 1735 body, documentElementStyle.get(), documentElementStyle.get());
1736 }
1736 rootWritingMode = bodyStyle->getWritingMode(); 1737 rootWritingMode = bodyStyle->getWritingMode();
1737 rootDirection = bodyStyle->direction(); 1738 rootDirection = bodyStyle->direction();
1738 } 1739 }
1739 1740
1740 const ComputedStyle* backgroundStyle = documentElementStyle.get(); 1741 const ComputedStyle* backgroundStyle = documentElementStyle.get();
1741 // http://www.w3.org/TR/css3-background/#body-background 1742 // http://www.w3.org/TR/css3-background/#body-background
1742 // <html> root element with no background steals background from its first 1743 // <html> root element with no background steals background from its first
1743 // <body> child. 1744 // <body> child.
1744 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() 1745 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody()
1745 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && 1746 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) &&
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) 2238 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view())
2238 view()->flushAnyPendingPostLayoutTasks(); 2239 view()->flushAnyPendingPostLayoutTasks();
2239 } 2240 }
2240 2241
2241 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets( 2242 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets(
2242 Element* element) { 2243 Element* element) {
2243 DCHECK_EQ(element->document(), this); 2244 DCHECK_EQ(element->document(), this);
2244 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); 2245 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine());
2245 if (!element->canParticipateInFlatTree()) 2246 if (!element->canParticipateInFlatTree())
2246 return ensureStyleResolver().styleForElement(element, nullptr); 2247 return ensureStyleResolver().styleForElement(element, nullptr);
2248
2247 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element); 2249 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element);
2248 return ensureStyleResolver().styleForElement( 2250 const ComputedStyle* parentStyle =
2249 element, parent ? parent->ensureComputedStyle() : nullptr); 2251 parent ? parent->ensureComputedStyle() : nullptr;
2252
2253 ContainerNode* layoutParent =
2254 parent ? LayoutTreeBuilderTraversal::layoutParent(*element) : nullptr;
2255 const ComputedStyle* layoutParentStyle =
2256 layoutParent ? layoutParent->ensureComputedStyle() : parentStyle;
2257
2258 return ensureStyleResolver().styleForElement(element, parentStyle,
2259 layoutParentStyle);
2250 } 2260 }
2251 2261
2252 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) { 2262 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) {
2253 updateDistribution(); 2263 updateDistribution();
2254 return ensureStyleResolver().styleForPage(pageIndex); 2264 return ensureStyleResolver().styleForPage(pageIndex);
2255 } 2265 }
2256 2266
2257 bool Document::isPageBoxVisible(int pageIndex) { 2267 bool Document::isPageBoxVisible(int pageIndex) {
2258 return styleForPage(pageIndex)->visibility() != 2268 return styleForPage(pageIndex)->visibility() !=
2259 EVisibility::Hidden; // display property doesn't apply to @page. 2269 EVisibility::Hidden; // display property doesn't apply to @page.
(...skipping 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after
6580 } 6590 }
6581 6591
6582 void showLiveDocumentInstances() { 6592 void showLiveDocumentInstances() {
6583 WeakDocumentSet& set = liveDocumentSet(); 6593 WeakDocumentSet& set = liveDocumentSet();
6584 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6594 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6585 for (Document* document : set) 6595 for (Document* document : set)
6586 fprintf(stderr, "- Document %p URL: %s\n", document, 6596 fprintf(stderr, "- Document %p URL: %s\n", document,
6587 document->url().getString().utf8().data()); 6597 document->url().getString().utf8().data());
6588 } 6598 }
6589 #endif 6599 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698