OLD | NEW |
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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 WritingMode rootWritingMode = documentElementStyle->getWritingMode(); | 1746 WritingMode rootWritingMode = documentElementStyle->getWritingMode(); |
1747 TextDirection rootDirection = documentElementStyle->direction(); | 1747 TextDirection rootDirection = documentElementStyle->direction(); |
1748 | 1748 |
1749 HTMLElement* body = this->body(); | 1749 HTMLElement* body = this->body(); |
1750 RefPtr<ComputedStyle> bodyStyle; | 1750 RefPtr<ComputedStyle> bodyStyle; |
1751 | 1751 |
1752 if (body) { | 1752 if (body) { |
1753 bodyStyle = body->mutableComputedStyle(); | 1753 bodyStyle = body->mutableComputedStyle(); |
1754 if (didRecalcDocumentElement) | 1754 if (didRecalcDocumentElement) |
1755 body->clearAnimationStyleChange(); | 1755 body->clearAnimationStyleChange(); |
1756 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) | 1756 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) { |
1757 bodyStyle = ensureStyleResolver().styleForElement( | 1757 bodyStyle = ensureStyleResolver().styleForElement( |
1758 body, documentElementStyle.get()); | 1758 body, documentElementStyle.get(), documentElementStyle.get()); |
| 1759 } |
1759 rootWritingMode = bodyStyle->getWritingMode(); | 1760 rootWritingMode = bodyStyle->getWritingMode(); |
1760 rootDirection = bodyStyle->direction(); | 1761 rootDirection = bodyStyle->direction(); |
1761 } | 1762 } |
1762 | 1763 |
1763 const ComputedStyle* backgroundStyle = documentElementStyle.get(); | 1764 const ComputedStyle* backgroundStyle = documentElementStyle.get(); |
1764 // http://www.w3.org/TR/css3-background/#body-background | 1765 // http://www.w3.org/TR/css3-background/#body-background |
1765 // <html> root element with no background steals background from its first | 1766 // <html> root element with no background steals background from its first |
1766 // <body> child. | 1767 // <body> child. |
1767 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() | 1768 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() |
1768 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && | 1769 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) | 2261 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) |
2261 view()->flushAnyPendingPostLayoutTasks(); | 2262 view()->flushAnyPendingPostLayoutTasks(); |
2262 } | 2263 } |
2263 | 2264 |
2264 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets( | 2265 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets( |
2265 Element* element) { | 2266 Element* element) { |
2266 DCHECK_EQ(element->document(), this); | 2267 DCHECK_EQ(element->document(), this); |
2267 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); | 2268 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); |
2268 if (!element->canParticipateInFlatTree()) | 2269 if (!element->canParticipateInFlatTree()) |
2269 return ensureStyleResolver().styleForElement(element, nullptr); | 2270 return ensureStyleResolver().styleForElement(element, nullptr); |
| 2271 |
2270 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element); | 2272 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element); |
2271 return ensureStyleResolver().styleForElement( | 2273 const ComputedStyle* parentStyle = |
2272 element, parent ? parent->ensureComputedStyle() : nullptr); | 2274 parent ? parent->ensureComputedStyle() : nullptr; |
| 2275 |
| 2276 ContainerNode* layoutParent = |
| 2277 parent ? LayoutTreeBuilderTraversal::layoutParent(*element) : nullptr; |
| 2278 const ComputedStyle* layoutParentStyle = |
| 2279 layoutParent ? layoutParent->ensureComputedStyle() : parentStyle; |
| 2280 |
| 2281 return ensureStyleResolver().styleForElement(element, parentStyle, |
| 2282 layoutParentStyle); |
2273 } | 2283 } |
2274 | 2284 |
2275 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) { | 2285 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) { |
2276 updateDistribution(); | 2286 updateDistribution(); |
2277 return ensureStyleResolver().styleForPage(pageIndex); | 2287 return ensureStyleResolver().styleForPage(pageIndex); |
2278 } | 2288 } |
2279 | 2289 |
2280 bool Document::isPageBoxVisible(int pageIndex) { | 2290 bool Document::isPageBoxVisible(int pageIndex) { |
2281 return styleForPage(pageIndex)->visibility() != | 2291 return styleForPage(pageIndex)->visibility() != |
2282 EVisibility::kHidden; // display property doesn't apply to @page. | 2292 EVisibility::kHidden; // display property doesn't apply to @page. |
(...skipping 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6603 } | 6613 } |
6604 | 6614 |
6605 void showLiveDocumentInstances() { | 6615 void showLiveDocumentInstances() { |
6606 WeakDocumentSet& set = liveDocumentSet(); | 6616 WeakDocumentSet& set = liveDocumentSet(); |
6607 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6617 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6608 for (blink::Document* document : set) | 6618 for (blink::Document* document : set) |
6609 fprintf(stderr, "- Document %p URL: %s\n", document, | 6619 fprintf(stderr, "- Document %p URL: %s\n", document, |
6610 document->url().getString().utf8().data()); | 6620 document->url().getString().utf8().data()); |
6611 } | 6621 } |
6612 #endif | 6622 #endif |
OLD | NEW |