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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 FontBuilder fontBuilder(*this); | 1627 FontBuilder fontBuilder(*this); |
1628 RefPtrWillBeRawPtr<CSSFontSelector> selector = m_styleEngine->fontSelector()
; | 1628 RefPtrWillBeRawPtr<CSSFontSelector> selector = m_styleEngine->fontSelector()
; |
1629 fontBuilder.createFontForDocument(selector, documentStyle); | 1629 fontBuilder.createFontForDocument(selector, documentStyle); |
1630 } | 1630 } |
1631 | 1631 |
1632 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) | 1632 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) |
1633 { | 1633 { |
1634 ASSERT(inStyleRecalc()); | 1634 ASSERT(inStyleRecalc()); |
1635 ASSERT(documentElement()); | 1635 ASSERT(documentElement()); |
1636 | 1636 |
1637 RefPtr<LayoutStyle> documentElementStyle = documentElement()->layoutStyle(); | 1637 RefPtr<LayoutStyle> documentElementStyle = documentElement()->mutableLayoutS
tyle(); |
1638 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) | 1638 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) |
1639 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); | 1639 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); |
1640 | 1640 |
1641 WritingMode rootWritingMode = documentElementStyle->writingMode(); | 1641 WritingMode rootWritingMode = documentElementStyle->writingMode(); |
1642 TextDirection rootDirection = documentElementStyle->direction(); | 1642 TextDirection rootDirection = documentElementStyle->direction(); |
1643 | 1643 |
1644 HTMLElement* body = this->body(); | 1644 HTMLElement* body = this->body(); |
1645 RefPtr<LayoutStyle> bodyStyle; | 1645 RefPtr<LayoutStyle> bodyStyle; |
1646 if (body) { | 1646 if (body) { |
1647 bodyStyle = body->layoutStyle(); | 1647 bodyStyle = body->mutableLayoutStyle(); |
1648 if (!bodyStyle || body->needsStyleRecalc() || documentElement()->needsSt
yleRecalc() || change == Force) | 1648 if (!bodyStyle || body->needsStyleRecalc() || documentElement()->needsSt
yleRecalc() || change == Force) |
1649 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); | 1649 bodyStyle = ensureStyleResolver().styleForElement(body, documentElem
entStyle.get()); |
1650 rootWritingMode = bodyStyle->writingMode(); | 1650 rootWritingMode = bodyStyle->writingMode(); |
1651 rootDirection = bodyStyle->direction(); | 1651 rootDirection = bodyStyle->direction(); |
1652 } | 1652 } |
1653 | 1653 |
1654 RefPtr<LayoutStyle> overflowStyle; | 1654 RefPtr<LayoutStyle> overflowStyle; |
1655 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ | 1655 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ |
1656 if (element == body) { | 1656 if (element == body) { |
1657 overflowStyle = bodyStyle; | 1657 overflowStyle = bodyStyle; |
(...skipping 26 matching lines...) Expand all Loading... |
1684 overflowX = OAUTO; | 1684 overflowX = OAUTO; |
1685 if (overflowY == OVISIBLE) | 1685 if (overflowY == OVISIBLE) |
1686 overflowY = OAUTO; | 1686 overflowY = OAUTO; |
1687 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other | 1687 // Column-gap is (ab)used by the current paged overflow implementation (
in lack of other |
1688 // ways to specify gaps between pages), so we have to propagate it too. | 1688 // ways to specify gaps between pages), so we have to propagate it too. |
1689 columnGap = overflowStyle->columnGap(); | 1689 columnGap = overflowStyle->columnGap(); |
1690 } | 1690 } |
1691 | 1691 |
1692 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); | 1692 WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); |
1693 | 1693 |
1694 RefPtr<LayoutStyle> documentStyle = renderView()->style(); | 1694 RefPtr<LayoutStyle> documentStyle = renderView()->mutableStyle(); |
1695 if (documentStyle->writingMode() != rootWritingMode | 1695 if (documentStyle->writingMode() != rootWritingMode |
1696 || documentStyle->direction() != rootDirection | 1696 || documentStyle->direction() != rootDirection |
1697 || documentStyle->overflowX() != overflowX | 1697 || documentStyle->overflowX() != overflowX |
1698 || documentStyle->overflowY() != overflowY | 1698 || documentStyle->overflowY() != overflowY |
1699 || documentStyle->columnGap() != columnGap | 1699 || documentStyle->columnGap() != columnGap |
1700 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { | 1700 || documentStyle->scrollBlocksOn() != scrollBlocksOn) { |
1701 RefPtr<LayoutStyle> newStyle = LayoutStyle::clone(*documentStyle); | 1701 RefPtr<LayoutStyle> newStyle = LayoutStyle::clone(*documentStyle); |
1702 newStyle->setWritingMode(rootWritingMode); | 1702 newStyle->setWritingMode(rootWritingMode); |
1703 newStyle->setDirection(rootDirection); | 1703 newStyle->setDirection(rootDirection); |
1704 newStyle->setColumnGap(columnGap); | 1704 newStyle->setColumnGap(columnGap); |
1705 newStyle->setOverflowX(overflowX); | 1705 newStyle->setOverflowX(overflowX); |
1706 newStyle->setOverflowY(overflowY); | 1706 newStyle->setOverflowY(overflowY); |
1707 newStyle->setScrollBlocksOn(scrollBlocksOn); | 1707 newStyle->setScrollBlocksOn(scrollBlocksOn); |
1708 renderView()->setStyle(newStyle); | 1708 renderView()->setStyle(newStyle); |
1709 setupFontBuilder(*newStyle); | 1709 setupFontBuilder(*newStyle); |
1710 } | 1710 } |
1711 | 1711 |
1712 if (body) { | 1712 if (body) { |
1713 if (LayoutStyle* style = body->layoutStyle()) { | 1713 if (const LayoutStyle* style = body->layoutStyle()) { |
1714 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1714 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) |
1715 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1715 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
1716 } | 1716 } |
1717 } | 1717 } |
1718 | 1718 |
1719 if (LayoutStyle* style = documentElement()->layoutStyle()) { | 1719 if (const LayoutStyle* style = documentElement()->layoutStyle()) { |
1720 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) | 1720 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) |
1721 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); | 1721 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); |
1722 } | 1722 } |
1723 } | 1723 } |
1724 | 1724 |
1725 void Document::updateRenderTree(StyleRecalcChange change) | 1725 void Document::updateRenderTree(StyleRecalcChange change) |
1726 { | 1726 { |
1727 ASSERT(isMainThread()); | 1727 ASSERT(isMainThread()); |
1728 | 1728 |
1729 ScriptForbiddenScope forbidScript; | 1729 ScriptForbiddenScope forbidScript; |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 | 2407 |
2408 HTMLHeadElement* Document::head() const | 2408 HTMLHeadElement* Document::head() const |
2409 { | 2409 { |
2410 Node* de = documentElement(); | 2410 Node* de = documentElement(); |
2411 if (!de) | 2411 if (!de) |
2412 return 0; | 2412 return 0; |
2413 | 2413 |
2414 return Traversal<HTMLHeadElement>::firstChild(*de); | 2414 return Traversal<HTMLHeadElement>::firstChild(*de); |
2415 } | 2415 } |
2416 | 2416 |
2417 Element* Document::viewportDefiningElement(LayoutStyle* rootStyle) const | 2417 Element* Document::viewportDefiningElement(const LayoutStyle* rootStyle) const |
2418 { | 2418 { |
2419 // If a BODY element sets non-visible overflow, it is to be propagated to th
e viewport, as long | 2419 // If a BODY element sets non-visible overflow, it is to be propagated to th
e viewport, as long |
2420 // as the following conditions are all met: | 2420 // as the following conditions are all met: |
2421 // (1) The root element is HTML. | 2421 // (1) The root element is HTML. |
2422 // (2) It is the primary BODY element (we only assert for this, expecting ca
llers to behave). | 2422 // (2) It is the primary BODY element (we only assert for this, expecting ca
llers to behave). |
2423 // (3) The root element has visible overflow. | 2423 // (3) The root element has visible overflow. |
2424 // Otherwise it's the root element's properties that are to be propagated. | 2424 // Otherwise it's the root element's properties that are to be propagated. |
2425 Element* rootElement = documentElement(); | 2425 Element* rootElement = documentElement(); |
2426 Element* bodyElement = body(); | 2426 Element* bodyElement = body(); |
2427 if (!rootElement) | 2427 if (!rootElement) |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4203 } | 4203 } |
4204 | 4204 |
4205 m_encodingData = newData; | 4205 m_encodingData = newData; |
4206 | 4206 |
4207 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 | 4207 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
4208 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); | 4208 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
4209 if (shouldUseVisualOrdering != m_visuallyOrdered) { | 4209 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
4210 m_visuallyOrdered = shouldUseVisualOrdering; | 4210 m_visuallyOrdered = shouldUseVisualOrdering; |
4211 // FIXME: How is possible to not have a renderer here? | 4211 // FIXME: How is possible to not have a renderer here? |
4212 if (renderView()) | 4212 if (renderView()) |
4213 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); | 4213 renderView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? V
isualOrder : LogicalOrder); |
4214 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ate(StyleChangeReason::VisuallyOrdered)); | 4214 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ate(StyleChangeReason::VisuallyOrdered)); |
4215 } | 4215 } |
4216 } | 4216 } |
4217 | 4217 |
4218 KURL Document::completeURL(const String& url) const | 4218 KURL Document::completeURL(const String& url) const |
4219 { | 4219 { |
4220 return completeURLWithOverride(url, m_baseURL); | 4220 return completeURLWithOverride(url, m_baseURL); |
4221 } | 4221 } |
4222 | 4222 |
4223 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const | 4223 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5769 #ifndef NDEBUG | 5769 #ifndef NDEBUG |
5770 using namespace blink; | 5770 using namespace blink; |
5771 void showLiveDocumentInstances() | 5771 void showLiveDocumentInstances() |
5772 { | 5772 { |
5773 WeakDocumentSet& set = liveDocumentSet(); | 5773 WeakDocumentSet& set = liveDocumentSet(); |
5774 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5774 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5775 for (Document* document : set) | 5775 for (Document* document : set) |
5776 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5776 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5777 } | 5777 } |
5778 #endif | 5778 #endif |
OLD | NEW |