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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 968 |
969 return newFragment; | 969 return newFragment; |
970 } | 970 } |
971 case kDocumentNode: | 971 case kDocumentNode: |
972 exceptionState.throwDOMException( | 972 exceptionState.throwDOMException( |
973 NotSupportedError, | 973 NotSupportedError, |
974 "The node provided is a document, which may not be imported."); | 974 "The node provided is a document, which may not be imported."); |
975 return nullptr; | 975 return nullptr; |
976 } | 976 } |
977 | 977 |
978 ASSERT_NOT_REACHED(); | 978 NOTREACHED(); |
979 return nullptr; | 979 return nullptr; |
980 } | 980 } |
981 | 981 |
982 Node* Document::adoptNode(Node* source, ExceptionState& exceptionState) { | 982 Node* Document::adoptNode(Node* source, ExceptionState& exceptionState) { |
983 EventQueueScope scope; | 983 EventQueueScope scope; |
984 | 984 |
985 switch (source->getNodeType()) { | 985 switch (source->getNodeType()) { |
986 case kDocumentNode: | 986 case kDocumentNode: |
987 exceptionState.throwDOMException(NotSupportedError, | 987 exceptionState.throwDOMException(NotSupportedError, |
988 "The node provided is of type '" + | 988 "The node provided is of type '" + |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 | 1086 |
1087 switch (m_readyState) { | 1087 switch (m_readyState) { |
1088 case Loading: | 1088 case Loading: |
1089 return loading; | 1089 return loading; |
1090 case Interactive: | 1090 case Interactive: |
1091 return interactive; | 1091 return interactive; |
1092 case Complete: | 1092 case Complete: |
1093 return complete; | 1093 return complete; |
1094 } | 1094 } |
1095 | 1095 |
1096 ASSERT_NOT_REACHED(); | 1096 NOTREACHED(); |
1097 return String(); | 1097 return String(); |
1098 } | 1098 } |
1099 | 1099 |
1100 void Document::setReadyState(ReadyState readyState) { | 1100 void Document::setReadyState(ReadyState readyState) { |
1101 if (readyState == m_readyState) | 1101 if (readyState == m_readyState) |
1102 return; | 1102 return; |
1103 | 1103 |
1104 switch (readyState) { | 1104 switch (readyState) { |
1105 case Loading: | 1105 case Loading: |
1106 if (!m_documentTiming.domLoading()) { | 1106 if (!m_documentTiming.domLoading()) { |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 } | 2004 } |
2005 | 2005 |
2006 void Document::updateStyleAndLayout() { | 2006 void Document::updateStyleAndLayout() { |
2007 DCHECK(isMainThread()); | 2007 DCHECK(isMainThread()); |
2008 | 2008 |
2009 ScriptForbiddenScope forbidScript; | 2009 ScriptForbiddenScope forbidScript; |
2010 | 2010 |
2011 FrameView* frameView = view(); | 2011 FrameView* frameView = view(); |
2012 if (frameView && frameView->isInPerformLayout()) { | 2012 if (frameView && frameView->isInPerformLayout()) { |
2013 // View layout should not be re-entrant. | 2013 // View layout should not be re-entrant. |
2014 ASSERT_NOT_REACHED(); | 2014 NOTREACHED(); |
2015 return; | 2015 return; |
2016 } | 2016 } |
2017 | 2017 |
2018 if (HTMLFrameOwnerElement* owner = localOwner()) | 2018 if (HTMLFrameOwnerElement* owner = localOwner()) |
2019 owner->document().updateStyleAndLayout(); | 2019 owner->document().updateStyleAndLayout(); |
2020 | 2020 |
2021 updateStyleAndLayoutTree(); | 2021 updateStyleAndLayoutTree(); |
2022 | 2022 |
2023 if (!isActive()) | 2023 if (!isActive()) |
2024 return; | 2024 return; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 if (width > height) | 2163 if (width > height) |
2164 std::swap(width, height); | 2164 std::swap(width, height); |
2165 break; | 2165 break; |
2166 case PAGE_SIZE_RESOLVED: { | 2166 case PAGE_SIZE_RESOLVED: { |
2167 FloatSize size = style->pageSize(); | 2167 FloatSize size = style->pageSize(); |
2168 width = size.width(); | 2168 width = size.width(); |
2169 height = size.height(); | 2169 height = size.height(); |
2170 break; | 2170 break; |
2171 } | 2171 } |
2172 default: | 2172 default: |
2173 ASSERT_NOT_REACHED(); | 2173 NOTREACHED(); |
2174 } | 2174 } |
2175 pageSize = DoubleSize(width, height); | 2175 pageSize = DoubleSize(width, height); |
2176 | 2176 |
2177 // The percentage is calculated with respect to the width even for margin top | 2177 // The percentage is calculated with respect to the width even for margin top |
2178 // and bottom. | 2178 // and bottom. |
2179 // http://www.w3.org/TR/CSS2/box.html#margin-properties | 2179 // http://www.w3.org/TR/CSS2/box.html#margin-properties |
2180 marginTop = style->marginTop().isAuto() | 2180 marginTop = style->marginTop().isAuto() |
2181 ? marginTop | 2181 ? marginTop |
2182 : intValueForLength(style->marginTop(), width); | 2182 : intValueForLength(style->marginTop(), width); |
2183 marginRight = style->marginRight().isAuto() | 2183 marginRight = style->marginRight().isAuto() |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 case UnloadEventInProgress: | 2960 case UnloadEventInProgress: |
2961 return UnloadDismissal; | 2961 return UnloadDismissal; |
2962 | 2962 |
2963 case LoadEventNotRun: | 2963 case LoadEventNotRun: |
2964 case LoadEventInProgress: | 2964 case LoadEventInProgress: |
2965 case LoadEventCompleted: | 2965 case LoadEventCompleted: |
2966 case BeforeUnloadEventCompleted: | 2966 case BeforeUnloadEventCompleted: |
2967 case UnloadEventHandled: | 2967 case UnloadEventHandled: |
2968 return NoDismissal; | 2968 return NoDismissal; |
2969 } | 2969 } |
2970 ASSERT_NOT_REACHED(); | 2970 NOTREACHED(); |
2971 return NoDismissal; | 2971 return NoDismissal; |
2972 } | 2972 } |
2973 | 2973 |
2974 void Document::setParsingState(ParsingState parsingState) { | 2974 void Document::setParsingState(ParsingState parsingState) { |
2975 m_parsingState = parsingState; | 2975 m_parsingState = parsingState; |
2976 | 2976 |
2977 if (parsing() && !m_elementDataCache) | 2977 if (parsing() && !m_elementDataCache) |
2978 m_elementDataCache = ElementDataCache::create(); | 2978 m_elementDataCache = ElementDataCache::create(); |
2979 } | 2979 } |
2980 | 2980 |
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5172 firstFavicon = newURL; | 5172 firstFavicon = newURL; |
5173 } else if (linkElement->getIconType() == TouchIcon) { | 5173 } else if (linkElement->getIconType() == TouchIcon) { |
5174 if (firstTouchIcon.m_iconType != InvalidIcon) | 5174 if (firstTouchIcon.m_iconType != InvalidIcon) |
5175 secondaryIcons.append(firstTouchIcon); | 5175 secondaryIcons.append(firstTouchIcon); |
5176 firstTouchIcon = newURL; | 5176 firstTouchIcon = newURL; |
5177 } else if (linkElement->getIconType() == TouchPrecomposedIcon) { | 5177 } else if (linkElement->getIconType() == TouchPrecomposedIcon) { |
5178 if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon) | 5178 if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon) |
5179 secondaryIcons.append(firstTouchPrecomposedIcon); | 5179 secondaryIcons.append(firstTouchPrecomposedIcon); |
5180 firstTouchPrecomposedIcon = newURL; | 5180 firstTouchPrecomposedIcon = newURL; |
5181 } else { | 5181 } else { |
5182 ASSERT_NOT_REACHED(); | 5182 NOTREACHED(); |
5183 } | 5183 } |
5184 } | 5184 } |
5185 | 5185 |
5186 Vector<IconURL> iconURLs; | 5186 Vector<IconURL> iconURLs; |
5187 if (firstFavicon.m_iconType != InvalidIcon) | 5187 if (firstFavicon.m_iconType != InvalidIcon) |
5188 iconURLs.append(firstFavicon); | 5188 iconURLs.append(firstFavicon); |
5189 else if (m_url.protocolIsInHTTPFamily() && iconTypesMask & Favicon) | 5189 else if (m_url.protocolIsInHTTPFamily() && iconTypesMask & Favicon) |
5190 iconURLs.append(IconURL::defaultFavicon(m_url)); | 5190 iconURLs.append(IconURL::defaultFavicon(m_url)); |
5191 | 5191 |
5192 if (firstTouchIcon.m_iconType != InvalidIcon) | 5192 if (firstTouchIcon.m_iconType != InvalidIcon) |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6080 void Document::didAssociateFormControl(Element* element) { | 6080 void Document::didAssociateFormControl(Element* element) { |
6081 if (!frame() || !frame()->page() || !loadEventFinished()) | 6081 if (!frame() || !frame()->page() || !loadEventFinished()) |
6082 return; | 6082 return; |
6083 | 6083 |
6084 // We add a slight delay because this could be called rapidly. | 6084 // We add a slight delay because this could be called rapidly. |
6085 if (!m_didAssociateFormControlsTimer.isActive()) | 6085 if (!m_didAssociateFormControlsTimer.isActive()) |
6086 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE); | 6086 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE); |
6087 } | 6087 } |
6088 | 6088 |
6089 void Document::didAssociateFormControlsTimerFired(TimerBase* timer) { | 6089 void Document::didAssociateFormControlsTimerFired(TimerBase* timer) { |
6090 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); | 6090 DCHECK_EQ(timer, &m_didAssociateFormControlsTimer); |
6091 if (!frame() || !frame()->page()) | 6091 if (!frame() || !frame()->page()) |
6092 return; | 6092 return; |
6093 | 6093 |
6094 frame()->page()->chromeClient().didAssociateFormControlsAfterLoad(frame()); | 6094 frame()->page()->chromeClient().didAssociateFormControlsAfterLoad(frame()); |
6095 } | 6095 } |
6096 | 6096 |
6097 float Document::devicePixelRatio() const { | 6097 float Document::devicePixelRatio() const { |
6098 return m_frame ? m_frame->devicePixelRatio() : 1.0; | 6098 return m_frame ? m_frame->devicePixelRatio() : 1.0; |
6099 } | 6099 } |
6100 | 6100 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6388 } | 6388 } |
6389 | 6389 |
6390 void showLiveDocumentInstances() { | 6390 void showLiveDocumentInstances() { |
6391 WeakDocumentSet& set = liveDocumentSet(); | 6391 WeakDocumentSet& set = liveDocumentSet(); |
6392 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6392 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6393 for (Document* document : set) | 6393 for (Document* document : set) |
6394 fprintf(stderr, "- Document %p URL: %s\n", document, | 6394 fprintf(stderr, "- Document %p URL: %s\n", document, |
6395 document->url().getString().utf8().data()); | 6395 document->url().getString().utf8().data()); |
6396 } | 6396 } |
6397 #endif | 6397 #endif |
OLD | NEW |