| 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 if (body) { | 1605 if (body) { |
| 1606 bodyStyle = body->mutableComputedStyle(); | 1606 bodyStyle = body->mutableComputedStyle(); |
| 1607 if (didRecalcDocumentElement) | 1607 if (didRecalcDocumentElement) |
| 1608 body->clearAnimationStyleChange(); | 1608 body->clearAnimationStyleChange(); |
| 1609 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) | 1609 if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) |
| 1610 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); | 1610 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); |
| 1611 rootWritingMode = bodyStyle->writingMode(); | 1611 rootWritingMode = bodyStyle->writingMode(); |
| 1612 rootDirection = bodyStyle->direction(); | 1612 rootDirection = bodyStyle->direction(); |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 RefPtr<ComputedStyle> overflowStyle; | 1615 const ComputedStyle* backgroundStyle = documentElementStyle.get(); |
| 1616 // http://www.w3.org/TR/css3-background/#body-background |
| 1617 // <html> root element with no background steals background from its first <
body> child. |
| 1618 // Also see LayoutBoxModelObject::backgroundStolenForBeingBody() |
| 1619 if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !back
groundStyle->hasBackground()) |
| 1620 backgroundStyle = bodyStyle.get(); |
| 1621 Color backgroundColor = backgroundStyle->visitedDependentColor(CSSPropertyBa
ckgroundColor); |
| 1622 FillLayer backgroundLayers = backgroundStyle->backgroundLayers(); |
| 1623 for (auto currentLayer = &backgroundLayers; currentLayer; currentLayer = cur
rentLayer->next()) { |
| 1624 // http://www.w3.org/TR/css3-background/#root-background |
| 1625 // The root element background always have painting area of the whole ca
nvas. |
| 1626 currentLayer->setClip(BorderFillBox); |
| 1627 |
| 1628 // The root element doesn't scroll. It always propagates its layout over
flow |
| 1629 // to the viewport. Positioning background against either box is equival
ent to |
| 1630 // positioning against the scrolled box of the viewport. |
| 1631 if (currentLayer->attachment() == ScrollBackgroundAttachment) |
| 1632 currentLayer->setAttachment(LocalBackgroundAttachment); |
| 1633 } |
| 1634 EImageRendering imageRendering = backgroundStyle->imageRendering(); |
| 1635 |
| 1636 const ComputedStyle* overflowStyle = nullptr; |
| 1616 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ | 1637 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ |
| 1617 if (element == body) { | 1638 if (element == body) { |
| 1618 overflowStyle = bodyStyle; | 1639 overflowStyle = bodyStyle.get(); |
| 1619 } else { | 1640 } else { |
| 1620 ASSERT(element == documentElement()); | 1641 ASSERT(element == documentElement()); |
| 1621 overflowStyle = documentElementStyle; | 1642 overflowStyle = documentElementStyle.get(); |
| 1622 } | 1643 } |
| 1623 } | 1644 } |
| 1624 | 1645 |
| 1625 // Resolved rem units are stored in the matched properties cache so we need
to make sure to | 1646 // Resolved rem units are stored in the matched properties cache so we need
to make sure to |
| 1626 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed | 1647 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed |
| 1627 // and then trigger a full document recalc. We also need to clear it here si
nce the | 1648 // and then trigger a full document recalc. We also need to clear it here si
nce the |
| 1628 // call to styleForElement on the body above can cache bad values for rem un
its if the | 1649 // call to styleForElement on the body above can cache bad values for rem un
its if the |
| 1629 // documentElement's style was dirty. We could keep track of which elements
depend on | 1650 // documentElement's style was dirty. We could keep track of which elements
depend on |
| 1630 // rem units like we do for viewport styles, but we assume root font size ch
anges are | 1651 // rem units like we do for viewport styles, but we assume root font size ch
anges are |
| 1631 // rare and just invalidate the cache for now. | 1652 // rare and just invalidate the cache for now. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1648 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other | 1669 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other |
| 1649 // ways to specify gaps between pages), so we have to propagate it too. | 1670 // ways to specify gaps between pages), so we have to propagate it too. |
| 1650 columnGap = overflowStyle->columnGap(); | 1671 columnGap = overflowStyle->columnGap(); |
| 1651 } | 1672 } |
| 1652 | 1673 |
| 1653 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); | 1674 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); |
| 1654 | 1675 |
| 1655 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); | 1676 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); |
| 1656 if (documentStyle->writingMode() != rootWritingMode | 1677 if (documentStyle->writingMode() != rootWritingMode |
| 1657 || documentStyle->direction() != rootDirection | 1678 || documentStyle->direction() != rootDirection |
| 1679 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b
ackgroundColor |
| 1680 || documentStyle->backgroundLayers() != backgroundLayers |
| 1681 || documentStyle->imageRendering() != imageRendering |
| 1658 || documentStyle->overflowX() != overflowX | 1682 || documentStyle->overflowX() != overflowX |
| 1659 || documentStyle->overflowY() != overflowY | 1683 || documentStyle->overflowY() != overflowY |
| 1660 || documentStyle->columnGap() != columnGap | 1684 || documentStyle->columnGap() != columnGap |
| 1661 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { | 1685 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { |
| 1662 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); | 1686 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); |
| 1663 newStyle->setWritingMode(rootWritingMode); | 1687 newStyle->setWritingMode(rootWritingMode); |
| 1664 newStyle->setDirection(rootDirection); | 1688 newStyle->setDirection(rootDirection); |
| 1665 newStyle->setColumnGap(columnGap); | 1689 newStyle->setBackgroundColor(backgroundColor); |
| 1690 newStyle->accessBackgroundLayers() = backgroundLayers; |
| 1691 newStyle->setImageRendering(imageRendering); |
| 1666 newStyle->setOverflowX(overflowX); | 1692 newStyle->setOverflowX(overflowX); |
| 1667 newStyle->setOverflowY(overflowY); | 1693 newStyle->setOverflowY(overflowY); |
| 1694 newStyle->setColumnGap(columnGap); |
| 1668 newStyle->setScrollBlocksOn(scrollBlocksOn); | 1695 newStyle->setScrollBlocksOn(scrollBlocksOn); |
| 1669 layoutView()->setStyle(newStyle); | 1696 layoutView()->setStyle(newStyle); |
| 1670 setupFontBuilder(*newStyle); | 1697 setupFontBuilder(*newStyle); |
| 1671 } | 1698 } |
| 1672 | 1699 |
| 1673 if (body) { | 1700 if (body) { |
| 1674 if (const ComputedStyle* style = body->computedStyle()) { | 1701 if (const ComputedStyle* style = body->computedStyle()) { |
| 1675 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1702 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) |
| 1676 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1703 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
| 1677 } | 1704 } |
| (...skipping 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5680 #ifndef NDEBUG | 5707 #ifndef NDEBUG |
| 5681 using namespace blink; | 5708 using namespace blink; |
| 5682 void showLiveDocumentInstances() | 5709 void showLiveDocumentInstances() |
| 5683 { | 5710 { |
| 5684 WeakDocumentSet& set = liveDocumentSet(); | 5711 WeakDocumentSet& set = liveDocumentSet(); |
| 5685 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5712 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5686 for (Document* document : set) | 5713 for (Document* document : set) |
| 5687 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5714 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5688 } | 5715 } |
| 5689 #endif | 5716 #endif |
| OLD | NEW |