| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/rendering/RenderBlock.h" | 25 #include "core/rendering/RenderBlock.h" |
| 26 | 26 |
| 27 #include "core/dom/Document.h" | 27 #include "core/dom/Document.h" |
| 28 #include "core/dom/Element.h" | 28 #include "core/dom/Element.h" |
| 29 #include "core/dom/StyleEngine.h" | 29 #include "core/dom/StyleEngine.h" |
| 30 #include "core/dom/shadow/ShadowRoot.h" | 30 #include "core/dom/shadow/ShadowRoot.h" |
| 31 #include "core/editing/Editor.h" | 31 #include "core/editing/Editor.h" |
| 32 #include "core/editing/FrameSelection.h" | 32 #include "core/editing/FrameSelection.h" |
| 33 #include "core/events/OverflowEvent.h" | |
| 34 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 33 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
| 35 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
| 36 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
| 37 #include "core/page/Page.h" | 36 #include "core/page/Page.h" |
| 38 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 39 #include "core/rendering/GraphicsContextAnnotator.h" | 38 #include "core/rendering/GraphicsContextAnnotator.h" |
| 40 #include "core/rendering/HitTestLocation.h" | 39 #include "core/rendering/HitTestLocation.h" |
| 41 #include "core/rendering/HitTestResult.h" | 40 #include "core/rendering/HitTestResult.h" |
| 42 #include "core/rendering/InlineIterator.h" | 41 #include "core/rendering/InlineIterator.h" |
| 43 #include "core/rendering/InlineTextBox.h" | 42 #include "core/rendering/InlineTextBox.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 77 |
| 79 static TrackedContainerMap* gPositionedContainerMap = 0; | 78 static TrackedContainerMap* gPositionedContainerMap = 0; |
| 80 static TrackedContainerMap* gPercentHeightContainerMap = 0; | 79 static TrackedContainerMap* gPercentHeightContainerMap = 0; |
| 81 | 80 |
| 82 typedef WTF::HashMap<RenderBlock*, OwnPtr<ListHashSet<RenderInline*> > > Continu
ationOutlineTableMap; | 81 typedef WTF::HashMap<RenderBlock*, OwnPtr<ListHashSet<RenderInline*> > > Continu
ationOutlineTableMap; |
| 83 | 82 |
| 84 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; | 83 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; |
| 85 static int gDelayUpdateScrollInfo = 0; | 84 static int gDelayUpdateScrollInfo = 0; |
| 86 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; | 85 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; |
| 87 | 86 |
| 88 // This class helps dispatching the 'overflow' event on layout change. overflow
can be set on RenderBoxes, yet the existing code | |
| 89 // only works on RenderBlocks. If this changes, this class should be shared with
other RenderBoxes. | |
| 90 class OverflowEventDispatcher { | |
| 91 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); | |
| 92 public: | |
| 93 OverflowEventDispatcher(const RenderBlock* block) | |
| 94 : m_block(block) | |
| 95 , m_hadHorizontalLayoutOverflow(false) | |
| 96 , m_hadVerticalLayoutOverflow(false) | |
| 97 { | |
| 98 m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowC
lip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER)
; | |
| 99 if (m_shouldDispatchEvent) { | |
| 100 m_hadHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow
(); | |
| 101 m_hadVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); | |
| 102 } | |
| 103 } | |
| 104 | |
| 105 ~OverflowEventDispatcher() | |
| 106 { | |
| 107 if (!m_shouldDispatchEvent) | |
| 108 return; | |
| 109 | |
| 110 bool hasHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow(
); | |
| 111 bool hasVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow(); | |
| 112 | |
| 113 bool horizontalLayoutOverflowChanged = hasHorizontalLayoutOverflow != m_
hadHorizontalLayoutOverflow; | |
| 114 bool verticalLayoutOverflowChanged = hasVerticalLayoutOverflow != m_hadV
erticalLayoutOverflow; | |
| 115 | |
| 116 if (!horizontalLayoutOverflowChanged && !verticalLayoutOverflowChanged) | |
| 117 return; | |
| 118 | |
| 119 RefPtrWillBeRawPtr<OverflowEvent> event = OverflowEvent::create(horizont
alLayoutOverflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChan
ged, hasVerticalLayoutOverflow); | |
| 120 event->setTarget(m_block->node()); | |
| 121 m_block->document().enqueueAnimationFrameEvent(event.release()); | |
| 122 } | |
| 123 | |
| 124 private: | |
| 125 const RenderBlock* m_block; | |
| 126 bool m_shouldDispatchEvent; | |
| 127 bool m_hadHorizontalLayoutOverflow; | |
| 128 bool m_hadVerticalLayoutOverflow; | |
| 129 }; | |
| 130 | |
| 131 RenderBlock::RenderBlock(ContainerNode* node) | 87 RenderBlock::RenderBlock(ContainerNode* node) |
| 132 : RenderBox(node) | 88 : RenderBox(node) |
| 133 , m_hasMarginBeforeQuirk(false) | 89 , m_hasMarginBeforeQuirk(false) |
| 134 , m_hasMarginAfterQuirk(false) | 90 , m_hasMarginAfterQuirk(false) |
| 135 , m_beingDestroyed(false) | 91 , m_beingDestroyed(false) |
| 136 , m_hasMarkupTruncation(false) | 92 , m_hasMarkupTruncation(false) |
| 137 , m_hasBorderOrPaddingLogicalWidthChanged(false) | 93 , m_hasBorderOrPaddingLogicalWidthChanged(false) |
| 138 , m_hasOnlySelfCollapsingChildren(false) | 94 , m_hasOnlySelfCollapsingChildren(false) |
| 139 , m_descendantsWithFloatsMarkedForLayout(false) | 95 , m_descendantsWithFloatsMarkedForLayout(false) |
| 140 { | 96 { |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 965 |
| 1010 if (gDelayUpdateScrollInfo) | 966 if (gDelayUpdateScrollInfo) |
| 1011 gDelayedUpdateScrollInfoSet->add(this); | 967 gDelayedUpdateScrollInfoSet->add(this); |
| 1012 else | 968 else |
| 1013 layer()->scrollableArea()->updateAfterLayout(); | 969 layer()->scrollableArea()->updateAfterLayout(); |
| 1014 } | 970 } |
| 1015 } | 971 } |
| 1016 | 972 |
| 1017 void RenderBlock::layout() | 973 void RenderBlock::layout() |
| 1018 { | 974 { |
| 1019 OverflowEventDispatcher dispatcher(this); | |
| 1020 | |
| 1021 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into | 975 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into |
| 1022 // layoutBlock(). | 976 // layoutBlock(). |
| 1023 layoutBlock(false); | 977 layoutBlock(false); |
| 1024 | 978 |
| 1025 // It's safe to check for control clip here, since controls can never be tab
le cells. | 979 // It's safe to check for control clip here, since controls can never be tab
le cells. |
| 1026 // If we have a lightweight clip, there can never be any overflow from child
ren. | 980 // If we have a lightweight clip, there can never be any overflow from child
ren. |
| 1027 if (hasControlClip() && m_overflow) | 981 if (hasControlClip() && m_overflow) |
| 1028 clearLayoutOverflow(); | 982 clearLayoutOverflow(); |
| 1029 | 983 |
| 1030 invalidateBackgroundObscurationStatus(); | 984 invalidateBackgroundObscurationStatus(); |
| (...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3306 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 3260 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 3307 { | 3261 { |
| 3308 showRenderObject(); | 3262 showRenderObject(); |
| 3309 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3263 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 3310 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3264 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 3311 } | 3265 } |
| 3312 | 3266 |
| 3313 #endif | 3267 #endif |
| 3314 | 3268 |
| 3315 } // namespace blink | 3269 } // namespace blink |
| OLD | NEW |