| 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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "core/HTMLNames.h" | 27 #include "core/HTMLNames.h" |
| 28 #include "core/dom/AXObjectCache.h" | 28 #include "core/dom/AXObjectCache.h" |
| 29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
| 30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
| 31 #include "core/dom/StyleEngine.h" | 31 #include "core/dom/StyleEngine.h" |
| 32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
| 33 #include "core/editing/Editor.h" | 33 #include "core/editing/Editor.h" |
| 34 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
| 35 #include "core/editing/htmlediting.h" | 35 #include "core/editing/htmlediting.h" |
| 36 #include "core/events/OverflowEvent.h" | |
| 37 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 36 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
| 38 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
| 39 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 40 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 41 #include "core/html/HTMLMarqueeElement.h" | 40 #include "core/html/HTMLMarqueeElement.h" |
| 42 #include "core/layout/HitTestLocation.h" | 41 #include "core/layout/HitTestLocation.h" |
| 43 #include "core/layout/HitTestResult.h" | 42 #include "core/layout/HitTestResult.h" |
| 44 #include "core/layout/LayoutAnalyzer.h" | 43 #include "core/layout/LayoutAnalyzer.h" |
| 45 #include "core/layout/LayoutDeprecatedFlexibleBox.h" | 44 #include "core/layout/LayoutDeprecatedFlexibleBox.h" |
| 46 #include "core/layout/LayoutFlexibleBox.h" | 45 #include "core/layout/LayoutFlexibleBox.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 static TrackedDescendantsMap* gPositionedDescendantsMap = nullptr; | 90 static TrackedDescendantsMap* gPositionedDescendantsMap = nullptr; |
| 92 static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr; | 91 static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr; |
| 93 | 92 |
| 94 static TrackedContainerMap* gPositionedContainerMap = nullptr; | 93 static TrackedContainerMap* gPositionedContainerMap = nullptr; |
| 95 static TrackedContainerMap* gPercentHeightContainerMap = nullptr; | 94 static TrackedContainerMap* gPercentHeightContainerMap = nullptr; |
| 96 | 95 |
| 97 typedef WTF::HashSet<LayoutBlock*> DelayedUpdateScrollInfoSet; | 96 typedef WTF::HashSet<LayoutBlock*> DelayedUpdateScrollInfoSet; |
| 98 static int gDelayUpdateScrollInfo = 0; | 97 static int gDelayUpdateScrollInfo = 0; |
| 99 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = nullptr; | 98 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = nullptr; |
| 100 | 99 |
| 101 // This class helps dispatching the 'overflow' event on layout change. overflow
can be set on LayoutBoxes, yet the existing code | |
| 102 // only works on LayoutBlocks. If this changes, this class should be shared with
other LayoutBoxes. | |
| 103 class OverflowEventDispatcher { | |
| 104 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); | |
| 105 public: | |
| 106 OverflowEventDispatcher(const LayoutBlock* block) | |
| 107 : m_block(block) | |
| 108 , m_hadHorizontalLayoutOverflow(false) | |
| 109 , m_hadVerticalLayoutOverflow(false) | |
| 110 { | |
| 111 m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowC
lip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER)
; | |
| 112 if (m_shouldDispatchEvent) { | |
| 113 m_hadHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow
(); | |
| 114 m_hadVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); | |
| 115 } | |
| 116 } | |
| 117 | |
| 118 ~OverflowEventDispatcher() | |
| 119 { | |
| 120 if (!m_shouldDispatchEvent) | |
| 121 return; | |
| 122 | |
| 123 bool hasHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow(
); | |
| 124 bool hasVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); | |
| 125 | |
| 126 bool horizontalLayoutOverflowChanged = hasHorizontalLayoutOverflow != m_
hadHorizontalLayoutOverflow; | |
| 127 bool verticalLayoutOverflowChanged = hasVerticalLayoutOverflow != m_hadV
erticalLayoutOverflow; | |
| 128 | |
| 129 if (!horizontalLayoutOverflowChanged && !verticalLayoutOverflowChanged) | |
| 130 return; | |
| 131 | |
| 132 RefPtrWillBeRawPtr<OverflowEvent> event = OverflowEvent::create(horizont
alLayoutOverflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChan
ged, hasVerticalLayoutOverflow); | |
| 133 event->setTarget(m_block->node()); | |
| 134 m_block->document().enqueueAnimationFrameEvent(event.release()); | |
| 135 } | |
| 136 | |
| 137 private: | |
| 138 const LayoutBlock* m_block; | |
| 139 bool m_shouldDispatchEvent; | |
| 140 bool m_hadHorizontalLayoutOverflow; | |
| 141 bool m_hadVerticalLayoutOverflow; | |
| 142 }; | |
| 143 | |
| 144 LayoutBlock::LayoutBlock(ContainerNode* node) | 100 LayoutBlock::LayoutBlock(ContainerNode* node) |
| 145 : LayoutBox(node) | 101 : LayoutBox(node) |
| 146 , m_hasMarginBeforeQuirk(false) | 102 , m_hasMarginBeforeQuirk(false) |
| 147 , m_hasMarginAfterQuirk(false) | 103 , m_hasMarginAfterQuirk(false) |
| 148 , m_beingDestroyed(false) | 104 , m_beingDestroyed(false) |
| 149 , m_hasMarkupTruncation(false) | 105 , m_hasMarkupTruncation(false) |
| 150 , m_widthAvailableToChildrenChanged(false) | 106 , m_widthAvailableToChildrenChanged(false) |
| 151 , m_hasOnlySelfCollapsingChildren(false) | 107 , m_hasOnlySelfCollapsingChildren(false) |
| 152 , m_descendantsWithFloatsMarkedForLayout(false) | 108 , m_descendantsWithFloatsMarkedForLayout(false) |
| 153 { | 109 { |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 if (gDelayUpdateScrollInfo) | 845 if (gDelayUpdateScrollInfo) |
| 890 gDelayedUpdateScrollInfoSet->add(this); | 846 gDelayedUpdateScrollInfoSet->add(this); |
| 891 else | 847 else |
| 892 layer()->scrollableArea()->updateAfterLayout(); | 848 layer()->scrollableArea()->updateAfterLayout(); |
| 893 } | 849 } |
| 894 } | 850 } |
| 895 | 851 |
| 896 void LayoutBlock::layout() | 852 void LayoutBlock::layout() |
| 897 { | 853 { |
| 898 LayoutAnalyzer::Scope analyzer(*this); | 854 LayoutAnalyzer::Scope analyzer(*this); |
| 899 OverflowEventDispatcher dispatcher(this); | |
| 900 | 855 |
| 901 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into | 856 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into |
| 902 // layoutBlock(). | 857 // layoutBlock(). |
| 903 layoutBlock(false); | 858 layoutBlock(false); |
| 904 | 859 |
| 905 // It's safe to check for control clip here, since controls can never be tab
le cells. | 860 // It's safe to check for control clip here, since controls can never be tab
le cells. |
| 906 // If we have a lightweight clip, there can never be any overflow from child
ren. | 861 // If we have a lightweight clip, there can never be any overflow from child
ren. |
| 907 if (hasControlClip() && m_overflow) | 862 if (hasControlClip() && m_overflow) |
| 908 clearLayoutOverflow(); | 863 clearLayoutOverflow(); |
| 909 | 864 |
| (...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2935 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2890 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2936 { | 2891 { |
| 2937 showLayoutObject(); | 2892 showLayoutObject(); |
| 2938 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2893 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2939 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2894 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2940 } | 2895 } |
| 2941 | 2896 |
| 2942 #endif | 2897 #endif |
| 2943 | 2898 |
| 2944 } // namespace blink | 2899 } // namespace blink |
| OLD | NEW |