| 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 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 WritingMode rootWritingMode = documentElementStyle->getWritingMode(); | 1736 WritingMode rootWritingMode = documentElementStyle->getWritingMode(); |
| 1737 TextDirection rootDirection = documentElementStyle->direction(); | 1737 TextDirection rootDirection = documentElementStyle->direction(); |
| 1738 | 1738 |
| 1739 HTMLElement* body = this->body(); | 1739 HTMLElement* body = this->body(); |
| 1740 RefPtr<ComputedStyle> bodyStyle; | 1740 RefPtr<ComputedStyle> bodyStyle; |
| 1741 | 1741 |
| 1742 if (body) { | 1742 if (body) { |
| 1743 bodyStyle = body->mutableComputedStyle(); | 1743 bodyStyle = body->mutableComputedStyle(); |
| 1744 if (didRecalcDocumentElement) | 1744 if (didRecalcDocumentElement) |
| 1745 body->clearAnimationStyleChange(); | 1745 body->clearAnimationStyleChange(); |
| 1746 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) | 1746 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) { |
| 1747 bodyStyle = ensureStyleResolver().styleForElement( | 1747 bodyStyle = ensureStyleResolver().styleForElement( |
| 1748 body, documentElementStyle.get()); | 1748 body, documentElementStyle.get(), documentElementStyle.get()); |
| 1749 } |
| 1749 rootWritingMode = bodyStyle->getWritingMode(); | 1750 rootWritingMode = bodyStyle->getWritingMode(); |
| 1750 rootDirection = bodyStyle->direction(); | 1751 rootDirection = bodyStyle->direction(); |
| 1751 } | 1752 } |
| 1752 | 1753 |
| 1753 const ComputedStyle* backgroundStyle = documentElementStyle.get(); | 1754 const ComputedStyle* backgroundStyle = documentElementStyle.get(); |
| 1754 // http://www.w3.org/TR/css3-background/#body-background | 1755 // http://www.w3.org/TR/css3-background/#body-background |
| 1755 // <html> root element with no background steals background from its first | 1756 // <html> root element with no background steals background from its first |
| 1756 // <body> child. | 1757 // <body> child. |
| 1757 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() | 1758 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() |
| 1758 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && | 1759 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) | 2251 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) |
| 2251 view()->flushAnyPendingPostLayoutTasks(); | 2252 view()->flushAnyPendingPostLayoutTasks(); |
| 2252 } | 2253 } |
| 2253 | 2254 |
| 2254 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets( | 2255 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets( |
| 2255 Element* element) { | 2256 Element* element) { |
| 2256 DCHECK_EQ(element->document(), this); | 2257 DCHECK_EQ(element->document(), this); |
| 2257 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); | 2258 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); |
| 2258 if (!element->canParticipateInFlatTree()) | 2259 if (!element->canParticipateInFlatTree()) |
| 2259 return ensureStyleResolver().styleForElement(element, nullptr); | 2260 return ensureStyleResolver().styleForElement(element, nullptr); |
| 2261 |
| 2260 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element); | 2262 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element); |
| 2261 return ensureStyleResolver().styleForElement( | 2263 const ComputedStyle* parentStyle = |
| 2262 element, parent ? parent->ensureComputedStyle() : nullptr); | 2264 parent ? parent->ensureComputedStyle() : nullptr; |
| 2265 |
| 2266 ContainerNode* layoutParent = |
| 2267 parent ? LayoutTreeBuilderTraversal::layoutParent(*element) : nullptr; |
| 2268 const ComputedStyle* layoutParentStyle = |
| 2269 layoutParent ? layoutParent->ensureComputedStyle() : parentStyle; |
| 2270 |
| 2271 return ensureStyleResolver().styleForElement(element, parentStyle, |
| 2272 layoutParentStyle); |
| 2263 } | 2273 } |
| 2264 | 2274 |
| 2265 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) { | 2275 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) { |
| 2266 updateDistribution(); | 2276 updateDistribution(); |
| 2267 return ensureStyleResolver().styleForPage(pageIndex); | 2277 return ensureStyleResolver().styleForPage(pageIndex); |
| 2268 } | 2278 } |
| 2269 | 2279 |
| 2270 bool Document::isPageBoxVisible(int pageIndex) { | 2280 bool Document::isPageBoxVisible(int pageIndex) { |
| 2271 return styleForPage(pageIndex)->visibility() != | 2281 return styleForPage(pageIndex)->visibility() != |
| 2272 EVisibility::kHidden; // display property doesn't apply to @page. | 2282 EVisibility::kHidden; // display property doesn't apply to @page. |
| (...skipping 4244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6517 } | 6527 } |
| 6518 | 6528 |
| 6519 void showLiveDocumentInstances() { | 6529 void showLiveDocumentInstances() { |
| 6520 WeakDocumentSet& set = liveDocumentSet(); | 6530 WeakDocumentSet& set = liveDocumentSet(); |
| 6521 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6531 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6522 for (Document* document : set) | 6532 for (Document* document : set) |
| 6523 fprintf(stderr, "- Document %p URL: %s\n", document, | 6533 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6524 document->url().getString().utf8().data()); | 6534 document->url().getString().utf8().data()); |
| 6525 } | 6535 } |
| 6526 #endif | 6536 #endif |
| OLD | NEW |