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

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

Issue 13771002: Recalc styles on resize if we have viewport units. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 8 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
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 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. 1803 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
1804 1804
1805 if (m_styleSheetCollection->needsUpdateActiveStylesheetsOnStyleRecalc()) 1805 if (m_styleSheetCollection->needsUpdateActiveStylesheetsOnStyleRecalc())
1806 m_styleSheetCollection->updateActiveStyleSheets(DocumentStyleSheetCollec tion::FullUpdate); 1806 m_styleSheetCollection->updateActiveStyleSheets(DocumentStyleSheetCollec tion::FullUpdate);
1807 1807
1808 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc ulateStyle(this); 1808 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc ulateStyle(this);
1809 1809
1810 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) 1810 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits())
1811 m_styleSheetCollection->setUsesRemUnit(true); 1811 m_styleSheetCollection->setUsesRemUnit(true);
1812 1812
1813 if (m_elemSheet && m_elemSheet->contents()->usesViewportUnits())
1814 m_styleSheetCollection->setUsesViewportUnit(true);
1815
1813 m_inStyleRecalc = true; 1816 m_inStyleRecalc = true;
1814 { 1817 {
1815 PostAttachCallbackDisabler disabler(this); 1818 PostAttachCallbackDisabler disabler(this);
1816 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; 1819 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
1817 1820
1818 RefPtr<FrameView> frameView = view(); 1821 RefPtr<FrameView> frameView = view();
1819 if (frameView) { 1822 if (frameView) {
1820 frameView->pauseScheduledEvents(); 1823 frameView->pauseScheduledEvents();
1821 frameView->beginDeferredRepaints(); 1824 frameView->beginDeferredRepaints();
1822 } 1825 }
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 if (!m_baseURL.isValid()) 2663 if (!m_baseURL.isValid())
2661 m_baseURL = KURL(); 2664 m_baseURL = KURL();
2662 2665
2663 if (m_elemSheet) { 2666 if (m_elemSheet) {
2664 // Element sheet is silly. It never contains anything. 2667 // Element sheet is silly. It never contains anything.
2665 ASSERT(!m_elemSheet->contents()->ruleCount()); 2668 ASSERT(!m_elemSheet->contents()->ruleCount());
2666 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2669 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2667 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2670 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2668 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2671 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2669 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2672 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2673
2674 bool usesViewportUnits = m_elemSheet->contents()->usesViewportUnits();
2675 m_elemSheet->contents()->parserSetUsesViewportUnits(usesViewportUnits);
2670 } 2676 }
2671 2677
2672 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2678 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2673 // Base URL change changes any relative visited links. 2679 // Base URL change changes any relative visited links.
2674 // FIXME: There are other URLs in the tree that would need to be re-eval uated on dynamic base URL change. Style should be invalidated too. 2680 // FIXME: There are other URLs in the tree that would need to be re-eval uated on dynamic base URL change. Style should be invalidated too.
2675 for (Element* element = ElementTraversal::firstWithin(this); element; el ement = ElementTraversal::next(element)) { 2681 for (Element* element = ElementTraversal::firstWithin(this); element; el ement = ElementTraversal::next(element)) {
2676 if (element->hasTagName(aTag)) 2682 if (element->hasTagName(aTag))
2677 static_cast<HTMLAnchorElement*>(element)->invalidateCachedVisite dLinkHash(); 2683 static_cast<HTMLAnchorElement*>(element)->invalidateCachedVisite dLinkHash();
2678 } 2684 }
2679 } 2685 }
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
4442 { 4448 {
4443 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); 4449 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
4444 ASSERT(!scriptableDocumentParser() || m_readyState != Loading); 4450 ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
4445 setParsing(false); 4451 setParsing(false);
4446 if (!m_documentTiming.domContentLoadedEventStart) 4452 if (!m_documentTiming.domContentLoadedEventStart)
4447 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e(); 4453 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e();
4448 dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false) ); 4454 dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false) );
4449 if (!m_documentTiming.domContentLoadedEventEnd) 4455 if (!m_documentTiming.domContentLoadedEventEnd)
4450 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( ); 4456 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( );
4451 4457
4458 if (m_elemSheet && m_elemSheet->contents()->usesViewportUnits())
4459 m_styleSheetCollection->setUsesViewportUnit(true);
4460
4452 if (RefPtr<Frame> f = frame()) { 4461 if (RefPtr<Frame> f = frame()) {
4453 // FrameLoader::finishedParsing() might end up calling Document::implici tClose() if all 4462 // FrameLoader::finishedParsing() might end up calling Document::implici tClose() if all
4454 // resource loads are complete. HTMLObjectElements can start loading the ir resources from 4463 // resource loads are complete. HTMLObjectElements can start loading the ir resources from
4455 // post attach callbacks triggered by recalcStyle(). This means if we p arse out an <object> 4464 // post attach callbacks triggered by recalcStyle(). This means if we p arse out an <object>
4456 // tag and then reach the end of the document without updating styles, w e might not have yet 4465 // tag and then reach the end of the document without updating styles, w e might not have yet
4457 // started the resource load and might fire the window load event too ea rly. To avoid this 4466 // started the resource load and might fire the window load event too ea rly. To avoid this
4458 // we force the styles to be up to date before calling FrameLoader::fini shedParsing(). 4467 // we force the styles to be up to date before calling FrameLoader::fini shedParsing().
4459 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com ment 35. 4468 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com ment 35.
4460 updateStyleIfNeeded(); 4469 updateStyleIfNeeded();
4461 4470
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after
6114 return; 6123 return;
6115 6124
6116 Vector<RefPtr<Element> > associatedFormControls; 6125 Vector<RefPtr<Element> > associatedFormControls;
6117 copyToVector(m_associatedFormControls, associatedFormControls); 6126 copyToVector(m_associatedFormControls, associatedFormControls);
6118 6127
6119 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); 6128 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls);
6120 m_associatedFormControls.clear(); 6129 m_associatedFormControls.clear();
6121 } 6130 }
6122 6131
6123 } // namespace WebCore 6132 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698