Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 185263002: Don't setStyle the RenderView every style recalc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix chicken-egg assert in test Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/web/WebViewImpl.cpp » ('j') | Source/web/WebViewImpl.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 // and then trigger a full document recalc. We also need to clear it here si nce the 1653 // and then trigger a full document recalc. We also need to clear it here si nce the
1654 // call to styleForElement on the body above can cache bad values for rem un its if the 1654 // call to styleForElement on the body above can cache bad values for rem un its if the
1655 // documentElement's style was dirty. We could keep track of which elements depend on 1655 // documentElement's style was dirty. We could keep track of which elements depend on
1656 // rem units like we do for viewport styles, but we assume root font size ch anges are 1656 // rem units like we do for viewport styles, but we assume root font size ch anges are
1657 // rare and just invalidate the cache for now. 1657 // rare and just invalidate the cache for now.
1658 if (styleEngine()->usesRemUnits() && (documentElement()->needsAttach() || do cumentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize() )) { 1658 if (styleEngine()->usesRemUnits() && (documentElement()->needsAttach() || do cumentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize() )) {
1659 ensureStyleResolver().invalidateMatchedPropertiesCache(); 1659 ensureStyleResolver().invalidateMatchedPropertiesCache();
1660 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); 1660 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange);
1661 } 1661 }
1662 1662
1663 EOverflow overflowX = OAUTO;
1664 EOverflow overflowY = OAUTO;
1665 float columnGap = 0;
1666 if (overflowStyle) {
1667 overflowX = overflowStyle->overflowX();
1668 overflowY = overflowStyle->overflowY();
1669 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto':
1670 if (overflowX == OVISIBLE)
1671 overflowX = OAUTO;
1672 if (overflowY == OVISIBLE)
1673 overflowY = OAUTO;
1674 // Column-gap is (ab)used by the current paged overflow implementation ( in lack of other
1675 // ways to specify gaps between pages), so we have to propagate it too.
1676 columnGap = overflowStyle->columnGap();
1677 }
1678
1663 RefPtr<RenderStyle> documentStyle = renderView()->style(); 1679 RefPtr<RenderStyle> documentStyle = renderView()->style();
1664 if (documentStyle->writingMode() != rootWritingMode 1680 if (documentStyle->writingMode() != rootWritingMode
1665 || documentStyle->direction() != rootDirection 1681 || documentStyle->direction() != rootDirection
1666 || (overflowStyle && (documentStyle->overflowX() != overflowStyle->overf lowX() || documentStyle->overflowY() != overflowStyle->overflowY()))) { 1682 || documentStyle->overflowX() != overflowX
1683 || documentStyle->overflowY() != overflowY
1684 || documentStyle->columnGap() != columnGap) {
1667 RefPtr<RenderStyle> newStyle = RenderStyle::clone(documentStyle.get()); 1685 RefPtr<RenderStyle> newStyle = RenderStyle::clone(documentStyle.get());
1668 newStyle->setWritingMode(rootWritingMode); 1686 newStyle->setWritingMode(rootWritingMode);
1669 newStyle->setDirection(rootDirection); 1687 newStyle->setDirection(rootDirection);
1670 EOverflow overflowX = OAUTO; 1688 newStyle->setColumnGap(columnGap);
1671 EOverflow overflowY = OAUTO;
1672 if (overflowStyle) {
1673 overflowX = overflowStyle->overflowX();
1674 overflowY = overflowStyle->overflowY();
1675 // Visible overflow on the viewport is meaningless, and the spec say s to treat it as 'auto':
1676 if (overflowX == OVISIBLE)
1677 overflowX = OAUTO;
1678 if (overflowY == OVISIBLE)
1679 overflowY = OAUTO;
1680
1681 // Column-gap is (ab)used by the current paged overflow implementati on (in lack of other
1682 // ways to specify gaps between pages), so we have to propagate it t oo.
1683 newStyle->setColumnGap(overflowStyle->columnGap());
1684 }
1685 newStyle->setOverflowX(overflowX); 1689 newStyle->setOverflowX(overflowX);
1686 newStyle->setOverflowY(overflowY); 1690 newStyle->setOverflowY(overflowY);
1687 renderView()->setStyle(newStyle); 1691 renderView()->setStyle(newStyle);
1688 setupFontBuilder(newStyle.get()); 1692 setupFontBuilder(newStyle.get());
1689 } 1693 }
1690 1694
1691 if (body) { 1695 if (body) {
1692 if (RenderStyle* style = body->renderStyle()) { 1696 if (RenderStyle* style = body->renderStyle()) {
1693 if (style->direction() != rootDirection || style->writingMode() != r ootWritingMode) 1697 if (style->direction() != rootDirection || style->writingMode() != r ootWritingMode)
1694 body->setNeedsStyleRecalc(SubtreeStyleChange); 1698 body->setNeedsStyleRecalc(SubtreeStyleChange);
(...skipping 3739 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 void Document::defaultEventHandler(Event* event) 5438 void Document::defaultEventHandler(Event* event)
5435 { 5439 {
5436 if (frame() && frame()->remotePlatformLayer()) { 5440 if (frame() && frame()->remotePlatformLayer()) {
5437 frame()->chromeClient().forwardInputEvent(this, event); 5441 frame()->chromeClient().forwardInputEvent(this, event);
5438 return; 5442 return;
5439 } 5443 }
5440 Node::defaultEventHandler(event); 5444 Node::defaultEventHandler(event);
5441 } 5445 }
5442 5446
5443 } // namespace WebCore 5447 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/web/WebViewImpl.cpp » ('j') | Source/web/WebViewImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698