Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (171743 => 171744)
--- trunk/Source/WebCore/CMakeLists.txt 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/CMakeLists.txt 2014-07-29 14:51:31 UTC (rev 171744)
@@ -2352,6 +2352,7 @@
rendering/RenderScrollbarPart.cpp
rendering/RenderScrollbarTheme.cpp
rendering/RenderSearchField.cpp
+ rendering/RenderSelectionInfo.cpp
rendering/RenderSlider.cpp
rendering/RenderSnapshottedPlugIn.cpp
rendering/RenderTable.cpp
Modified: trunk/Source/WebCore/ChangeLog (171743 => 171744)
--- trunk/Source/WebCore/ChangeLog 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/ChangeLog 2014-07-29 14:51:31 UTC (rev 171744)
@@ -1,3 +1,41 @@
+2014-07-29 Zalan Bujtas <za...@apple.com>
+
+ Cleanup RenderSelectionInfoBase/RenderSelectionInfo/RenderBlockSelectionInfo.
+ https://bugs.webkit.org/show_bug.cgi?id=135326
+
+ Reviewed by Darin Adler.
+
+ 1. Move implementation to RenderSelectInfo.cpp
+ 2. RenderSelectionInfoBase/RenderSelectionInfo/RenderBlockSelectionInfo take Render* reference.
+ 3. Remove unused functions.
+ 4. Add RenderSelectionInfoBase::repaintRectangle()
+
+ No change in behavior.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/RenderSelectionInfo.cpp: Added.
+ (WebCore::RenderSelectionInfoBase::RenderSelectionInfoBase):
+ (WebCore::RenderSelectionInfoBase::repaintRectangle):
+ (WebCore::RenderSelectionInfo::RenderSelectionInfo):
+ (WebCore::RenderSelectionInfo::repaint):
+ (WebCore::RenderBlockSelectionInfo::RenderBlockSelectionInfo):
+ (WebCore::RenderBlockSelectionInfo::repaint):
+ * rendering/RenderSelectionInfo.h:
+ (WebCore::RenderSelectionInfo::collectedSelectionRects):
+ (WebCore::RenderSelectionInfoBase::RenderSelectionInfoBase): Deleted.
+ (WebCore::RenderSelectionInfoBase::object): Deleted.
+ (WebCore::RenderSelectionInfo::RenderSelectionInfo): Deleted.
+ (WebCore::RenderSelectionInfo::repaint): Deleted.
+ (WebCore::RenderSelectionInfo::rects): Deleted.
+ (WebCore::RenderBlockSelectionInfo::RenderBlockSelectionInfo): Deleted.
+ (WebCore::RenderBlockSelectionInfo::repaint): Deleted.
+ (WebCore::RenderBlockSelectionInfo::block): Deleted.
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::subtreeSelectionBounds):
+ (WebCore::RenderView::repaintSubtreeSelection):
+ (WebCore::RenderView::clearSubtreeSelection):
+ (WebCore::RenderView::applySubtreeSelection):
+
2014-07-28 Pratik Solanki <psola...@apple.com>
Get SharedBuffer.h out of ResourceBuffer.h (and a few other places)
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (171743 => 171744)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-07-29 14:51:31 UTC (rev 171744)
@@ -10862,6 +10862,20 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="..\rendering\RenderSelectionInfo.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="..\rendering\RenderSlider.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (171743 => 171744)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-07-29 14:51:31 UTC (rev 171744)
@@ -2598,6 +2598,9 @@
<ClCompile Include="..\rendering\RenderSearchField.cpp">
<Filter>rendering</Filter>
</ClCompile>
+ <ClCompile Include="..\rendering\RenderSelectionInfo.cpp">
+ <Filter>rendering</Filter>
+ </ClCompile>
<ClCompile Include="..\rendering\RenderSlider.cpp">
<Filter>rendering</Filter>
</ClCompile>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (171743 => 171744)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-07-29 14:51:31 UTC (rev 171744)
@@ -2066,6 +2066,7 @@
589556ED18D4A44000764B03 /* BorderEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 589556EC18D4A44000764B03 /* BorderEdge.h */; };
58AEE2F418D4BCCF0022E7FE /* BorderEdge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */; };
58CD35CB18EB4C3900B9F3AC /* FloatSizeHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */; };
+ 58DEED8619873FF000888FF3 /* RenderSelectionInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 58DEED8519873FF000888FF3 /* RenderSelectionInfo.cpp */; };
5905ADBF1302F3CE00F116DF /* XMLTreeViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */; };
5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */; };
590E1B4911E4EF4B0069F784 /* DeviceOrientationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9184,6 +9185,7 @@
589556EC18D4A44000764B03 /* BorderEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BorderEdge.h; sourceTree = "<group>"; };
58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BorderEdge.cpp; sourceTree = "<group>"; };
58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatSizeHash.h; sourceTree = "<group>"; };
+ 58DEED8519873FF000888FF3 /* RenderSelectionInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSelectionInfo.cpp; sourceTree = "<group>"; };
5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTreeViewer.cpp; sourceTree = "<group>"; };
5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = "<group>"; };
590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationData.h; sourceTree = "<group>"; };
@@ -22432,6 +22434,7 @@
BC3BE9980E9C1E5D00835588 /* RenderScrollbarTheme.h */,
458FE4071589DF0B005609E6 /* RenderSearchField.cpp */,
458FE4081589DF0B005609E6 /* RenderSearchField.h */,
+ 58DEED8519873FF000888FF3 /* RenderSelectionInfo.cpp */,
0F11A54E0F39233100C37884 /* RenderSelectionInfo.h */,
AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */,
AB247A6B0AFD6383003FA5FD /* RenderSlider.h */,
@@ -27555,6 +27558,7 @@
85DF812A0AA7787200486AD7 /* DOMHTMLImageElement.mm in Sources */,
85F32AED0AA63B8700FF3184 /* DOMHTMLInputElement.mm in Sources */,
A6148A6812E41D940044A784 /* DOMHTMLKeygenElement.mm in Sources */,
+ 58DEED8619873FF000888FF3 /* RenderSelectionInfo.cpp in Sources */,
85BA4CE20AA6861B0088052D /* DOMHTMLLabelElement.mm in Sources */,
85BA4CE40AA6861B0088052D /* DOMHTMLLegendElement.mm in Sources */,
85BA4D120AA688680088052D /* DOMHTMLLIElement.mm in Sources */,
Added: trunk/Source/WebCore/rendering/RenderSelectionInfo.cpp (0 => 171744)
--- trunk/Source/WebCore/rendering/RenderSelectionInfo.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/RenderSelectionInfo.cpp 2014-07-29 14:51:31 UTC (rev 171744)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RenderSelectionInfo.h"
+
+#include "RenderText.h"
+
+namespace WebCore {
+
+RenderSelectionInfoBase::RenderSelectionInfoBase(RenderObject& renderer)
+ : m_renderer(renderer)
+ , m_repaintContainer(renderer.containerForRepaint())
+ , m_state(renderer.selectionState())
+{
+}
+
+void RenderSelectionInfoBase::repaintRectangle(const LayoutRect& repaintRect)
+{
+ m_renderer.repaintUsingContainer(m_repaintContainer, enclosingIntRect(repaintRect));
+}
+
+RenderSelectionInfo::RenderSelectionInfo(RenderObject& renderer, bool clipToVisibleContent)
+ : RenderSelectionInfoBase(renderer)
+{
+ if (renderer.canUpdateSelectionOnRootLineBoxes()) {
+ if (renderer.isText())
+ m_rect = toRenderText(renderer).collectSelectionRectsForLineBoxes(m_repaintContainer, clipToVisibleContent, m_collectedSelectionRects);
+ else
+ m_rect = renderer.selectionRectForRepaint(m_repaintContainer, clipToVisibleContent);
+ }
+}
+
+void RenderSelectionInfo::repaint()
+{
+ repaintRectangle(m_rect);
+}
+
+RenderBlockSelectionInfo::RenderBlockSelectionInfo(RenderBlock& renderer)
+ : RenderSelectionInfoBase(renderer)
+ , m_rects(renderer.canUpdateSelectionOnRootLineBoxes() ? renderer.selectionGapRectsForRepaint(m_repaintContainer) : GapRects())
+{
+}
+
+void RenderBlockSelectionInfo::repaint()
+{
+ repaintRectangle(m_rects);
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderSelectionInfo.h (171743 => 171744)
--- trunk/Source/WebCore/rendering/RenderSelectionInfo.h 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/rendering/RenderSelectionInfo.h 2014-07-29 14:51:31 UTC (rev 171744)
@@ -26,64 +26,39 @@
#define RenderSelectionInfo_h
#include "GapRects.h"
-#include "IntRect.h"
#include "RenderBlock.h"
-#include "RenderText.h"
+#include "RenderObject.h"
namespace WebCore {
class RenderSelectionInfoBase {
WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED;
public:
- RenderSelectionInfoBase()
- : m_object(0)
- , m_repaintContainer(0)
- , m_state(RenderObject::SelectionNone)
- {
- }
-
- explicit RenderSelectionInfoBase(RenderObject* o)
- : m_object(o)
- , m_repaintContainer(o->containerForRepaint())
- , m_state(o->selectionState())
- {
- }
-
- RenderObject* object() const { return m_object; }
+ explicit RenderSelectionInfoBase(RenderObject& renderer);
RenderLayerModelObject* repaintContainer() const { return m_repaintContainer; }
RenderObject::SelectionState state() const { return m_state; }
protected:
- RenderObject* m_object;
+ void repaintRectangle(const LayoutRect& repaintRect);
+
+ RenderObject& m_renderer;
RenderLayerModelObject* m_repaintContainer;
+
+private:
RenderObject::SelectionState m_state;
};
// This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
class RenderSelectionInfo : public RenderSelectionInfoBase {
public:
- RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent)
- : RenderSelectionInfoBase(o)
- {
- ASSERT(o);
- if (o->canUpdateSelectionOnRootLineBoxes()) {
- if (o->isText())
- m_rect = toRenderText(*o).collectSelectionRectsForLineBoxes(m_repaintContainer, clipToVisibleContent, m_rects);
- else
- m_rect = o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent);
- }
- }
-
- void repaint()
- {
- m_object->repaintUsingContainer(m_repaintContainer, enclosingIntRect(m_rect));
- }
+ RenderSelectionInfo(RenderObject& renderer, bool clipToVisibleContent);
- const Vector<LayoutRect>& rects() const { return m_rects; }
+ void repaint();
+ const Vector<LayoutRect>& collectedSelectionRects() const { return m_collectedSelectionRects; }
LayoutRect rect() const { return m_rect; }
private:
- Vector<LayoutRect> m_rects;
+ Vector<LayoutRect> m_collectedSelectionRects; // relative to repaint container
LayoutRect m_rect; // relative to repaint container
};
@@ -91,18 +66,9 @@
// This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock.
class RenderBlockSelectionInfo : public RenderSelectionInfoBase {
public:
- explicit RenderBlockSelectionInfo(RenderBlock* b)
- : RenderSelectionInfoBase(b)
- , m_rects(b->canUpdateSelectionOnRootLineBoxes() ? block()->selectionGapRectsForRepaint(m_repaintContainer) : GapRects())
- {
- }
+ explicit RenderBlockSelectionInfo(RenderBlock& renderer);
- void repaint()
- {
- m_object->repaintUsingContainer(m_repaintContainer, enclosingIntRect(m_rects));
- }
-
- RenderBlock* block() const { return toRenderBlock(m_object); }
+ void repaint();
GapRects rects() const { return m_rects; }
private:
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (171743 => 171744)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2014-07-29 14:51:31 UTC (rev 171744)
@@ -753,13 +753,13 @@
while (os && os != stop) {
if ((os->canBeSelectionLeaf() || os == root.selectionStart() || os == root.selectionEnd()) && os->selectionState() != SelectionNone) {
// Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
- selectedObjects.set(os, std::make_unique<RenderSelectionInfo>(os, clipToVisibleContent));
+ selectedObjects.set(os, std::make_unique<RenderSelectionInfo>(*os, clipToVisibleContent));
RenderBlock* cb = os->containingBlock();
while (cb && !cb->isRenderView()) {
std::unique_ptr<RenderSelectionInfo>& blockInfo = selectedObjects.add(cb, nullptr).iterator->value;
if (blockInfo)
break;
- blockInfo = std::make_unique<RenderSelectionInfo>(cb, clipToVisibleContent);
+ blockInfo = std::make_unique<RenderSelectionInfo>(*cb, clipToVisibleContent);
cb = cb->containingBlock();
}
}
@@ -805,13 +805,13 @@
if (o->selectionState() == SelectionNone)
continue;
- RenderSelectionInfo(o, true).repaint();
+ RenderSelectionInfo(*o, true).repaint();
// Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
for (RenderBlock* block = o->containingBlock(); block && !block->isRenderView(); block = block->containingBlock()) {
if (!processedBlocks.add(block).isNewEntry)
break;
- RenderSelectionInfo(block, true).repaint();
+ RenderSelectionInfo(*block, true).repaint();
}
}
}
@@ -954,14 +954,14 @@
if ((os->canBeSelectionLeaf() || os == root.selectionStart() || os == root.selectionEnd())
&& os->selectionState() != SelectionNone) {
// Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
- oldSelectionData.selectedObjects.set(os, std::make_unique<RenderSelectionInfo>(os, true));
+ oldSelectionData.selectedObjects.set(os, std::make_unique<RenderSelectionInfo>(*os, true));
if (blockRepaintMode == RepaintNewXOROld) {
RenderBlock* cb = os->containingBlock();
while (cb && !cb->isRenderView()) {
std::unique_ptr<RenderBlockSelectionInfo>& blockInfo = oldSelectionData.selectedBlocks.add(cb, nullptr).iterator->value;
if (blockInfo)
break;
- blockInfo = std::make_unique<RenderBlockSelectionInfo>(cb);
+ blockInfo = std::make_unique<RenderBlockSelectionInfo>(*cb);
cb = cb->containingBlock();
}
}
@@ -1008,10 +1008,10 @@
selectionIterator = SelectionIterator(o);
while (o && o != stop) {
if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) {
- std::unique_ptr<RenderSelectionInfo> selectionInfo = std::make_unique<RenderSelectionInfo>(o, true);
+ std::unique_ptr<RenderSelectionInfo> selectionInfo = std::make_unique<RenderSelectionInfo>(*o, true);
#if ENABLE(SERVICE_CONTROLS)
- for (auto& rect : selectionInfo->rects())
+ for (auto& rect : selectionInfo->collectedSelectionRects())
m_selectionRectGatherer.addRect(rect);
#endif
@@ -1022,7 +1022,7 @@
std::unique_ptr<RenderBlockSelectionInfo>& blockInfo = newSelectedBlocks.add(cb, nullptr).iterator->value;
if (blockInfo)
break;
- blockInfo = std::make_unique<RenderBlockSelectionInfo>(cb);
+ blockInfo = std::make_unique<RenderBlockSelectionInfo>(*cb);
cb = cb->containingBlock();
#if ENABLE(SERVICE_CONTROLS)
Modified: trunk/Source/WebCore/rendering/RenderingAllInOne.cpp (171743 => 171744)
--- trunk/Source/WebCore/rendering/RenderingAllInOne.cpp 2014-07-29 14:35:13 UTC (rev 171743)
+++ trunk/Source/WebCore/rendering/RenderingAllInOne.cpp 2014-07-29 14:51:31 UTC (rev 171744)
@@ -96,6 +96,7 @@
#include "RenderScrollbarPart.cpp"
#include "RenderScrollbarTheme.cpp"
#include "RenderSearchField.cpp"
+#include "RenderSelectionInfo.cpp"
#include "RenderSlider.cpp"
#include "RenderSnapshottedPlugIn.cpp"
#include "RenderTable.cpp"