| 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 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 HashSet<Document*>::iterator it = documentsThatNeedStyleRecalc->begin(); | 1905 HashSet<Document*>::iterator it = documentsThatNeedStyleRecalc->begin(); |
| 1906 Document* doc = *it; | 1906 Document* doc = *it; |
| 1907 documentsThatNeedStyleRecalc->remove(doc); | 1907 documentsThatNeedStyleRecalc->remove(doc); |
| 1908 doc->updateStyleIfNeeded(); | 1908 doc->updateStyleIfNeeded(); |
| 1909 } | 1909 } |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 void Document::updateLayout() | 1912 void Document::updateLayout() |
| 1913 { | 1913 { |
| 1914 ASSERT(isMainThread()); | 1914 ASSERT(isMainThread()); |
| 1915 |
| 1916 FrameView* frameView = view(); |
| 1917 if (frameView && frameView->isInLayout()) { |
| 1918 // View layout should not be re-entrant. |
| 1919 ASSERT_NOT_REACHED(); |
| 1920 return; |
| 1921 } |
| 1922 |
| 1915 if (Element* oe = ownerElement()) | 1923 if (Element* oe = ownerElement()) |
| 1916 oe->document()->updateLayout(); | 1924 oe->document()->updateLayout(); |
| 1917 | 1925 |
| 1918 updateStyleIfNeeded(); | 1926 updateStyleIfNeeded(); |
| 1919 | 1927 |
| 1920 StackStats::LayoutCheckPoint layoutCheckPoint; | 1928 StackStats::LayoutCheckPoint layoutCheckPoint; |
| 1929 |
| 1921 // Only do a layout if changes have occurred that make it necessary. | 1930 // Only do a layout if changes have occurred that make it necessary. |
| 1922 FrameView* v = view(); | 1931 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne
edsLayout())) |
| 1923 if (v && renderer() && (v->layoutPending() || renderer()->needsLayout())) | 1932 frameView->layout(); |
| 1924 v->layout(); | |
| 1925 } | 1933 } |
| 1926 | 1934 |
| 1927 // FIXME: This is a bad idea and needs to be removed eventually. | 1935 // FIXME: This is a bad idea and needs to be removed eventually. |
| 1928 // Other browsers load stylesheets before they continue parsing the web page. | 1936 // Other browsers load stylesheets before they continue parsing the web page. |
| 1929 // Since we don't, we can run JavaScript code that needs answers before the | 1937 // Since we don't, we can run JavaScript code that needs answers before the |
| 1930 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 1938 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
| 1931 // lets us get reasonable answers. The long term solution to this problem is | 1939 // lets us get reasonable answers. The long term solution to this problem is |
| 1932 // to instead suspend JavaScript execution. | 1940 // to instead suspend JavaScript execution. |
| 1933 void Document::updateLayoutIgnorePendingStylesheets() | 1941 void Document::updateLayoutIgnorePendingStylesheets() |
| 1934 { | 1942 { |
| (...skipping 4048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5983 m_templateContentsOwnerDocument = HTMLDocument::create(0, blankURL()
); | 5991 m_templateContentsOwnerDocument = HTMLDocument::create(0, blankURL()
); |
| 5984 else | 5992 else |
| 5985 m_templateContentsOwnerDocument = Document::create(0, blankURL()); | 5993 m_templateContentsOwnerDocument = Document::create(0, blankURL()); |
| 5986 } | 5994 } |
| 5987 | 5995 |
| 5988 return m_templateContentsOwnerDocument.get(); | 5996 return m_templateContentsOwnerDocument.get(); |
| 5989 } | 5997 } |
| 5990 #endif | 5998 #endif |
| 5991 | 5999 |
| 5992 } // namespace WebCore | 6000 } // namespace WebCore |
| OLD | NEW |