| 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 r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "core/dom/ElementRegistrationOptions.h" | 74 #include "core/dom/ElementRegistrationOptions.h" |
| 75 #include "core/dom/ElementTraversal.h" | 75 #include "core/dom/ElementTraversal.h" |
| 76 #include "core/dom/ExceptionCode.h" | 76 #include "core/dom/ExceptionCode.h" |
| 77 #include "core/dom/ExecutionContextTask.h" | 77 #include "core/dom/ExecutionContextTask.h" |
| 78 #include "core/dom/MainThreadTaskRunner.h" | 78 #include "core/dom/MainThreadTaskRunner.h" |
| 79 #include "core/dom/Microtask.h" | 79 #include "core/dom/Microtask.h" |
| 80 #include "core/dom/MutationObserver.h" | 80 #include "core/dom/MutationObserver.h" |
| 81 #include "core/dom/NodeChildRemovalTracker.h" | 81 #include "core/dom/NodeChildRemovalTracker.h" |
| 82 #include "core/dom/NodeFilter.h" | 82 #include "core/dom/NodeFilter.h" |
| 83 #include "core/dom/NodeIterator.h" | 83 #include "core/dom/NodeIterator.h" |
| 84 #include "core/dom/NodeLayoutStyle.h" | 84 #include "core/dom/NodeComputedStyle.h" |
| 85 #include "core/dom/NodeRareData.h" | 85 #include "core/dom/NodeRareData.h" |
| 86 #include "core/dom/NodeRenderingTraversal.h" | 86 #include "core/dom/NodeRenderingTraversal.h" |
| 87 #include "core/dom/NodeTraversal.h" | 87 #include "core/dom/NodeTraversal.h" |
| 88 #include "core/dom/NodeWithIndex.h" | 88 #include "core/dom/NodeWithIndex.h" |
| 89 #include "core/dom/ProcessingInstruction.h" | 89 #include "core/dom/ProcessingInstruction.h" |
| 90 #include "core/dom/RequestAnimationFrameCallback.h" | 90 #include "core/dom/RequestAnimationFrameCallback.h" |
| 91 #include "core/dom/ScriptRunner.h" | 91 #include "core/dom/ScriptRunner.h" |
| 92 #include "core/dom/ScriptedAnimationController.h" | 92 #include "core/dom/ScriptedAnimationController.h" |
| 93 #include "core/dom/SelectorQuery.h" | 93 #include "core/dom/SelectorQuery.h" |
| 94 #include "core/dom/StaticNodeList.h" | 94 #include "core/dom/StaticNodeList.h" |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 if (!isActive()) | 1578 if (!isActive()) |
| 1579 return; | 1579 return; |
| 1580 if (!childNeedsStyleInvalidation()) | 1580 if (!childNeedsStyleInvalidation()) |
| 1581 return; | 1581 return; |
| 1582 TRACE_EVENT0("blink", "Document::updateStyleInvalidationIfNeeded"); | 1582 TRACE_EVENT0("blink", "Document::updateStyleInvalidationIfNeeded"); |
| 1583 ASSERT(styleResolver()); | 1583 ASSERT(styleResolver()); |
| 1584 | 1584 |
| 1585 styleResolver()->ruleFeatureSet().styleInvalidator().invalidate(*this); | 1585 styleResolver()->ruleFeatureSet().styleInvalidator().invalidate(*this); |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 void Document::setupFontBuilder(LayoutStyle& documentStyle) | 1588 void Document::setupFontBuilder(ComputedStyle& documentStyle) |
| 1589 { | 1589 { |
| 1590 FontBuilder fontBuilder(*this); | 1590 FontBuilder fontBuilder(*this); |
| 1591 RefPtrWillBeRawPtr<CSSFontSelector> selector = styleEngine().fontSelector(); | 1591 RefPtrWillBeRawPtr<CSSFontSelector> selector = styleEngine().fontSelector(); |
| 1592 fontBuilder.createFontForDocument(selector, documentStyle); | 1592 fontBuilder.createFontForDocument(selector, documentStyle); |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) | 1595 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) |
| 1596 { | 1596 { |
| 1597 ASSERT(inStyleRecalc()); | 1597 ASSERT(inStyleRecalc()); |
| 1598 ASSERT(documentElement()); | 1598 ASSERT(documentElement()); |
| 1599 | 1599 |
| 1600 bool didRecalcDocumentElement = false; | 1600 bool didRecalcDocumentElement = false; |
| 1601 RefPtr<LayoutStyle> documentElementStyle = documentElement()->mutableLayoutS
tyle(); | 1601 RefPtr<ComputedStyle> documentElementStyle = documentElement()->mutableCompu
tedStyle(); |
| 1602 if (change == Force) | 1602 if (change == Force) |
| 1603 documentElement()->clearAnimationStyleChange(); | 1603 documentElement()->clearAnimationStyleChange(); |
| 1604 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) { | 1604 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) { |
| 1605 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); | 1605 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); |
| 1606 didRecalcDocumentElement = true; | 1606 didRecalcDocumentElement = true; |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 WritingMode rootWritingMode = documentElementStyle->writingMode(); | 1609 WritingMode rootWritingMode = documentElementStyle->writingMode(); |
| 1610 TextDirection rootDirection = documentElementStyle->direction(); | 1610 TextDirection rootDirection = documentElementStyle->direction(); |
| 1611 | 1611 |
| 1612 HTMLElement* body = this->body(); | 1612 HTMLElement* body = this->body(); |
| 1613 RefPtr<LayoutStyle> bodyStyle; | 1613 RefPtr<ComputedStyle> bodyStyle; |
| 1614 | 1614 |
| 1615 if (body) { | 1615 if (body) { |
| 1616 bodyStyle = body->mutableLayoutStyle(); | 1616 bodyStyle = body->mutableComputedStyle(); |
| 1617 if (didRecalcDocumentElement) | 1617 if (didRecalcDocumentElement) |
| 1618 body->clearAnimationStyleChange(); | 1618 body->clearAnimationStyleChange(); |
| 1619 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) | 1619 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) |
| 1620 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); | 1620 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); |
| 1621 rootWritingMode = bodyStyle->writingMode(); | 1621 rootWritingMode = bodyStyle->writingMode(); |
| 1622 rootDirection = bodyStyle->direction(); | 1622 rootDirection = bodyStyle->direction(); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 RefPtr<LayoutStyle> overflowStyle; | 1625 RefPtr<ComputedStyle> overflowStyle; |
| 1626 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ | 1626 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ |
| 1627 if (element == body) { | 1627 if (element == body) { |
| 1628 overflowStyle = bodyStyle; | 1628 overflowStyle = bodyStyle; |
| 1629 } else { | 1629 } else { |
| 1630 ASSERT(element == documentElement()); | 1630 ASSERT(element == documentElement()); |
| 1631 overflowStyle = documentElementStyle; | 1631 overflowStyle = documentElementStyle; |
| 1632 } | 1632 } |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 // Resolved rem units are stored in the matched properties cache so we need
to make sure to | 1635 // Resolved rem units are stored in the matched properties cache so we need
to make sure to |
| 1636 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed | 1636 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed |
| 1637 // and then trigger a full document recalc. We also need to clear it here si
nce the | 1637 // and then trigger a full document recalc. We also need to clear it here si
nce the |
| 1638 // call to styleForElement on the body above can cache bad values for rem un
its if the | 1638 // call to styleForElement on the body above can cache bad values for rem un
its if the |
| 1639 // documentElement's style was dirty. We could keep track of which elements
depend on | 1639 // documentElement's style was dirty. We could keep track of which elements
depend on |
| 1640 // rem units like we do for viewport styles, but we assume root font size ch
anges are | 1640 // rem units like we do for viewport styles, but we assume root font size ch
anges are |
| 1641 // rare and just invalidate the cache for now. | 1641 // rare and just invalidate the cache for now. |
| 1642 if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || doc
umentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize())
) { | 1642 if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || doc
umentElement()->ensureComputedStyle()->fontSize() != documentElementStyle->fontS
ize())) { |
| 1643 ensureStyleResolver().invalidateMatchedPropertiesCache(); | 1643 ensureStyleResolver().invalidateMatchedPropertiesCache(); |
| 1644 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe
asonForTracing::create(StyleChangeReason::FontSizeChange)); | 1644 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe
asonForTracing::create(StyleChangeReason::FontSizeChange)); |
| 1645 } | 1645 } |
| 1646 | 1646 |
| 1647 EOverflow overflowX = OAUTO; | 1647 EOverflow overflowX = OAUTO; |
| 1648 EOverflow overflowY = OAUTO; | 1648 EOverflow overflowY = OAUTO; |
| 1649 float columnGap = 0; | 1649 float columnGap = 0; |
| 1650 if (overflowStyle) { | 1650 if (overflowStyle) { |
| 1651 overflowX = overflowStyle->overflowX(); | 1651 overflowX = overflowStyle->overflowX(); |
| 1652 overflowY = overflowStyle->overflowY(); | 1652 overflowY = overflowStyle->overflowY(); |
| 1653 // Visible overflow on the viewport is meaningless, and the spec says to
treat it as 'auto': | 1653 // Visible overflow on the viewport is meaningless, and the spec says to
treat it as 'auto': |
| 1654 if (overflowX == OVISIBLE) | 1654 if (overflowX == OVISIBLE) |
| 1655 overflowX = OAUTO; | 1655 overflowX = OAUTO; |
| 1656 if (overflowY == OVISIBLE) | 1656 if (overflowY == OVISIBLE) |
| 1657 overflowY = OAUTO; | 1657 overflowY = OAUTO; |
| 1658 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other | 1658 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other |
| 1659 // ways to specify gaps between pages), so we have to propagate it too. | 1659 // ways to specify gaps between pages), so we have to propagate it too. |
| 1660 columnGap = overflowStyle->columnGap(); | 1660 columnGap = overflowStyle->columnGap(); |
| 1661 } | 1661 } |
| 1662 | 1662 |
| 1663 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); | 1663 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); |
| 1664 | 1664 |
| 1665 RefPtr<LayoutStyle> documentStyle = layoutView()->style(); | 1665 RefPtr<ComputedStyle> documentStyle = layoutView()->style(); |
| 1666 if (documentStyle->writingMode() != rootWritingMode | 1666 if (documentStyle->writingMode() != rootWritingMode |
| 1667 || documentStyle->direction() != rootDirection | 1667 || documentStyle->direction() != rootDirection |
| 1668 || documentStyle->overflowX() != overflowX | 1668 || documentStyle->overflowX() != overflowX |
| 1669 || documentStyle->overflowY() != overflowY | 1669 || documentStyle->overflowY() != overflowY |
| 1670 || documentStyle->columnGap() != columnGap | 1670 || documentStyle->columnGap() != columnGap |
| 1671 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { | 1671 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { |
| 1672 RefPtr<LayoutStyle> newStyle = LayoutStyle::clone(*documentStyle); | 1672 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); |
| 1673 newStyle->setWritingMode(rootWritingMode); | 1673 newStyle->setWritingMode(rootWritingMode); |
| 1674 newStyle->setDirection(rootDirection); | 1674 newStyle->setDirection(rootDirection); |
| 1675 newStyle->setColumnGap(columnGap); | 1675 newStyle->setColumnGap(columnGap); |
| 1676 newStyle->setOverflowX(overflowX); | 1676 newStyle->setOverflowX(overflowX); |
| 1677 newStyle->setOverflowY(overflowY); | 1677 newStyle->setOverflowY(overflowY); |
| 1678 newStyle->setScrollBlocksOn(scrollBlocksOn); | 1678 newStyle->setScrollBlocksOn(scrollBlocksOn); |
| 1679 layoutView()->setStyle(newStyle); | 1679 layoutView()->setStyle(newStyle); |
| 1680 setupFontBuilder(*newStyle); | 1680 setupFontBuilder(*newStyle); |
| 1681 } | 1681 } |
| 1682 | 1682 |
| 1683 if (body) { | 1683 if (body) { |
| 1684 if (const LayoutStyle* style = body->layoutStyle()) { | 1684 if (const ComputedStyle* style = body->computedStyle()) { |
| 1685 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1685 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) |
| 1686 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1686 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
| 1687 } | 1687 } |
| 1688 } | 1688 } |
| 1689 | 1689 |
| 1690 if (const LayoutStyle* style = documentElement()->layoutStyle()) { | 1690 if (const ComputedStyle* style = documentElement()->computedStyle()) { |
| 1691 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) | 1691 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) |
| 1692 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); | 1692 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); |
| 1693 } | 1693 } |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 void Document::updateRenderTree(StyleRecalcChange change) | 1696 void Document::updateRenderTree(StyleRecalcChange change) |
| 1697 { | 1697 { |
| 1698 ASSERT(isMainThread()); | 1698 ASSERT(isMainThread()); |
| 1699 | 1699 |
| 1700 ScriptForbiddenScope forbidScript; | 1700 ScriptForbiddenScope forbidScript; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 if (styleChangeType() >= SubtreeStyleChange) | 1771 if (styleChangeType() >= SubtreeStyleChange) |
| 1772 change = Force; | 1772 change = Force; |
| 1773 | 1773 |
| 1774 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc
ument below because | 1774 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc
ument below because |
| 1775 // apparently the StyleResolver's constructor has side effects. We should fi
x it. | 1775 // apparently the StyleResolver's constructor has side effects. We should fi
x it. |
| 1776 // See printing/setPrinting.html, printing/width-overflow.html though they o
nly fail on | 1776 // See printing/setPrinting.html, printing/width-overflow.html though they o
nly fail on |
| 1777 // mac when accessing the resolver by what appears to be a viewport size dif
ference. | 1777 // mac when accessing the resolver by what appears to be a viewport size dif
ference. |
| 1778 | 1778 |
| 1779 if (change == Force) { | 1779 if (change == Force) { |
| 1780 m_hasNodesWithPlaceholderStyle = false; | 1780 m_hasNodesWithPlaceholderStyle = false; |
| 1781 RefPtr<LayoutStyle> documentStyle = StyleResolver::styleForDocument(*thi
s); | 1781 RefPtr<ComputedStyle> documentStyle = StyleResolver::styleForDocument(*t
his); |
| 1782 StyleRecalcChange localChange = LayoutStyle::stylePropagationDiff(docume
ntStyle.get(), layoutView()->style()); | 1782 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(docu
mentStyle.get(), layoutView()->style()); |
| 1783 if (localChange != NoChange) | 1783 if (localChange != NoChange) |
| 1784 layoutView()->setStyle(documentStyle.release()); | 1784 layoutView()->setStyle(documentStyle.release()); |
| 1785 } | 1785 } |
| 1786 | 1786 |
| 1787 clearNeedsStyleRecalc(); | 1787 clearNeedsStyleRecalc(); |
| 1788 | 1788 |
| 1789 // Uncomment to enable printing of statistics about style sharing and the ma
tched property cache. | 1789 // Uncomment to enable printing of statistics about style sharing and the ma
tched property cache. |
| 1790 // Optionally pass StyleResolver::ReportSlowStats to print numbers that requ
ire crawling the | 1790 // Optionally pass StyleResolver::ReportSlowStats to print numbers that requ
ire crawling the |
| 1791 // entire DOM (where collecting them is very slow). | 1791 // entire DOM (where collecting them is very slow). |
| 1792 // FIXME: Expose this as a runtime flag. | 1792 // FIXME: Expose this as a runtime flag. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 updateRenderTree(Force); | 1919 updateRenderTree(Force); |
| 1920 } | 1920 } |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 updateLayout(); | 1923 updateLayout(); |
| 1924 | 1924 |
| 1925 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) | 1925 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) |
| 1926 view()->flushAnyPendingPostLayoutTasks(); | 1926 view()->flushAnyPendingPostLayoutTasks(); |
| 1927 } | 1927 } |
| 1928 | 1928 |
| 1929 PassRefPtr<LayoutStyle> Document::styleForElementIgnoringPendingStylesheets(Elem
ent* element) | 1929 PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets(El
ement* element) |
| 1930 { | 1930 { |
| 1931 ASSERT_ARG(element, element->document() == this); | 1931 ASSERT_ARG(element, element->document() == this); |
| 1932 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); | 1932 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); |
| 1933 return ensureStyleResolver().styleForElement(element, element->parentNode()
? element->parentNode()->computedStyle() : 0); | 1933 return ensureStyleResolver().styleForElement(element, element->parentNode()
? element->parentNode()->ensureComputedStyle() : 0); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 PassRefPtr<LayoutStyle> Document::styleForPage(int pageIndex) | 1936 PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) |
| 1937 { | 1937 { |
| 1938 updateDistribution(); | 1938 updateDistribution(); |
| 1939 return ensureStyleResolver().styleForPage(pageIndex); | 1939 return ensureStyleResolver().styleForPage(pageIndex); |
| 1940 } | 1940 } |
| 1941 | 1941 |
| 1942 bool Document::isPageBoxVisible(int pageIndex) | 1942 bool Document::isPageBoxVisible(int pageIndex) |
| 1943 { | 1943 { |
| 1944 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. | 1944 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property
doesn't apply to @page. |
| 1945 } | 1945 } |
| 1946 | 1946 |
| 1947 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 1947 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
| 1948 { | 1948 { |
| 1949 RefPtr<LayoutStyle> style = styleForPage(pageIndex); | 1949 RefPtr<ComputedStyle> style = styleForPage(pageIndex); |
| 1950 | 1950 |
| 1951 int width = pageSize.width(); | 1951 int width = pageSize.width(); |
| 1952 int height = pageSize.height(); | 1952 int height = pageSize.height(); |
| 1953 switch (style->pageSizeType()) { | 1953 switch (style->pageSizeType()) { |
| 1954 case PAGE_SIZE_AUTO: | 1954 case PAGE_SIZE_AUTO: |
| 1955 break; | 1955 break; |
| 1956 case PAGE_SIZE_AUTO_LANDSCAPE: | 1956 case PAGE_SIZE_AUTO_LANDSCAPE: |
| 1957 if (width < height) | 1957 if (width < height) |
| 1958 std::swap(width, height); | 1958 std::swap(width, height); |
| 1959 break; | 1959 break; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 | 2373 |
| 2374 HTMLHeadElement* Document::head() const | 2374 HTMLHeadElement* Document::head() const |
| 2375 { | 2375 { |
| 2376 Node* de = documentElement(); | 2376 Node* de = documentElement(); |
| 2377 if (!de) | 2377 if (!de) |
| 2378 return 0; | 2378 return 0; |
| 2379 | 2379 |
| 2380 return Traversal<HTMLHeadElement>::firstChild(*de); | 2380 return Traversal<HTMLHeadElement>::firstChild(*de); |
| 2381 } | 2381 } |
| 2382 | 2382 |
| 2383 Element* Document::viewportDefiningElement(const LayoutStyle* rootStyle) const | 2383 Element* Document::viewportDefiningElement(const ComputedStyle* rootStyle) const |
| 2384 { | 2384 { |
| 2385 // If a BODY element sets non-visible overflow, it is to be propagated to th
e viewport, as long | 2385 // If a BODY element sets non-visible overflow, it is to be propagated to th
e viewport, as long |
| 2386 // as the following conditions are all met: | 2386 // as the following conditions are all met: |
| 2387 // (1) The root element is HTML. | 2387 // (1) The root element is HTML. |
| 2388 // (2) It is the primary BODY element (we only assert for this, expecting ca
llers to behave). | 2388 // (2) It is the primary BODY element (we only assert for this, expecting ca
llers to behave). |
| 2389 // (3) The root element has visible overflow. | 2389 // (3) The root element has visible overflow. |
| 2390 // Otherwise it's the root element's properties that are to be propagated. | 2390 // Otherwise it's the root element's properties that are to be propagated. |
| 2391 Element* rootElement = documentElement(); | 2391 Element* rootElement = documentElement(); |
| 2392 Element* bodyElement = body(); | 2392 Element* bodyElement = body(); |
| 2393 if (!rootElement) | 2393 if (!rootElement) |
| 2394 return 0; | 2394 return 0; |
| 2395 if (!rootStyle) { | 2395 if (!rootStyle) { |
| 2396 rootStyle = rootElement->layoutStyle(); | 2396 rootStyle = rootElement->computedStyle(); |
| 2397 if (!rootStyle) | 2397 if (!rootStyle) |
| 2398 return 0; | 2398 return 0; |
| 2399 } | 2399 } |
| 2400 if (bodyElement && rootStyle->isOverflowVisible() && isHTMLHtmlElement(*root
Element)) | 2400 if (bodyElement && rootStyle->isOverflowVisible() && isHTMLHtmlElement(*root
Element)) |
| 2401 return bodyElement; | 2401 return bodyElement; |
| 2402 return rootElement; | 2402 return rootElement; |
| 2403 } | 2403 } |
| 2404 | 2404 |
| 2405 void Document::close(ExceptionState& exceptionState) | 2405 void Document::close(ExceptionState& exceptionState) |
| 2406 { | 2406 { |
| (...skipping 3319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5726 #ifndef NDEBUG | 5726 #ifndef NDEBUG |
| 5727 using namespace blink; | 5727 using namespace blink; |
| 5728 void showLiveDocumentInstances() | 5728 void showLiveDocumentInstances() |
| 5729 { | 5729 { |
| 5730 WeakDocumentSet& set = liveDocumentSet(); | 5730 WeakDocumentSet& set = liveDocumentSet(); |
| 5731 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5731 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5732 for (Document* document : set) | 5732 for (Document* document : set) |
| 5733 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5733 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5734 } | 5734 } |
| 5735 #endif | 5735 #endif |
| OLD | NEW |