| 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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 if (body) { | 1620 if (body) { |
| 1621 bodyStyle = body->mutableComputedStyle(); | 1621 bodyStyle = body->mutableComputedStyle(); |
| 1622 if (didRecalcDocumentElement) | 1622 if (didRecalcDocumentElement) |
| 1623 body->clearAnimationStyleChange(); | 1623 body->clearAnimationStyleChange(); |
| 1624 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) | 1624 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) |
| 1625 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); | 1625 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); |
| 1626 rootWritingMode = bodyStyle->writingMode(); | 1626 rootWritingMode = bodyStyle->writingMode(); |
| 1627 rootDirection = bodyStyle->direction(); | 1627 rootDirection = bodyStyle->direction(); |
| 1628 } | 1628 } |
| 1629 | 1629 |
| 1630 RefPtr<ComputedStyle> overflowStyle; | 1630 const ComputedStyle* overflowStyle = nullptr; |
| 1631 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ | 1631 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ |
| 1632 if (element == body) { | 1632 if (element == body) { |
| 1633 overflowStyle = bodyStyle; | 1633 overflowStyle = bodyStyle.get(); |
| 1634 } else { | 1634 } else { |
| 1635 ASSERT(element == documentElement()); | 1635 ASSERT(element == documentElement()); |
| 1636 overflowStyle = documentElementStyle; | 1636 overflowStyle = documentElementStyle.get(); |
| 1637 } | 1637 } |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 const ComputedStyle* backgroundStyle = documentElementStyle.get(); |
| 1641 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !back
groundStyle->hasBackground()) |
| 1642 backgroundStyle = bodyStyle.get(); |
| 1643 Color backgroundColor = backgroundStyle->visitedDependentColor(CSSPropertyBa
ckgroundColor); |
| 1644 FillLayer backgroundLayers = backgroundStyle->backgroundLayers(); |
| 1645 for (auto currentLayer = &backgroundLayers; currentLayer; currentLayer = cur
rentLayer->next()) { |
| 1646 // http://www.w3.org/TR/css3-background/#root-background |
| 1647 // The root element background always have painting area of the whole ca
nvas. |
| 1648 currentLayer->setClip(BorderFillBox); |
| 1649 } |
| 1650 EImageRendering imageRendering = backgroundStyle->imageRendering(); |
| 1651 |
| 1640 // Resolved rem units are stored in the matched properties cache so we need
to make sure to | 1652 // Resolved rem units are stored in the matched properties cache so we need
to make sure to |
| 1641 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed | 1653 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed |
| 1642 // and then trigger a full document recalc. We also need to clear it here si
nce the | 1654 // and then trigger a full document recalc. We also need to clear it here si
nce the |
| 1643 // call to styleForElement on the body above can cache bad values for rem un
its if the | 1655 // call to styleForElement on the body above can cache bad values for rem un
its if the |
| 1644 // documentElement's style was dirty. We could keep track of which elements
depend on | 1656 // documentElement's style was dirty. We could keep track of which elements
depend on |
| 1645 // rem units like we do for viewport styles, but we assume root font size ch
anges are | 1657 // rem units like we do for viewport styles, but we assume root font size ch
anges are |
| 1646 // rare and just invalidate the cache for now. | 1658 // rare and just invalidate the cache for now. |
| 1647 if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || doc
umentElement()->ensureComputedStyle()->fontSize() != documentElementStyle->fontS
ize())) { | 1659 if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || doc
umentElement()->ensureComputedStyle()->fontSize() != documentElementStyle->fontS
ize())) { |
| 1648 ensureStyleResolver().invalidateMatchedPropertiesCache(); | 1660 ensureStyleResolver().invalidateMatchedPropertiesCache(); |
| 1649 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe
asonForTracing::create(StyleChangeReason::FontSizeChange)); | 1661 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe
asonForTracing::create(StyleChangeReason::FontSizeChange)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1663 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other | 1675 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other |
| 1664 // ways to specify gaps between pages), so we have to propagate it too. | 1676 // ways to specify gaps between pages), so we have to propagate it too. |
| 1665 columnGap = overflowStyle->columnGap(); | 1677 columnGap = overflowStyle->columnGap(); |
| 1666 } | 1678 } |
| 1667 | 1679 |
| 1668 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); | 1680 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); |
| 1669 | 1681 |
| 1670 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); | 1682 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); |
| 1671 if (documentStyle->writingMode() != rootWritingMode | 1683 if (documentStyle->writingMode() != rootWritingMode |
| 1672 || documentStyle->direction() != rootDirection | 1684 || documentStyle->direction() != rootDirection |
| 1685 || documentStyle->columnGap() != columnGap |
| 1673 || documentStyle->overflowX() != overflowX | 1686 || documentStyle->overflowX() != overflowX |
| 1674 || documentStyle->overflowY() != overflowY | 1687 || documentStyle->overflowY() != overflowY |
| 1675 || documentStyle->columnGap() != columnGap | 1688 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b
ackgroundColor |
| 1689 || documentStyle->backgroundLayers() != backgroundLayers |
| 1690 || documentStyle->imageRendering() != imageRendering |
| 1676 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { | 1691 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { |
| 1677 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); | 1692 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); |
| 1678 newStyle->setWritingMode(rootWritingMode); | 1693 newStyle->setWritingMode(rootWritingMode); |
| 1679 newStyle->setDirection(rootDirection); | 1694 newStyle->setDirection(rootDirection); |
| 1680 newStyle->setColumnGap(columnGap); | 1695 newStyle->setColumnGap(columnGap); |
| 1681 newStyle->setOverflowX(overflowX); | 1696 newStyle->setOverflowX(overflowX); |
| 1682 newStyle->setOverflowY(overflowY); | 1697 newStyle->setOverflowY(overflowY); |
| 1698 newStyle->setBackgroundColor(backgroundColor); |
| 1699 newStyle->accessBackgroundLayers() = backgroundLayers; |
| 1700 newStyle->setImageRendering(imageRendering); |
| 1683 newStyle->setScrollBlocksOn(scrollBlocksOn); | 1701 newStyle->setScrollBlocksOn(scrollBlocksOn); |
| 1684 layoutView()->setStyle(newStyle); | 1702 layoutView()->setStyle(newStyle); |
| 1685 setupFontBuilder(*newStyle); | 1703 setupFontBuilder(*newStyle); |
| 1686 } | 1704 } |
| 1687 | 1705 |
| 1688 if (body) { | 1706 if (body) { |
| 1689 if (const ComputedStyle* style = body->computedStyle()) { | 1707 if (const ComputedStyle* style = body->computedStyle()) { |
| 1690 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1708 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) |
| 1691 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1709 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
| 1692 } | 1710 } |
| (...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5771 #ifndef NDEBUG | 5789 #ifndef NDEBUG |
| 5772 using namespace blink; | 5790 using namespace blink; |
| 5773 void showLiveDocumentInstances() | 5791 void showLiveDocumentInstances() |
| 5774 { | 5792 { |
| 5775 WeakDocumentSet& set = liveDocumentSet(); | 5793 WeakDocumentSet& set = liveDocumentSet(); |
| 5776 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5794 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5777 for (Document* document : set) | 5795 for (Document* document : set) |
| 5778 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5796 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5779 } | 5797 } |
| 5780 #endif | 5798 #endif |
| OLD | NEW |