| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "core/css/CSSRuleList.h" | 39 #include "core/css/CSSRuleList.h" |
| 40 #include "core/css/CSSStyleRule.h" | 40 #include "core/css/CSSStyleRule.h" |
| 41 #include "core/css/CSSStyleSheet.h" | 41 #include "core/css/CSSStyleSheet.h" |
| 42 #include "core/css/MediaList.h" | 42 #include "core/css/MediaList.h" |
| 43 #include "core/css/StylePropertySet.h" | 43 #include "core/css/StylePropertySet.h" |
| 44 #include "core/css/StyleRule.h" | 44 #include "core/css/StyleRule.h" |
| 45 #include "core/css/StyleSheet.h" | 45 #include "core/css/StyleSheet.h" |
| 46 #include "core/css/StyleSheetContents.h" | 46 #include "core/css/StyleSheetContents.h" |
| 47 #include "core/css/StyleSheetList.h" | 47 #include "core/css/StyleSheetList.h" |
| 48 #include "core/css/resolver/StyleResolver.h" | 48 #include "core/css/resolver/StyleResolver.h" |
| 49 #include "core/dom/NamedFlow.h" | |
| 50 #include "core/dom/NamedFlowCollection.h" | |
| 51 #include "core/dom/Node.h" | 49 #include "core/dom/Node.h" |
| 52 #include "core/dom/NodeList.h" | 50 #include "core/dom/NodeList.h" |
| 53 #include "core/fetch/CSSStyleSheetResource.h" | 51 #include "core/fetch/CSSStyleSheetResource.h" |
| 54 #include "core/fetch/ResourceClient.h" | 52 #include "core/fetch/ResourceClient.h" |
| 55 #include "core/fetch/ResourceFetcher.h" | 53 #include "core/fetch/ResourceFetcher.h" |
| 56 #include "core/fetch/StyleSheetResourceClient.h" | 54 #include "core/fetch/StyleSheetResourceClient.h" |
| 57 #include "core/html/HTMLHeadElement.h" | 55 #include "core/html/HTMLHeadElement.h" |
| 58 #include "core/inspector/InspectorHistory.h" | 56 #include "core/inspector/InspectorHistory.h" |
| 59 #include "core/inspector/InspectorPageAgent.h" | 57 #include "core/inspector/InspectorPageAgent.h" |
| 60 #include "core/inspector/InspectorResourceAgent.h" | 58 #include "core/inspector/InspectorResourceAgent.h" |
| 61 #include "core/inspector/InspectorState.h" | 59 #include "core/inspector/InspectorState.h" |
| 62 #include "core/inspector/InstrumentingAgents.h" | 60 #include "core/inspector/InstrumentingAgents.h" |
| 63 #include "core/loader/DocumentLoader.h" | 61 #include "core/loader/DocumentLoader.h" |
| 64 #include "core/frame/Frame.h" | 62 #include "core/frame/Frame.h" |
| 65 #include "core/page/Page.h" | 63 #include "core/page/Page.h" |
| 66 #include "core/rendering/InlineTextBox.h" | 64 #include "core/rendering/InlineTextBox.h" |
| 67 #include "core/rendering/RenderObject.h" | 65 #include "core/rendering/RenderObject.h" |
| 68 #include "core/rendering/RenderRegion.h" | |
| 69 #include "core/rendering/RenderText.h" | 66 #include "core/rendering/RenderText.h" |
| 70 #include "core/rendering/RenderTextFragment.h" | 67 #include "core/rendering/RenderTextFragment.h" |
| 71 #include "platform/fonts/Font.h" | 68 #include "platform/fonts/Font.h" |
| 72 #include "platform/fonts/GlyphBuffer.h" | 69 #include "platform/fonts/GlyphBuffer.h" |
| 73 #include "platform/fonts/WidthIterator.h" | 70 #include "platform/fonts/WidthIterator.h" |
| 74 #include "platform/text/TextRun.h" | 71 #include "platform/text/TextRun.h" |
| 75 #include "wtf/CurrentTime.h" | 72 #include "wtf/CurrentTime.h" |
| 76 #include "wtf/text/CString.h" | 73 #include "wtf/text/CString.h" |
| 77 #include "wtf/text/StringConcatenate.h" | 74 #include "wtf/text/StringConcatenate.h" |
| 78 | 75 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 result |= PseudoHover; | 111 result |= PseudoHover; |
| 115 else if (pseudoClass == focus) | 112 else if (pseudoClass == focus) |
| 116 result |= PseudoFocus; | 113 result |= PseudoFocus; |
| 117 else if (pseudoClass == visited) | 114 else if (pseudoClass == visited) |
| 118 result |= PseudoVisited; | 115 result |= PseudoVisited; |
| 119 } | 116 } |
| 120 | 117 |
| 121 return result; | 118 return result; |
| 122 } | 119 } |
| 123 | 120 |
| 124 class UpdateRegionLayoutTask { | |
| 125 public: | |
| 126 UpdateRegionLayoutTask(InspectorCSSAgent*); | |
| 127 void scheduleFor(NamedFlow*, int documentNodeId); | |
| 128 void unschedule(NamedFlow*); | |
| 129 void reset(); | |
| 130 void onTimer(Timer<UpdateRegionLayoutTask>*); | |
| 131 | |
| 132 private: | |
| 133 InspectorCSSAgent* m_cssAgent; | |
| 134 Timer<UpdateRegionLayoutTask> m_timer; | |
| 135 HashMap<NamedFlow*, int> m_namedFlows; | |
| 136 }; | |
| 137 | |
| 138 UpdateRegionLayoutTask::UpdateRegionLayoutTask(InspectorCSSAgent* cssAgent) | |
| 139 : m_cssAgent(cssAgent) | |
| 140 , m_timer(this, &UpdateRegionLayoutTask::onTimer) | |
| 141 { | |
| 142 } | |
| 143 | |
| 144 void UpdateRegionLayoutTask::scheduleFor(NamedFlow* namedFlow, int documentNodeI
d) | |
| 145 { | |
| 146 m_namedFlows.add(namedFlow, documentNodeId); | |
| 147 | |
| 148 if (!m_timer.isActive()) | |
| 149 m_timer.startOneShot(0); | |
| 150 } | |
| 151 | |
| 152 void UpdateRegionLayoutTask::unschedule(NamedFlow* namedFlow) | |
| 153 { | |
| 154 m_namedFlows.remove(namedFlow); | |
| 155 } | |
| 156 | |
| 157 void UpdateRegionLayoutTask::reset() | |
| 158 { | |
| 159 m_timer.stop(); | |
| 160 m_namedFlows.clear(); | |
| 161 } | |
| 162 | |
| 163 void UpdateRegionLayoutTask::onTimer(Timer<UpdateRegionLayoutTask>*) | |
| 164 { | |
| 165 // The timer is stopped on m_cssAgent destruction, so this method will never
be called after m_cssAgent has been destroyed. | |
| 166 Vector<std::pair<NamedFlow*, int> > namedFlows; | |
| 167 | |
| 168 for (HashMap<NamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_n
amedFlows.end(); it != end; ++it) | |
| 169 namedFlows.append(std::make_pair(it->key, it->value)); | |
| 170 | |
| 171 for (unsigned i = 0, size = namedFlows.size(); i < size; ++i) { | |
| 172 NamedFlow* namedFlow = namedFlows.at(i).first; | |
| 173 int documentNodeId = namedFlows.at(i).second; | |
| 174 | |
| 175 if (m_namedFlows.contains(namedFlow)) { | |
| 176 m_cssAgent->regionLayoutUpdated(namedFlow, documentNodeId); | |
| 177 m_namedFlows.remove(namedFlow); | |
| 178 } | |
| 179 } | |
| 180 | |
| 181 if (!m_namedFlows.isEmpty() && !m_timer.isActive()) | |
| 182 m_timer.startOneShot(0); | |
| 183 } | |
| 184 | |
| 185 class ChangeRegionOversetTask { | |
| 186 public: | |
| 187 ChangeRegionOversetTask(InspectorCSSAgent*); | |
| 188 void scheduleFor(NamedFlow*, int documentNodeId); | |
| 189 void unschedule(NamedFlow*); | |
| 190 void reset(); | |
| 191 void onTimer(Timer<ChangeRegionOversetTask>*); | |
| 192 | |
| 193 private: | |
| 194 InspectorCSSAgent* m_cssAgent; | |
| 195 Timer<ChangeRegionOversetTask> m_timer; | |
| 196 HashMap<NamedFlow*, int> m_namedFlows; | |
| 197 }; | |
| 198 | |
| 199 ChangeRegionOversetTask::ChangeRegionOversetTask(InspectorCSSAgent* cssAgent) | |
| 200 : m_cssAgent(cssAgent) | |
| 201 , m_timer(this, &ChangeRegionOversetTask::onTimer) | |
| 202 { | |
| 203 } | |
| 204 | |
| 205 void ChangeRegionOversetTask::scheduleFor(NamedFlow* namedFlow, int documentNode
Id) | |
| 206 { | |
| 207 m_namedFlows.add(namedFlow, documentNodeId); | |
| 208 | |
| 209 if (!m_timer.isActive()) | |
| 210 m_timer.startOneShot(0); | |
| 211 } | |
| 212 | |
| 213 void ChangeRegionOversetTask::unschedule(NamedFlow* namedFlow) | |
| 214 { | |
| 215 m_namedFlows.remove(namedFlow); | |
| 216 } | |
| 217 | |
| 218 void ChangeRegionOversetTask::reset() | |
| 219 { | |
| 220 m_timer.stop(); | |
| 221 m_namedFlows.clear(); | |
| 222 } | |
| 223 | |
| 224 void ChangeRegionOversetTask::onTimer(Timer<ChangeRegionOversetTask>*) | |
| 225 { | |
| 226 // The timer is stopped on m_cssAgent destruction, so this method will never
be called after m_cssAgent has been destroyed. | |
| 227 for (HashMap<NamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_n
amedFlows.end(); it != end; ++it) | |
| 228 m_cssAgent->regionOversetChanged(it->key, it->value); | |
| 229 | |
| 230 m_namedFlows.clear(); | |
| 231 } | |
| 232 | |
| 233 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { | 121 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { |
| 234 WTF_MAKE_NONCOPYABLE(StyleSheetAction); | 122 WTF_MAKE_NONCOPYABLE(StyleSheetAction); |
| 235 public: | 123 public: |
| 236 StyleSheetAction(const String& name, InspectorStyleSheet* styleSheet) | 124 StyleSheetAction(const String& name, InspectorStyleSheet* styleSheet) |
| 237 : InspectorHistory::Action(name) | 125 : InspectorHistory::Action(name) |
| 238 , m_styleSheet(styleSheet) | 126 , m_styleSheet(styleSheet) |
| 239 { | 127 { |
| 240 } | 128 } |
| 241 | 129 |
| 242 protected: | 130 protected: |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 m_idToInspectorStyleSheet.clear(); | 436 m_idToInspectorStyleSheet.clear(); |
| 549 m_cssStyleSheetToInspectorStyleSheet.clear(); | 437 m_cssStyleSheetToInspectorStyleSheet.clear(); |
| 550 m_frameToCSSStyleSheets.clear(); | 438 m_frameToCSSStyleSheets.clear(); |
| 551 m_nodeToInspectorStyleSheet.clear(); | 439 m_nodeToInspectorStyleSheet.clear(); |
| 552 m_documentToViaInspectorStyleSheet.clear(); | 440 m_documentToViaInspectorStyleSheet.clear(); |
| 553 resetNonPersistentData(); | 441 resetNonPersistentData(); |
| 554 } | 442 } |
| 555 | 443 |
| 556 void InspectorCSSAgent::resetNonPersistentData() | 444 void InspectorCSSAgent::resetNonPersistentData() |
| 557 { | 445 { |
| 558 m_namedFlowCollectionsRequested.clear(); | |
| 559 if (m_updateRegionLayoutTask) | |
| 560 m_updateRegionLayoutTask->reset(); | |
| 561 if (m_changeRegionOversetTask) | |
| 562 m_changeRegionOversetTask->reset(); | |
| 563 resetPseudoStates(); | 446 resetPseudoStates(); |
| 564 } | 447 } |
| 565 | 448 |
| 566 void InspectorCSSAgent::enable(ErrorString*, PassRefPtr<EnableCallback> prpCallb
ack) | 449 void InspectorCSSAgent::enable(ErrorString*, PassRefPtr<EnableCallback> prpCallb
ack) |
| 567 { | 450 { |
| 568 m_state->setBoolean(CSSAgentState::cssAgentEnabled, true); | 451 m_state->setBoolean(CSSAgentState::cssAgentEnabled, true); |
| 569 | 452 |
| 570 Vector<InspectorStyleSheet*> styleSheets; | 453 Vector<InspectorStyleSheet*> styleSheets; |
| 571 collectAllStyleSheets(styleSheets); | 454 collectAllStyleSheets(styleSheets); |
| 572 | 455 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 514 |
| 632 updateActiveStyleSheets(frame, Vector<CSSStyleSheet*>(), ExistingFrontendRef
resh); | 515 updateActiveStyleSheets(frame, Vector<CSSStyleSheet*>(), ExistingFrontendRef
resh); |
| 633 } | 516 } |
| 634 | 517 |
| 635 void InspectorCSSAgent::mediaQueryResultChanged() | 518 void InspectorCSSAgent::mediaQueryResultChanged() |
| 636 { | 519 { |
| 637 if (m_frontend) | 520 if (m_frontend) |
| 638 m_frontend->mediaQueryResultChanged(); | 521 m_frontend->mediaQueryResultChanged(); |
| 639 } | 522 } |
| 640 | 523 |
| 641 void InspectorCSSAgent::didCreateNamedFlow(Document* document, NamedFlow* namedF
low) | |
| 642 { | |
| 643 int documentNodeId = documentNodeWithRequestedFlowsId(document); | |
| 644 if (!documentNodeId) | |
| 645 return; | |
| 646 | |
| 647 ErrorString errorString; | |
| 648 m_frontend->namedFlowCreated(buildObjectForNamedFlow(&errorString, namedFlow
, documentNodeId)); | |
| 649 } | |
| 650 | |
| 651 void InspectorCSSAgent::willRemoveNamedFlow(Document* document, NamedFlow* named
Flow) | |
| 652 { | |
| 653 int documentNodeId = documentNodeWithRequestedFlowsId(document); | |
| 654 if (!documentNodeId) | |
| 655 return; | |
| 656 | |
| 657 if (m_updateRegionLayoutTask) | |
| 658 m_updateRegionLayoutTask->unschedule(namedFlow); | |
| 659 | |
| 660 m_frontend->namedFlowRemoved(documentNodeId, namedFlow->name().string()); | |
| 661 } | |
| 662 | |
| 663 void InspectorCSSAgent::willMutateRules() | 524 void InspectorCSSAgent::willMutateRules() |
| 664 { | 525 { |
| 665 ++m_styleSheetsPendingMutation; | 526 ++m_styleSheetsPendingMutation; |
| 666 } | 527 } |
| 667 | 528 |
| 668 void InspectorCSSAgent::didMutateRules(CSSStyleSheet* styleSheet) | 529 void InspectorCSSAgent::didMutateRules(CSSStyleSheet* styleSheet) |
| 669 { | 530 { |
| 670 --m_styleSheetsPendingMutation; | 531 --m_styleSheetsPendingMutation; |
| 671 ASSERT(m_styleSheetsPendingMutation >= 0); | 532 ASSERT(m_styleSheetsPendingMutation >= 0); |
| 672 | 533 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 687 ASSERT(m_styleDeclarationPendingMutation); | 548 ASSERT(m_styleDeclarationPendingMutation); |
| 688 m_styleDeclarationPendingMutation = false; | 549 m_styleDeclarationPendingMutation = false; |
| 689 if (!styleSheetEditInProgress() && !isInlineStyle) { | 550 if (!styleSheetEditInProgress() && !isInlineStyle) { |
| 690 CSSStyleSheet* parentSheet = style->parentStyleSheet(); | 551 CSSStyleSheet* parentSheet = style->parentStyleSheet(); |
| 691 Document* owner = parentSheet ? parentSheet->ownerDocument() : 0; | 552 Document* owner = parentSheet ? parentSheet->ownerDocument() : 0; |
| 692 if (owner) | 553 if (owner) |
| 693 owner->modifiedStyleSheet(parentSheet, RecalcStyleDeferred, FullStyl
eUpdate); | 554 owner->modifiedStyleSheet(parentSheet, RecalcStyleDeferred, FullStyl
eUpdate); |
| 694 } | 555 } |
| 695 } | 556 } |
| 696 | 557 |
| 697 void InspectorCSSAgent::didUpdateRegionLayout(Document* document, NamedFlow* nam
edFlow) | |
| 698 { | |
| 699 int documentNodeId = documentNodeWithRequestedFlowsId(document); | |
| 700 if (!documentNodeId) | |
| 701 return; | |
| 702 | |
| 703 if (!m_updateRegionLayoutTask) | |
| 704 m_updateRegionLayoutTask = adoptPtr(new UpdateRegionLayoutTask(this)); | |
| 705 m_updateRegionLayoutTask->scheduleFor(namedFlow, documentNodeId); | |
| 706 } | |
| 707 | |
| 708 void InspectorCSSAgent::regionLayoutUpdated(NamedFlow* namedFlow, int documentNo
deId) | |
| 709 { | |
| 710 if (namedFlow->flowState() == NamedFlow::FlowStateNull) | |
| 711 return; | |
| 712 | |
| 713 ErrorString errorString; | |
| 714 RefPtr<NamedFlow> protector(namedFlow); | |
| 715 | |
| 716 m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedF
low, documentNodeId)); | |
| 717 } | |
| 718 | |
| 719 void InspectorCSSAgent::didChangeRegionOverset(Document* document, NamedFlow* na
medFlow) | |
| 720 { | |
| 721 int documentNodeId = documentNodeWithRequestedFlowsId(document); | |
| 722 if (!documentNodeId) | |
| 723 return; | |
| 724 | |
| 725 if (!m_changeRegionOversetTask) | |
| 726 m_changeRegionOversetTask = adoptPtr(new ChangeRegionOversetTask(this)); | |
| 727 m_changeRegionOversetTask->scheduleFor(namedFlow, documentNodeId); | |
| 728 } | |
| 729 | |
| 730 void InspectorCSSAgent::regionOversetChanged(NamedFlow* namedFlow, int documentN
odeId) | |
| 731 { | |
| 732 if (namedFlow->flowState() == NamedFlow::FlowStateNull) | |
| 733 return; | |
| 734 | |
| 735 ErrorString errorString; | |
| 736 RefPtr<NamedFlow> protector(namedFlow); | |
| 737 | |
| 738 m_frontend->regionOversetChanged(buildObjectForNamedFlow(&errorString, named
Flow, documentNodeId)); | |
| 739 } | |
| 740 | |
| 741 void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document) | 558 void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document) |
| 742 { | 559 { |
| 743 if (styleSheetEditInProgress()) | 560 if (styleSheetEditInProgress()) |
| 744 return; | 561 return; |
| 745 updateActiveStyleSheetsForDocument(document, ExistingFrontendRefresh); | 562 updateActiveStyleSheetsForDocument(document, ExistingFrontendRefresh); |
| 746 } | 563 } |
| 747 | 564 |
| 748 void InspectorCSSAgent::updateActiveStyleSheetsForDocument(Document* document, S
tyleSheetsUpdateType styleSheetsUpdateType) | 565 void InspectorCSSAgent::updateActiveStyleSheetsForDocument(Document* document, S
tyleSheetsUpdateType styleSheetsUpdateType) |
| 749 { | 566 { |
| 750 Frame* frame = document->frame(); | 567 Frame* frame = document->frame(); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 if (!needStyleRecalc) | 929 if (!needStyleRecalc) |
| 1113 return; | 930 return; |
| 1114 | 931 |
| 1115 if (forcedPseudoState) | 932 if (forcedPseudoState) |
| 1116 m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState); | 933 m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState); |
| 1117 else | 934 else |
| 1118 m_nodeIdToForcedPseudoState.remove(nodeId); | 935 m_nodeIdToForcedPseudoState.remove(nodeId); |
| 1119 element->ownerDocument()->setNeedsStyleRecalc(SubtreeStyleChange); | 936 element->ownerDocument()->setNeedsStyleRecalc(SubtreeStyleChange); |
| 1120 } | 937 } |
| 1121 | 938 |
| 1122 void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int doc
umentNodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> >& result) | |
| 1123 { | |
| 1124 Document* document = m_domAgent->assertDocument(errorString, documentNodeId)
; | |
| 1125 if (!document) | |
| 1126 return; | |
| 1127 | |
| 1128 m_namedFlowCollectionsRequested.add(documentNodeId); | |
| 1129 | |
| 1130 Vector<RefPtr<NamedFlow> > namedFlowsVector = document->namedFlows()->namedF
lows(); | |
| 1131 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBu
ilder::Array<TypeBuilder::CSS::NamedFlow>::create(); | |
| 1132 | |
| 1133 for (Vector<RefPtr<NamedFlow> >::iterator it = namedFlowsVector.begin(); it
!= namedFlowsVector.end(); ++it) | |
| 1134 namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), docu
mentNodeId)); | |
| 1135 | |
| 1136 result = namedFlows.release(); | |
| 1137 } | |
| 1138 | |
| 1139 PassRefPtr<TypeBuilder::CSS::CSSMedia> InspectorCSSAgent::buildMediaObject(const
MediaList* media, MediaListSource mediaListSource, const String& sourceURL, CSS
StyleSheet* parentStyleSheet) | 939 PassRefPtr<TypeBuilder::CSS::CSSMedia> InspectorCSSAgent::buildMediaObject(const
MediaList* media, MediaListSource mediaListSource, const String& sourceURL, CSS
StyleSheet* parentStyleSheet) |
| 1140 { | 940 { |
| 1141 // Make certain compilers happy by initializing |source| up-front. | 941 // Make certain compilers happy by initializing |source| up-front. |
| 1142 TypeBuilder::CSS::CSSMedia::Source::Enum source = TypeBuilder::CSS::CSSMedia
::Source::InlineSheet; | 942 TypeBuilder::CSS::CSSMedia::Source::Enum source = TypeBuilder::CSS::CSSMedia
::Source::InlineSheet; |
| 1143 switch (mediaListSource) { | 943 switch (mediaListSource) { |
| 1144 case MediaListSourceMediaRule: | 944 case MediaListSourceMediaRule: |
| 1145 source = TypeBuilder::CSS::CSSMedia::Source::MediaRule; | 945 source = TypeBuilder::CSS::CSSMedia::Source::MediaRule; |
| 1146 break; | 946 break; |
| 1147 case MediaListSourceImportRule: | 947 case MediaListSourceImportRule: |
| 1148 source = TypeBuilder::CSS::CSSMedia::Source::ImportRule; | 948 source = TypeBuilder::CSS::CSSMedia::Source::ImportRule; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 *errorString = "No node with given id found"; | 1066 *errorString = "No node with given id found"; |
| 1267 return 0; | 1067 return 0; |
| 1268 } | 1068 } |
| 1269 if (!node->isElementNode()) { | 1069 if (!node->isElementNode()) { |
| 1270 *errorString = "Not an element node"; | 1070 *errorString = "Not an element node"; |
| 1271 return 0; | 1071 return 0; |
| 1272 } | 1072 } |
| 1273 return toElement(node); | 1073 return toElement(node); |
| 1274 } | 1074 } |
| 1275 | 1075 |
| 1276 int InspectorCSSAgent::documentNodeWithRequestedFlowsId(Document* document) | |
| 1277 { | |
| 1278 int documentNodeId = m_domAgent->boundNodeId(document); | |
| 1279 if (!documentNodeId || !m_namedFlowCollectionsRequested.contains(documentNod
eId)) | |
| 1280 return 0; | |
| 1281 | |
| 1282 return documentNodeId; | |
| 1283 } | |
| 1284 | |
| 1285 void InspectorCSSAgent::collectAllStyleSheets(Vector<InspectorStyleSheet*>& resu
lt) | 1076 void InspectorCSSAgent::collectAllStyleSheets(Vector<InspectorStyleSheet*>& resu
lt) |
| 1286 { | 1077 { |
| 1287 Vector<CSSStyleSheet*> cssStyleSheets; | 1078 Vector<CSSStyleSheet*> cssStyleSheets; |
| 1288 Vector<Document*> documents = m_domAgent->documents(); | 1079 Vector<Document*> documents = m_domAgent->documents(); |
| 1289 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) | 1080 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) |
| 1290 collectAllDocumentStyleSheets(*it, cssStyleSheets); | 1081 collectAllDocumentStyleSheets(*it, cssStyleSheets); |
| 1291 for (Vector<CSSStyleSheet*>::iterator it = cssStyleSheets.begin(); it != css
StyleSheets.end(); ++it) | 1082 for (Vector<CSSStyleSheet*>::iterator it = cssStyleSheets.begin(); it != css
StyleSheets.end(); ++it) |
| 1292 result.append(bindStyleSheet(*it)); | 1083 result.append(bindStyleSheet(*it)); |
| 1293 } | 1084 } |
| 1294 | 1085 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 StylePropertySet* attributeStyle = const_cast<StylePropertySet*>(element->pr
esentationAttributeStyle()); | 1289 StylePropertySet* attributeStyle = const_cast<StylePropertySet*>(element->pr
esentationAttributeStyle()); |
| 1499 if (!attributeStyle) | 1290 if (!attributeStyle) |
| 1500 return 0; | 1291 return 0; |
| 1501 | 1292 |
| 1502 MutableStylePropertySet* mutableAttributeStyle = toMutableStylePropertySet(a
ttributeStyle); | 1293 MutableStylePropertySet* mutableAttributeStyle = toMutableStylePropertySet(a
ttributeStyle); |
| 1503 | 1294 |
| 1504 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI
d(), mutableAttributeStyle->ensureCSSStyleDeclaration(), 0); | 1295 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI
d(), mutableAttributeStyle->ensureCSSStyleDeclaration(), 0); |
| 1505 return inspectorStyle->buildObjectForStyle(); | 1296 return inspectorStyle->buildObjectForStyle(); |
| 1506 } | 1297 } |
| 1507 | 1298 |
| 1508 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > InspectorCSSAgent::bui
ldArrayForRegions(ErrorString* errorString, PassRefPtr<NodeList> regionList, int
documentNodeId) | |
| 1509 { | |
| 1510 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > regions = TypeBuilder:
:Array<TypeBuilder::CSS::Region>::create(); | |
| 1511 | |
| 1512 for (unsigned i = 0; i < regionList->length(); ++i) { | |
| 1513 TypeBuilder::CSS::Region::RegionOverset::Enum regionOverset; | |
| 1514 | |
| 1515 switch (toElement(regionList->item(i))->renderRegion()->regionOversetSta
te()) { | |
| 1516 case RegionFit: | |
| 1517 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Fit; | |
| 1518 break; | |
| 1519 case RegionEmpty: | |
| 1520 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Empty; | |
| 1521 break; | |
| 1522 case RegionOverset: | |
| 1523 regionOverset = TypeBuilder::CSS::Region::RegionOverset::Overset; | |
| 1524 break; | |
| 1525 case RegionUndefined: | |
| 1526 continue; | |
| 1527 default: | |
| 1528 ASSERT_NOT_REACHED(); | |
| 1529 continue; | |
| 1530 } | |
| 1531 | |
| 1532 RefPtr<TypeBuilder::CSS::Region> region = TypeBuilder::CSS::Region::crea
te() | |
| 1533 .setRegionOverset(regionOverset) | |
| 1534 // documentNodeId was previously asserted | |
| 1535 .setNodeId(m_domAgent->pushNodeToFrontend(errorString, documentNodeI
d, regionList->item(i))); | |
| 1536 | |
| 1537 regions->addItem(region); | |
| 1538 } | |
| 1539 | |
| 1540 return regions.release(); | |
| 1541 } | |
| 1542 | |
| 1543 PassRefPtr<TypeBuilder::CSS::NamedFlow> InspectorCSSAgent::buildObjectForNamedFl
ow(ErrorString* errorString, NamedFlow* webkitNamedFlow, int documentNodeId) | |
| 1544 { | |
| 1545 RefPtr<NodeList> contentList = webkitNamedFlow->getContent(); | |
| 1546 RefPtr<TypeBuilder::Array<int> > content = TypeBuilder::Array<int>::create()
; | |
| 1547 | |
| 1548 for (unsigned i = 0; i < contentList->length(); ++i) { | |
| 1549 // documentNodeId was previously asserted | |
| 1550 content->addItem(m_domAgent->pushNodeToFrontend(errorString, documentNod
eId, contentList->item(i))); | |
| 1551 } | |
| 1552 | |
| 1553 RefPtr<TypeBuilder::CSS::NamedFlow> namedFlow = TypeBuilder::CSS::NamedFlow:
:create() | |
| 1554 .setDocumentNodeId(documentNodeId) | |
| 1555 .setName(webkitNamedFlow->name().string()) | |
| 1556 .setOverset(webkitNamedFlow->overset()) | |
| 1557 .setContent(content) | |
| 1558 .setRegions(buildArrayForRegions(errorString, webkitNamedFlow->getRegion
s(), documentNodeId)); | |
| 1559 | |
| 1560 return namedFlow.release(); | |
| 1561 } | |
| 1562 | |
| 1563 void InspectorCSSAgent::didRemoveDocument(Document* document) | 1299 void InspectorCSSAgent::didRemoveDocument(Document* document) |
| 1564 { | 1300 { |
| 1565 if (document) | 1301 if (document) |
| 1566 m_documentToViaInspectorStyleSheet.remove(document); | 1302 m_documentToViaInspectorStyleSheet.remove(document); |
| 1567 } | 1303 } |
| 1568 | 1304 |
| 1569 void InspectorCSSAgent::didRemoveDOMNode(Node* node) | 1305 void InspectorCSSAgent::didRemoveDOMNode(Node* node) |
| 1570 { | 1306 { |
| 1571 if (!node) | 1307 if (!node) |
| 1572 return; | 1308 return; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 documentsToChange.add(element->ownerDocument()); | 1358 documentsToChange.add(element->ownerDocument()); |
| 1623 } | 1359 } |
| 1624 | 1360 |
| 1625 m_nodeIdToForcedPseudoState.clear(); | 1361 m_nodeIdToForcedPseudoState.clear(); |
| 1626 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1362 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
| 1627 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); | 1363 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); |
| 1628 } | 1364 } |
| 1629 | 1365 |
| 1630 } // namespace WebCore | 1366 } // namespace WebCore |
| 1631 | 1367 |
| OLD | NEW |