2011-04-15 MORITA Hajime <morrita@google.com>
Reviewed by Dimitri Glazkov.
RenderDetailsMarker should belong to shadow element.
https://bugs.webkit.org/show_bug.cgi?id=58591
* Render tree structure has changed.
* Changed style rule on details-writing-mode.html to avoid to hit shadow CSS leak bug.
* fast/html/details-writing-mode.html:
* platform/chromium/test_expectations.txt:
* platform/mac/fast/html/details-add-summary-1-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-1-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-1-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-1-expected.checksum:
* platform/mac/fast/html/details-add-summary-1-expected.png:
* platform/mac/fast/html/details-add-summary-1-expected.txt:
* platform/mac/fast/html/details-add-summary-10-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-10-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-10-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-10-expected.checksum:
* platform/mac/fast/html/details-add-summary-10-expected.png:
* platform/mac/fast/html/details-add-summary-10-expected.txt:
* platform/mac/fast/html/details-add-summary-2-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-2-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-2-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-2-expected.checksum:
* platform/mac/fast/html/details-add-summary-2-expected.png:
* platform/mac/fast/html/details-add-summary-2-expected.txt:
* platform/mac/fast/html/details-add-summary-3-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-3-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-3-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-3-expected.checksum:
* platform/mac/fast/html/details-add-summary-3-expected.png:
* platform/mac/fast/html/details-add-summary-3-expected.txt:
* platform/mac/fast/html/details-add-summary-4-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-4-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-4-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-4-expected.checksum:
* platform/mac/fast/html/details-add-summary-4-expected.png:
* platform/mac/fast/html/details-add-summary-4-expected.txt:
* platform/mac/fast/html/details-add-summary-5-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-5-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-5-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-5-expected.checksum:
* platform/mac/fast/html/details-add-summary-5-expected.png:
* platform/mac/fast/html/details-add-summary-5-expected.txt:
* platform/mac/fast/html/details-add-summary-6-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-6-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-6-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-6-expected.checksum:
* platform/mac/fast/html/details-add-summary-6-expected.png:
* platform/mac/fast/html/details-add-summary-6-expected.txt:
* platform/mac/fast/html/details-add-summary-7-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-7-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-7-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-7-expected.checksum:
* platform/mac/fast/html/details-add-summary-7-expected.png:
* platform/mac/fast/html/details-add-summary-7-expected.txt:
* platform/mac/fast/html/details-add-summary-8-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-8-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-8-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-8-expected.checksum:
* platform/mac/fast/html/details-add-summary-8-expected.png:
* platform/mac/fast/html/details-add-summary-8-expected.txt:
* platform/mac/fast/html/details-add-summary-9-and-click-expected.checksum:
* platform/mac/fast/html/details-add-summary-9-and-click-expected.png:
* platform/mac/fast/html/details-add-summary-9-and-click-expected.txt:
* platform/mac/fast/html/details-add-summary-9-expected.checksum:
* platform/mac/fast/html/details-add-summary-9-expected.png:
* platform/mac/fast/html/details-add-summary-9-expected.txt:
* platform/mac/fast/html/details-no-summary1-expected.checksum:
* platform/mac/fast/html/details-no-summary1-expected.png:
* platform/mac/fast/html/details-no-summary1-expected.txt:
* platform/mac/fast/html/details-no-summary2-expected.checksum:
* platform/mac/fast/html/details-no-summary2-expected.png:
* platform/mac/fast/html/details-no-summary2-expected.txt:
* platform/mac/fast/html/details-no-summary3-expected.checksum:
* platform/mac/fast/html/details-no-summary3-expected.png:
* platform/mac/fast/html/details-no-summary3-expected.txt:
* platform/mac/fast/html/details-no-summary4-expected.checksum:
* platform/mac/fast/html/details-no-summary4-expected.png:
* platform/mac/fast/html/details-no-summary4-expected.txt:
* platform/mac/fast/html/details-open-javascript-expected.checksum:
* platform/mac/fast/html/details-open-javascript-expected.png:
* platform/mac/fast/html/details-open-javascript-expected.txt:
* platform/mac/fast/html/details-open1-expected.checksum:
* platform/mac/fast/html/details-open1-expected.png:
* platform/mac/fast/html/details-open1-expected.txt:
* platform/mac/fast/html/details-open2-expected.checksum:
* platform/mac/fast/html/details-open2-expected.png:
* platform/mac/fast/html/details-open2-expected.txt:
* platform/mac/fast/html/details-open3-expected.checksum:
* platform/mac/fast/html/details-open3-expected.png:
* platform/mac/fast/html/details-open3-expected.txt:
* platform/mac/fast/html/details-open4-expected.checksum:
* platform/mac/fast/html/details-open4-expected.png:
* platform/mac/fast/html/details-open4-expected.txt:
* platform/mac/fast/html/details-open5-expected.checksum:
* platform/mac/fast/html/details-open5-expected.png:
* platform/mac/fast/html/details-open5-expected.txt:
* platform/mac/fast/html/details-open6-expected.checksum:
* platform/mac/fast/html/details-open6-expected.png:
* platform/mac/fast/html/details-open6-expected.txt:
* platform/mac/fast/html/details-position-expected.checksum:
* platform/mac/fast/html/details-position-expected.png:
* platform/mac/fast/html/details-position-expected.txt:
* platform/mac/fast/html/details-remove-summary-1-and-click-expected.checksum:
* platform/mac/fast/html/details-remove-summary-1-and-click-expected.png:
* platform/mac/fast/html/details-remove-summary-1-and-click-expected.txt:
* platform/mac/fast/html/details-remove-summary-1-expected.checksum:
* platform/mac/fast/html/details-remove-summary-1-expected.png:
* platform/mac/fast/html/details-remove-summary-1-expected.txt:
* platform/mac/fast/html/details-remove-summary-2-and-click-expected.checksum:
* platform/mac/fast/html/details-remove-summary-2-and-click-expected.png:
* platform/mac/fast/html/details-remove-summary-2-and-click-expected.txt:
* platform/mac/fast/html/details-remove-summary-2-expected.checksum:
* platform/mac/fast/html/details-remove-summary-2-expected.png:
* platform/mac/fast/html/details-remove-summary-2-expected.txt:
* platform/mac/fast/html/details-remove-summary-3-and-click-expected.checksum:
* platform/mac/fast/html/details-remove-summary-3-and-click-expected.png:
* platform/mac/fast/html/details-remove-summary-3-and-click-expected.txt:
* platform/mac/fast/html/details-remove-summary-3-expected.checksum:
* platform/mac/fast/html/details-remove-summary-3-expected.png:
* platform/mac/fast/html/details-remove-summary-3-expected.txt:
* platform/mac/fast/html/details-remove-summary-4-and-click-expected.checksum:
* platform/mac/fast/html/details-remove-summary-4-and-click-expected.png:
* platform/mac/fast/html/details-remove-summary-4-and-click-expected.txt:
* platform/mac/fast/html/details-remove-summary-4-expected.checksum:
* platform/mac/fast/html/details-remove-summary-4-expected.png:
* platform/mac/fast/html/details-remove-summary-4-expected.txt:
* platform/mac/fast/html/details-remove-summary-5-and-click-expected.checksum:
* platform/mac/fast/html/details-remove-summary-5-and-click-expected.png:
* platform/mac/fast/html/details-remove-summary-5-and-click-expected.txt:
* platform/mac/fast/html/details-remove-summary-5-expected.checksum:
* platform/mac/fast/html/details-remove-summary-5-expected.png:
* platform/mac/fast/html/details-remove-summary-5-expected.txt:
* platform/mac/fast/html/details-remove-summary-6-and-click-expected.checksum:
* platform/mac/fast/html/details-remove-summary-6-and-click-expected.png:
* platform/mac/fast/html/details-remove-summary-6-and-click-expected.txt:
* platform/mac/fast/html/details-remove-summary-6-expected.checksum:
* platform/mac/fast/html/details-remove-summary-6-expected.png:
* platform/mac/fast/html/details-remove-summary-6-expected.txt:
* platform/mac/fast/html/details-writing-mode-expected.checksum:
* platform/mac/fast/html/details-writing-mode-expected.png:
* platform/mac/fast/html/details-writing-mode-expected.txt:
2011-04-15 MORITA Hajime <morrita@google.com>
Reviewed by Dimitri Glazkov.
RenderDetailsMarker should belong to shadow element.
https://bugs.webkit.org/show_bug.cgi?id=58591
- Introduced DetailsMarkerControl element, which is a shadow element of <summary>, creates RenderDetailsMarker.
- Removed custom layout code from RenderDetails, RenderDetailsMarker, which is now done by usual CSS layout.
Note that marker size is given via style for -webkit-details-marker pseudo class.
- Converted default summary implementation from pure-renderer style to shadow of HTMLDetailsElement.
Now RenderDetails knows nothing about default summary.
- Moved event handling code from HTMLDetailsElement to HTMLSummaryElement because now the marker is always child of
<summary>, and the clickable area is now <summary> itself.
- Note that the rendering result is changed due to the conversion from custom layout code to usual CSS styling.
* Android.mk:
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* css/html.css:
(summary::-webkit-details-marker):
* dom/Element.cpp:
(WebCore::Element::attach):
* dom/Node.cpp:
(WebCore::shouldCreateRendererFor):
* dom/Node.h:
(WebCore::Node::canHaveLightChildRendererWithShadow):
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::findSummaryFor):
(WebCore::HTMLDetailsElement::findMainSummary):
(WebCore::HTMLDetailsElement::refreshMainSummary):
(WebCore::HTMLDetailsElement::createShadowSubtree):
(WebCore::HTMLDetailsElement::childrenChanged):
(WebCore::HTMLDetailsElement::finishParsingChildren):
(WebCore::HTMLDetailsElement::toggleOpen):
* html/HTMLDetailsElement.h:
(WebCore::HTMLDetailsElement::canHaveLightChildRendererWithShadow):
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::create):
(WebCore::HTMLSummaryElement::createShadowSubtree):
(WebCore::HTMLSummaryElement::detailsElement):
(WebCore::HTMLSummaryElement::isMainSummary):
(WebCore::HTMLSummaryElement::defaultEventHandler):
* html/HTMLSummaryElement.h:
(WebCore::HTMLSummaryElement::canHaveLightChildRendererWithShadow):
* html/shadow/DetailsMarkerControl.cpp: Added.
(WebCore::DetailsMarkerControl::DetailsMarkerControl):
(WebCore::DetailsMarkerControl::createRenderer):
(WebCore::DetailsMarkerControl::rendererIsNeeded):
(WebCore::DetailsMarkerControl::shadowPseudoId):
(WebCore::DetailsMarkerControl::summaryElement):
* html/shadow/DetailsMarkerControl.h: Added.
(WebCore::DetailsMarkerControl::create):
* rendering/RenderDetails.cpp:
(WebCore::RenderDetails::RenderDetails):
(WebCore::RenderDetails::styleDidChange):
(WebCore::RenderDetails::moveSummaryToContents):
(WebCore::RenderDetails::checkMainSummary):
(WebCore::RenderDetails::layout):
* rendering/RenderDetails.h:
* rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::RenderDetailsMarker):
(WebCore::RenderDetailsMarker::isOpen):
(WebCore::RenderDetailsMarker::getPath):
(WebCore::RenderDetailsMarker::paint):
(WebCore::RenderDetailsMarker::details):
* rendering/RenderDetailsMarker.h:
git-svn-id: svn://svn.chromium.org/blink/trunk@84039 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/WebCore/Android.mk b/Source/WebCore/Android.mk
index 0aab658..d6a5797 100644
--- a/Source/WebCore/Android.mk
+++ b/Source/WebCore/Android.mk
@@ -358,6 +358,7 @@
html/shadow/MediaControlElements.cpp \
html/shadow/MediaControlRootElement.cpp \
html/shadow/MeterShadowElement.cpp \
+ html/shadow/DetailControlElement.cpp \
html/shadow/ProgressShadowElement.cpp \
html/shadow/SliderThumbElement.cpp \
html/shadow/TextControlInnerElements.cpp \
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index e5973e6..87c804b 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -880,6 +880,7 @@
html/parser/TextViewSourceParser.cpp
html/parser/XSSFilter.cpp
+ html/shadow/DetailsMarkerControl.cpp
html/shadow/MediaControlRootElement.cpp
html/shadow/MeterShadowElement.cpp
html/shadow/ProgressShadowElement.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index e6a33b3..fb80666 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,76 @@
+2011-04-15 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ RenderDetailsMarker should belong to shadow element.
+ https://bugs.webkit.org/show_bug.cgi?id=58591
+
+ - Introduced DetailsMarkerControl element, which is a shadow element of <summary>, creates RenderDetailsMarker.
+ - Removed custom layout code from RenderDetails, RenderDetailsMarker, which is now done by usual CSS layout.
+ Note that marker size is given via style for -webkit-details-marker pseudo class.
+ - Converted default summary implementation from pure-renderer style to shadow of HTMLDetailsElement.
+ Now RenderDetails knows nothing about default summary.
+ - Moved event handling code from HTMLDetailsElement to HTMLSummaryElement because now the marker is always child of
+ <summary>, and the clickable area is now <summary> itself.
+
+ - Note that the rendering result is changed due to the conversion from custom layout code to usual CSS styling.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/html.css:
+ (summary::-webkit-details-marker):
+ * dom/Element.cpp:
+ (WebCore::Element::attach):
+ * dom/Node.cpp:
+ (WebCore::shouldCreateRendererFor):
+ * dom/Node.h:
+ (WebCore::Node::canHaveLightChildRendererWithShadow):
+ * html/HTMLDetailsElement.cpp:
+ (WebCore::HTMLDetailsElement::findSummaryFor):
+ (WebCore::HTMLDetailsElement::findMainSummary):
+ (WebCore::HTMLDetailsElement::refreshMainSummary):
+ (WebCore::HTMLDetailsElement::createShadowSubtree):
+ (WebCore::HTMLDetailsElement::childrenChanged):
+ (WebCore::HTMLDetailsElement::finishParsingChildren):
+ (WebCore::HTMLDetailsElement::toggleOpen):
+ * html/HTMLDetailsElement.h:
+ (WebCore::HTMLDetailsElement::canHaveLightChildRendererWithShadow):
+ * html/HTMLSummaryElement.cpp:
+ (WebCore::HTMLSummaryElement::create):
+ (WebCore::HTMLSummaryElement::createShadowSubtree):
+ (WebCore::HTMLSummaryElement::detailsElement):
+ (WebCore::HTMLSummaryElement::isMainSummary):
+ (WebCore::HTMLSummaryElement::defaultEventHandler):
+ * html/HTMLSummaryElement.h:
+ (WebCore::HTMLSummaryElement::canHaveLightChildRendererWithShadow):
+ * html/shadow/DetailsMarkerControl.cpp: Added.
+ (WebCore::DetailsMarkerControl::DetailsMarkerControl):
+ (WebCore::DetailsMarkerControl::createRenderer):
+ (WebCore::DetailsMarkerControl::rendererIsNeeded):
+ (WebCore::DetailsMarkerControl::shadowPseudoId):
+ (WebCore::DetailsMarkerControl::summaryElement):
+ * html/shadow/DetailsMarkerControl.h: Added.
+ (WebCore::DetailsMarkerControl::create):
+ * rendering/RenderDetails.cpp:
+ (WebCore::RenderDetails::RenderDetails):
+ (WebCore::RenderDetails::styleDidChange):
+ (WebCore::RenderDetails::moveSummaryToContents):
+ (WebCore::RenderDetails::checkMainSummary):
+ (WebCore::RenderDetails::layout):
+ * rendering/RenderDetails.h:
+ * rendering/RenderDetailsMarker.cpp:
+ (WebCore::RenderDetailsMarker::RenderDetailsMarker):
+ (WebCore::RenderDetailsMarker::isOpen):
+ (WebCore::RenderDetailsMarker::getPath):
+ (WebCore::RenderDetailsMarker::paint):
+ (WebCore::RenderDetailsMarker::details):
+ * rendering/RenderDetailsMarker.h:
+
2011-04-15 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 23e6b4d..b0e114c 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -1840,6 +1840,8 @@
Source/WebCore/html/parser/TextViewSourceParser.h \
Source/WebCore/html/parser/XSSFilter.cpp \
Source/WebCore/html/parser/XSSFilter.h \
+ Source/WebCore/html/shadow/DetailsMarkerControl.cpp \
+ Source/WebCore/html/shadow/DetailsMarkerControl.h \
Source/WebCore/html/shadow/MediaControlElements.cpp \
Source/WebCore/html/shadow/MediaControlElements.h \
Source/WebCore/html/shadow/MediaControlRootElement.cpp \
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index e098bc1..0affb4d 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -3165,6 +3165,8 @@
'html/parser/TextViewSourceParser.h',
'html/parser/XSSFilter.cpp',
'html/parser/XSSFilter.h',
+ 'html/shadow/DetailsMarkerControl.cpp',
+ 'html/shadow/DetailsMarkerControl.h',
'html/shadow/MediaControlElements.cpp',
'html/shadow/MediaControlElements.h',
'html/shadow/MediaControlRootElement.cpp',
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index 9a086e3..54fca3f 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -803,6 +803,7 @@
html/parser/TextDocumentParser.cpp \
html/parser/TextViewSourceParser.cpp \
html/parser/XSSFilter.cpp \
+ html/shadow/DetailsMarkerControl.cpp \
html/shadow/MediaControlRootElement.cpp \
html/shadow/MeterShadowElement.cpp \
html/shadow/ProgressShadowElement.cpp \
@@ -1744,6 +1745,7 @@
html/parser/HTMLViewSourceParser.h \
html/parser/XSSFilter.h \
html/shadow/MediaControlElements.h \
+ html/shadow/DetailsMarkerControl.h \
inspector/ConsoleMessage.h \
inspector/DOMNodeHighlighter.h \
inspector/EventsCollector.h \
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index b806488..ddbef9e 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -56605,6 +56605,14 @@
Name="shadow"
>
<File
+ RelativePath="..\html\shadow\DetailsMarkerControl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\shadow\DetailsMarkerControl.h"
+ >
+ </File>
+ <File
RelativePath="..\html\shadow\MediaControlElements.cpp"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 058a296..11ee10b 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3251,6 +3251,8 @@
A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */; };
A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */; };
+ A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */; };
+ A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C9ABF71357A3BF00F5503F /* DetailsMarkerControl.h */; };
A7CA595D0B27BD9E00FA021D /* DragController.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA595B0B27BD9E00FA021D /* DragController.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7CA595E0B27BD9E00FA021D /* DragController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA595C0B27BD9E00FA021D /* DragController.cpp */; };
A7CA59630B27C1F200FA021D /* DragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA59620B27C1F200FA021D /* DragClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9803,6 +9805,8 @@
A7B6E69D0B291A9600D0529F /* DragData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragData.h; sourceTree = "<group>"; };
A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMeterElement.cpp; sourceTree = "<group>"; };
A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLMeterElement.h; sourceTree = "<group>"; };
+ A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetailsMarkerControl.cpp; sourceTree = "<group>"; };
+ A7C9ABF71357A3BF00F5503F /* DetailsMarkerControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailsMarkerControl.h; sourceTree = "<group>"; };
A7CA595B0B27BD9E00FA021D /* DragController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragController.h; sourceTree = "<group>"; };
A7CA595C0B27BD9E00FA021D /* DragController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragController.cpp; sourceTree = "<group>"; };
A7CA59620B27C1F200FA021D /* DragClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragClient.h; sourceTree = "<group>"; };
@@ -13499,6 +13503,8 @@
4150F9ED12B6E0990008C860 /* shadow */ = {
isa = PBXGroup;
children = (
+ A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */,
+ A7C9ABF71357A3BF00F5503F /* DetailsMarkerControl.h */,
417253A81354BBBC00360F2A /* MediaControlElements.cpp */,
417253A91354BBBC00360F2A /* MediaControlElements.h */,
4157AF7F12F1FB0400A8C6F5 /* MediaControlRootElement.cpp */,
@@ -20159,6 +20165,7 @@
1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */,
93309DDF099E64920056E581 /* DeleteFromTextNodeCommand.h in Headers */,
93309DE1099E64920056E581 /* DeleteSelectionCommand.h in Headers */,
+ A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */,
31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */,
31FB1A59120A5D0600DC02A0 /* DeviceMotionController.h in Headers */,
31FB1A5B120A5D0600DC02A0 /* DeviceMotionData.h in Headers */,
@@ -23484,6 +23491,7 @@
1CE83AC30ADAFFD7009354F6 /* DeleteButtonController.cpp in Sources */,
93309DDE099E64920056E581 /* DeleteFromTextNodeCommand.cpp in Sources */,
93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
+ A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */,
31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
31FB1A5A120A5D0600DC02A0 /* DeviceMotionData.cpp in Sources */,
31FB1A5C120A5D0600DC02A0 /* DeviceMotionEvent.cpp in Sources */,
diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css
index 8ef2bce..ecbaef9 100644
--- a/Source/WebCore/css/html.css
+++ b/Source/WebCore/css/html.css
@@ -887,6 +887,13 @@
display: block
}
+summary::-webkit-details-marker {
+ display: inline-block;
+ width: 0.66em;
+ height: 0.66em;
+ margin-right: 0.4em;
+}
+
/* page */
@page {
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index c6383bd..60ae2a0 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -985,13 +985,16 @@
createRendererIfNeeded();
StyleSelectorParentPusher parentPusher(this);
- if (firstChild())
- parentPusher.push();
- ContainerNode::attach();
+
if (Node* shadow = shadowRoot()) {
parentPusher.push();
shadow->attach();
}
+
+ if (firstChild())
+ parentPusher.push();
+ ContainerNode::attach();
+
if (hasRareData()) {
ElementRareData* data = rareData();
if (data->needsFocusAppearanceUpdateSoonAfterAttach()) {
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index 18c9d77..8ac2adc 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -1466,7 +1466,8 @@
if (!parentRenderer->canHaveChildren() && !(node->isShadowRoot() || atShadowBoundary))
return false;
- if (shadowRoot(parentForRenderingAndStyle) && !atShadowBoundary)
+ if (shadowRoot(parentForRenderingAndStyle) && !atShadowBoundary
+ && !parentForRenderingAndStyle->canHaveLightChildRendererWithShadow())
return false;
if (!parentForRenderingAndStyle->childShouldCreateRenderer(node))
diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h
index a8fb3aa..c3b9203 100644
--- a/Source/WebCore/dom/Node.h
+++ b/Source/WebCore/dom/Node.h
@@ -208,6 +208,8 @@
bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
// FIXME: Remove this when all shadow roots are ShadowRoots.
virtual bool isShadowBoundary() const { return false; }
+ virtual bool canHaveLightChildRendererWithShadow() const { return false; }
+
Node* shadowAncestorNode();
Node* shadowTreeRootNode();
bool isInShadowTree();
diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp
index f9c2f6c..c98b66e 100644
--- a/Source/WebCore/html/HTMLDetailsElement.cpp
+++ b/Source/WebCore/html/HTMLDetailsElement.cpp
@@ -21,11 +21,12 @@
#include "config.h"
#include "HTMLDetailsElement.h"
-#include "Frame.h"
#include "HTMLNames.h"
+#include "HTMLSummaryElement.h"
+#include "LocalizedStrings.h"
#include "MouseEvent.h"
-#include "PlatformMouseEvent.h"
#include "RenderDetails.h"
+#include "Text.h"
namespace WebCore {
@@ -49,48 +50,76 @@
return new (arena) RenderDetails(this);
}
-void HTMLDetailsElement::findMainSummary()
+Node* HTMLDetailsElement::findSummaryFor(ContainerNode* container)
{
- m_mainSummary = 0;
+ for (Node* child = container->firstChild(); child; child = child->nextSibling()) {
+ if (child->hasTagName(summaryTag))
+ return child;
+ }
- for (Node* child = firstChild(); child; child = child->nextSibling()) {
- if (child->hasTagName(summaryTag)) {
- m_mainSummary = child;
- break;
- }
+ return 0;
+}
+
+Node* HTMLDetailsElement::findMainSummary()
+{
+ Node* found = findSummaryFor(this);
+ if (found) {
+ removeShadowRoot();
+ return found;
+ }
+
+ createShadowSubtree();
+ found = findSummaryFor(shadowRoot());
+ ASSERT(found);
+ return found;
+}
+
+void HTMLDetailsElement::refreshMainSummary(RefreshRenderer refreshRenderer)
+{
+ Node* oldSummary = m_mainSummary;
+ m_mainSummary = findMainSummary();
+
+ if (oldSummary == m_mainSummary || !attached())
+ return;
+
+ if (oldSummary && oldSummary->parentNodeForRenderingAndStyle()) {
+ oldSummary->detach();
+ oldSummary->attach();
+ }
+
+ if (refreshRenderer == RefreshRendererAllowed) {
+ m_mainSummary->detach();
+ m_mainSummary->attach();
}
}
+void HTMLDetailsElement::createShadowSubtree()
+{
+ if (shadowRoot())
+ return;
+
+ RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document());
+ ExceptionCode ec = 0;
+ defaultSummary->appendChild(Text::create(document(), defaultDetailsSummaryText()), ec);
+ ensureShadowRoot()->appendChild(defaultSummary, ec, true);
+}
+
+
void HTMLDetailsElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- if (!changedByParser) {
- Node* oldSummary = m_mainSummary;
- findMainSummary();
-
- if (oldSummary != m_mainSummary && !m_isOpen && attached()) {
- if (oldSummary && oldSummary->attached())
- oldSummary->detach();
- if (m_mainSummary && childCountDelta < 0 && !m_mainSummary->renderer()) {
- // If childCountDelta is less then zero and the main summary has changed it must be because previous main
- // summary was removed. The new main summary was then inside the unrevealed content and needs to be
- // reattached to create its renderer. If childCountDelta is not less then zero then a new <summary> element
- // has been added and it will be attached without our help.
- m_mainSummary->detach();
- m_mainSummary->attach();
- }
- }
- }
+ // If childCountDelta is less then zero and the main summary has changed it must be because previous main
+ // summary was removed. The new main summary was then inside the unrevealed content and needs to be
+ // reattached to create its renderer. If childCountDelta is not less then zero then a new <summary> element
+ // has been added and it will be attached without our help.
+ if (!changedByParser)
+ refreshMainSummary(childCountDelta < 0 ? RefreshRendererAllowed : RefreshRendererSupressed);
}
void HTMLDetailsElement::finishParsingChildren()
{
HTMLElement::finishParsingChildren();
- findMainSummary();
- if (attached() && m_mainSummary && !m_mainSummary->renderer()) {
- m_mainSummary->detach();
- m_mainSummary->attach();
- }
+ refreshMainSummary(RefreshRendererAllowed);
}
void HTMLDetailsElement::parseMappedAttribute(Attribute* attr)
@@ -111,26 +140,9 @@
return m_isOpen || child == m_mainSummary;
}
-void HTMLDetailsElement::defaultEventHandler(Event* event)
+void HTMLDetailsElement::toggleOpen()
{
- HTMLElement::defaultEventHandler(event);
-
- if (!renderer() || !renderer()->isDetails() || !event->isMouseEvent() || event->type() != eventNames().clickEvent || event->defaultHandled())
- return;
-
- MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
- if (mouseEvent->button() != LeftButton)
- return;
-
- RenderDetails* renderDetails = static_cast<RenderDetails*>(renderer());
-
- float factor = document() && document()->frame() ? document()->frame()->pageZoomFactor() : 1.0f;
- FloatPoint pos = renderDetails->absoluteToLocal(FloatPoint(mouseEvent->pageX() * factor, mouseEvent->pageY() * factor));
-
- if (renderDetails->interactiveArea().contains(pos.x(), pos.y())) {
- setAttribute(openAttr, m_isOpen ? String() : String(""));
- event->setDefaultHandled();
- }
+ setAttribute(openAttr, m_isOpen ? nullAtom : emptyAtom);
}
}
diff --git a/Source/WebCore/html/HTMLDetailsElement.h b/Source/WebCore/html/HTMLDetailsElement.h
index 45a9035..70ae9c6 100644
--- a/Source/WebCore/html/HTMLDetailsElement.h
+++ b/Source/WebCore/html/HTMLDetailsElement.h
@@ -29,19 +29,29 @@
public:
static PassRefPtr<HTMLDetailsElement> create(const QualifiedName& tagName, Document* document);
Node* mainSummary() const { return m_mainSummary; }
+ void toggleOpen();
private:
+ enum RefreshRenderer {
+ RefreshRendererAllowed,
+ RefreshRendererSupressed,
+ };
+
HTMLDetailsElement(const QualifiedName&, Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta);
virtual void finishParsingChildren();
+ virtual bool canHaveLightChildRendererWithShadow() const { return true; }
void parseMappedAttribute(Attribute*);
bool childShouldCreateRenderer(Node*) const;
- void defaultEventHandler(Event*);
- void findMainSummary();
+ Node* findSummaryFor(ContainerNode*);
+ Node* findMainSummary();
+ void refreshMainSummary(RefreshRenderer);
+
+ void createShadowSubtree();
Node* m_mainSummary;
bool m_isOpen;
diff --git a/Source/WebCore/html/HTMLSummaryElement.cpp b/Source/WebCore/html/HTMLSummaryElement.cpp
index 9c2222a..1a1fefc 100644
--- a/Source/WebCore/html/HTMLSummaryElement.cpp
+++ b/Source/WebCore/html/HTMLSummaryElement.cpp
@@ -21,8 +21,11 @@
#include "config.h"
#include "HTMLSummaryElement.h"
+#include "DetailsMarkerControl.h"
#include "HTMLDetailsElement.h"
#include "HTMLNames.h"
+#include "MouseEvent.h"
+#include "PlatformMouseEvent.h"
#include "RenderSummary.h"
namespace WebCore {
@@ -31,7 +34,9 @@
PassRefPtr<HTMLSummaryElement> HTMLSummaryElement::create(const QualifiedName& tagName, Document* document)
{
- return adoptRef(new HTMLSummaryElement(tagName, document));
+ RefPtr<HTMLSummaryElement> result = adoptRef(new HTMLSummaryElement(tagName, document));
+ result->createShadowSubtree();
+ return result;
}
HTMLSummaryElement::HTMLSummaryElement(const QualifiedName& tagName, Document* document)
@@ -45,4 +50,40 @@
return new (arena) RenderSummary(this);
}
+void HTMLSummaryElement::createShadowSubtree()
+{
+ ExceptionCode ec = 0;
+ ensureShadowRoot()->appendChild(DetailsMarkerControl::create(document()), ec, true);
+}
+
+HTMLDetailsElement* HTMLSummaryElement::detailsElement() const
+{
+ Element* mayDetails = toElement(parentNodeForRenderingAndStyle());
+ if (!mayDetails || !mayDetails->hasTagName(detailsTag))
+ return 0;
+ return static_cast<HTMLDetailsElement*>(mayDetails);
+}
+
+bool HTMLSummaryElement::isMainSummary() const
+{
+ if (HTMLDetailsElement* details = detailsElement())
+ return details->mainSummary() == this;
+ return 0;
+}
+
+void HTMLSummaryElement::defaultEventHandler(Event* event)
+{
+ HTMLElement::defaultEventHandler(event);
+ if (!isMainSummary() || !renderer() || !renderer()->isSummary() || !event->isMouseEvent() || event->type() != eventNames().clickEvent || event->defaultHandled())
+ return;
+
+ MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
+ if (mouseEvent->button() != LeftButton)
+ return;
+
+ if (HTMLDetailsElement* details = detailsElement())
+ details->toggleOpen();
+ event->setDefaultHandled();
+}
+
}
diff --git a/Source/WebCore/html/HTMLSummaryElement.h b/Source/WebCore/html/HTMLSummaryElement.h
index 1a93ee9..7e3766a 100644
--- a/Source/WebCore/html/HTMLSummaryElement.h
+++ b/Source/WebCore/html/HTMLSummaryElement.h
@@ -25,14 +25,22 @@
namespace WebCore {
+class HTMLDetailsElement;
+
class HTMLSummaryElement : public HTMLElement {
public:
static PassRefPtr<HTMLSummaryElement> create(const QualifiedName&, Document*);
+ bool isMainSummary() const;
private:
HTMLSummaryElement(const QualifiedName&, Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void defaultEventHandler(Event*);
+ virtual void createShadowSubtree();
+ virtual bool canHaveLightChildRendererWithShadow() const { return true; }
+
+ HTMLDetailsElement* detailsElement() const;
};
}
diff --git a/Source/WebCore/html/shadow/DetailsMarkerControl.cpp b/Source/WebCore/html/shadow/DetailsMarkerControl.cpp
new file mode 100644
index 0000000..e8c6d6e
--- /dev/null
+++ b/Source/WebCore/html/shadow/DetailsMarkerControl.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2011 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "DetailsMarkerControl.h"
+
+#include "HTMLNames.h"
+#include "HTMLSummaryElement.h"
+#include "RenderDetailsMarker.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+DetailsMarkerControl::DetailsMarkerControl(Document* document)
+ : HTMLDivElement(divTag, document)
+{
+}
+
+RenderObject* DetailsMarkerControl::createRenderer(RenderArena* arena, RenderStyle*)
+{
+ return new (arena) RenderDetailsMarker(this);
+}
+
+bool DetailsMarkerControl::rendererIsNeeded(RenderStyle* style)
+{
+ return summaryElement()->isMainSummary() && HTMLDivElement::rendererIsNeeded(style);
+}
+
+const AtomicString& DetailsMarkerControl::shadowPseudoId() const
+{
+ DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-details-marker"));
+ return pseudId;
+}
+
+HTMLSummaryElement* DetailsMarkerControl::summaryElement()
+{
+ Node* node = this->shadowAncestorNode();
+ ASSERT(!node || toElement(node)->hasTagName(summaryTag));
+ return static_cast<HTMLSummaryElement*>(node);
+}
+
+}
diff --git a/Source/WebCore/html/shadow/DetailsMarkerControl.h b/Source/WebCore/html/shadow/DetailsMarkerControl.h
new file mode 100644
index 0000000..3c5b09d
--- /dev/null
+++ b/Source/WebCore/html/shadow/DetailsMarkerControl.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+#ifndef DetailsMarkerControl_h
+#define DetailsMarkerControl_h
+
+#include "HTMLDivElement.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class HTMLSummaryElement;
+
+class DetailsMarkerControl : public HTMLDivElement {
+public:
+ DetailsMarkerControl(Document*);
+ static PassRefPtr<DetailsMarkerControl> create(Document*);
+
+private:
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual const AtomicString& shadowPseudoId() const;
+
+ HTMLSummaryElement* summaryElement();
+};
+
+inline PassRefPtr<DetailsMarkerControl> DetailsMarkerControl::create(Document* document)
+{
+ return adoptRef(new DetailsMarkerControl(document));
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/rendering/RenderDetails.cpp b/Source/WebCore/rendering/RenderDetails.cpp
index 660c133..6b5a1b2 100644
--- a/Source/WebCore/rendering/RenderDetails.cpp
+++ b/Source/WebCore/rendering/RenderDetails.cpp
@@ -24,10 +24,6 @@
#include "CSSStyleSelector.h"
#include "HTMLDetailsElement.h"
#include "HTMLNames.h"
-#include "LocalizedStrings.h"
-#include "RenderDetailsMarker.h"
-#include "RenderTextFragment.h"
-#include "RenderView.h"
namespace WebCore {
@@ -37,23 +33,10 @@
: RenderBlock(node)
, m_summaryBlock(0)
, m_contentBlock(0)
- , m_defaultSummaryBlock(0)
- , m_defaultSummaryText(0)
- , m_marker(0)
, m_mainSummary(0)
{
}
-void RenderDetails::destroy()
-{
- if (m_marker) {
- m_marker->destroy();
- m_marker = 0;
- }
-
- RenderBlock::destroy();
-}
-
RenderBlock* RenderDetails::summaryBlock()
{
if (!m_summaryBlock) {
@@ -106,26 +89,9 @@
ASSERT_NOT_REACHED();
}
-void RenderDetails::setMarkerStyle()
-{
- if (m_marker) {
- RefPtr<RenderStyle> markerStyle = RenderStyle::create();
- markerStyle->inheritFrom(style());
- m_marker->setStyle(markerStyle.release());
- }
-}
-
void RenderDetails::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderBlock::styleDidChange(diff, oldStyle);
-
- if (m_defaultSummaryBlock) {
- m_defaultSummaryBlock->setStyle(createSummaryStyle());
- m_defaultSummaryText->setStyle(m_defaultSummaryBlock->style());
- }
-
- setMarkerStyle();
-
// Ensure that if we ended up being inline that we set our replaced flag
// so that we're treated like an inline-block.
setReplaced(isInline());
@@ -144,11 +110,6 @@
return element ? element->renderer() : 0;
}
-void RenderDetails::markerDestroyed()
-{
- m_marker = 0;
-}
-
void RenderDetails::summaryDestroyed(RenderObject* summary)
{
if (summary == m_mainSummary)
@@ -157,14 +118,6 @@
void RenderDetails::moveSummaryToContents()
{
- if (m_defaultSummaryBlock) {
- ASSERT(!m_mainSummary);
- m_defaultSummaryBlock->destroy();
- m_defaultSummaryBlock = 0;
- m_defaultSummaryText = 0;
- return;
- }
-
if (!m_mainSummary)
return;
@@ -173,12 +126,6 @@
m_mainSummary = 0;
}
-PassRefPtr<RenderStyle> RenderDetails::createSummaryStyle()
-{
- RefPtr<HTMLElement> summary(HTMLElement::create(summaryTag, document()));
- return document()->styleSelector()->styleForElement(summary.get(), style(), true);
-}
-
void RenderDetails::replaceMainSummary(RenderObject* newSummary)
{
ASSERT(newSummary);
@@ -191,68 +138,20 @@
m_mainSummary = newSummary;
}
-void RenderDetails::createDefaultSummary()
-{
- if (m_defaultSummaryBlock)
- return;
-
- moveSummaryToContents();
-
- m_defaultSummaryBlock = summaryBlock()->createAnonymousBlock();
- m_defaultSummaryBlock->setStyle(createSummaryStyle());
-
- m_defaultSummaryText = new (renderArena()) RenderTextFragment(document(), defaultDetailsSummaryText().impl());
- m_defaultSummaryText->setStyle(m_defaultSummaryBlock->style());
- m_defaultSummaryBlock->addChild(m_defaultSummaryText);
-
- summaryBlock()->addChild(m_defaultSummaryBlock);
-}
-
void RenderDetails::checkMainSummary()
{
if (!node() || !node()->hasTagName(detailsTag))
return;
Node* mainSummaryNode = static_cast<HTMLDetailsElement*>(node())->mainSummary();
-
- if (!mainSummaryNode || !mainSummaryNode->renderer() || mainSummaryNode->renderer()->isFloatingOrPositioned())
- createDefaultSummary();
- else
+ if (mainSummaryNode && mainSummaryNode->renderer())
replaceMainSummary(mainSummaryNode->renderer());
-
}
void RenderDetails::layout()
{
- ASSERT(needsLayout());
-
checkMainSummary();
- ASSERT(m_summaryBlock);
-
- if (!m_marker) {
- m_marker = new (renderArena()) RenderDetailsMarker(this);
- setMarkerStyle();
- }
- updateMarkerLocation();
-
RenderBlock::layout();
-
- m_interactiveArea = m_summaryBlock->frameRect();
-
- // FIXME: the following code will not be needed once absoluteToLocal get patched to handle flipped blocks writing modes.
- switch (style()->writingMode()) {
- case TopToBottomWritingMode:
- case LeftToRightWritingMode:
- break;
- case RightToLeftWritingMode: {
- m_interactiveArea.setX(width() - m_interactiveArea.x() - m_interactiveArea.width());
- break;
- }
- case BottomToTopWritingMode: {
- m_interactiveArea.setY(height() - m_interactiveArea.y() - m_interactiveArea.height());
- break;
- }
- }
}
bool RenderDetails::isOpen() const
@@ -260,84 +159,4 @@
return node() && node()->isElementNode() ? !static_cast<Element*>(node())->getAttribute(openAttr).isNull() : false;
}
-RenderObject* RenderDetails::getParentOfFirstLineBox(RenderBlock* curr)
-{
- RenderObject* firstChild = curr->firstChild();
- if (!firstChild)
- return 0;
-
- for (RenderObject* currChild = firstChild; currChild; currChild = currChild->nextSibling()) {
- if (currChild == m_marker)
- continue;
-
- if (currChild->isInline() && (!currChild->isRenderInline() || curr->generatesLineBoxesForInlineChild(currChild)))
- return curr;
-
- if (currChild->isFloating() || currChild->isPositioned())
- continue;
-
- if (currChild->isTable() || !currChild->isRenderBlock() || (currChild->isBox() && toRenderBox(currChild)->isWritingModeRoot()))
- break;
-
- if (currChild->isDetails())
- break;
-
- RenderObject* lineBox = getParentOfFirstLineBox(toRenderBlock(currChild));
- if (lineBox)
- return lineBox;
- }
-
- return 0;
-}
-
-RenderObject* RenderDetails::firstNonMarkerChild(RenderObject* parent)
-{
- RenderObject* result = parent->firstChild();
- while (result && result->isDetailsMarker())
- result = result->nextSibling();
- return result;
-}
-
-void RenderDetails::updateMarkerLocation()
-{
- // Sanity check the location of our marker.
- if (m_marker) {
- RenderObject* markerPar = m_marker->parent();
- RenderObject* lineBoxParent = getParentOfFirstLineBox(m_summaryBlock);
- if (!lineBoxParent) {
- // If the marker is currently contained inside an anonymous box,
- // then we are the only item in that anonymous box (since no line box
- // parent was found). It's ok to just leave the marker where it is
- // in this case.
- if (markerPar && markerPar->isAnonymousBlock())
- lineBoxParent = markerPar;
- else
- lineBoxParent = m_summaryBlock;
- }
-
- if (markerPar != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) {
- // Removing and adding the marker can trigger repainting in
- // containers other than ourselves, so we need to disable LayoutState.
- view()->disableLayoutState();
- m_marker->remove();
- if (!lineBoxParent)
- lineBoxParent = m_summaryBlock;
- lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent));
-
- if (m_marker->preferredLogicalWidthsDirty())
- m_marker->computePreferredLogicalWidths();
-
- view()->enableLayoutState();
- }
- }
-}
-
-void RenderDetails::computePreferredLogicalWidths()
-{
- ASSERT(preferredLogicalWidthsDirty());
-
- updateMarkerLocation();
- RenderBlock::computePreferredLogicalWidths();
-}
-
} // namespace WebCore
diff --git a/Source/WebCore/rendering/RenderDetails.h b/Source/WebCore/rendering/RenderDetails.h
index baca282..974c174 100644
--- a/Source/WebCore/rendering/RenderDetails.h
+++ b/Source/WebCore/rendering/RenderDetails.h
@@ -27,24 +27,17 @@
namespace WebCore {
-class RenderDetailsMarker;
-
class RenderDetails : public RenderBlock {
public:
explicit RenderDetails(Node*);
-
bool isOpen() const;
- IntRect interactiveArea() const { return m_interactiveArea; }
- void markerDestroyed();
void summaryDestroyed(RenderObject*);
private:
virtual const char* renderName() const { return "RenderDetails"; }
virtual bool isDetails() const { return true; }
- virtual void destroy();
-
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual void addChild(RenderObject* newChild, RenderObject *beforeChild = 0);
@@ -55,33 +48,18 @@
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
virtual void layout();
- virtual void computePreferredLogicalWidths();
- void createDefaultSummary();
void replaceMainSummary(RenderObject*);
void moveSummaryToContents();
void checkMainSummary();
RenderObject* getRenderPosition(RenderObject*);
- PassRefPtr<RenderStyle> createSummaryStyle();
- void setMarkerStyle();
RenderBlock* summaryBlock();
RenderBlock* contentBlock();
- RenderObject* getParentOfFirstLineBox(RenderBlock* curr);
- RenderObject* firstNonMarkerChild(RenderObject* parent);
- void updateMarkerLocation();
-
RenderBlock* m_summaryBlock;
RenderBlock* m_contentBlock;
- RenderObject* m_defaultSummaryBlock;
- RenderObject* m_defaultSummaryText;
-
- IntRect m_interactiveArea;
-
- RenderDetailsMarker* m_marker;
-
RenderObject* m_mainSummary;
};
diff --git a/Source/WebCore/rendering/RenderDetailsMarker.cpp b/Source/WebCore/rendering/RenderDetailsMarker.cpp
index df7af50..0347e7f 100644
--- a/Source/WebCore/rendering/RenderDetailsMarker.cpp
+++ b/Source/WebCore/rendering/RenderDetailsMarker.cpp
@@ -25,89 +25,21 @@
#include "HTMLNames.h"
#include "PaintInfo.h"
#include "RenderDetails.h"
-#include "RenderSummary.h"
namespace WebCore {
using namespace HTMLNames;
-RenderDetailsMarker::RenderDetailsMarker(RenderDetails* item)
- : RenderBox(item->document())
- , m_details(item)
+RenderDetailsMarker::RenderDetailsMarker(Node* node)
+ : RenderBlock(node)
{
- setInline(true);
- setReplaced(true);
-}
-
-void RenderDetailsMarker::destroy()
-{
- if (m_details)
- m_details->markerDestroyed();
-
- RenderBox::destroy();
-}
-
-int RenderDetailsMarker::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode) const
-{
- return m_details->lineHeight(firstLine, direction, PositionOfInteriorLineBoxes);
-}
-
-int RenderDetailsMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode) const
-{
- return m_details->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
-}
-
-void RenderDetailsMarker::computePreferredLogicalWidths()
-{
- ASSERT(preferredLogicalWidthsDirty());
-
- int ascent = style()->fontMetrics().ascent();
- m_minPreferredLogicalWidth = 2 * ascent / 3;
- m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
-
- style()->setMarginStart(Length(0, Fixed));
- style()->setMarginEnd(Length(ascent - m_minPreferredLogicalWidth + 1, Fixed));
-
- setPreferredLogicalWidthsDirty(false);
-}
-
-void RenderDetailsMarker::layout()
-{
- ASSERT(needsLayout());
-
- setLogicalWidth(minPreferredLogicalWidth());
- setLogicalHeight(style()->fontMetrics().height());
-
- Length startMargin = style()->marginStart();
- Length endMargin = style()->marginEnd();
-
- ASSERT(startMargin.isFixed());
- setMarginStart(startMargin.value());
-
- ASSERT(endMargin.isFixed());
- setMarginEnd(endMargin.value());
-
- setNeedsLayout(false);
-}
-
-IntRect RenderDetailsMarker::getRelativeMarkerRect() const
-{
- IntRect relativeRect;
-
- int bulletWidth = minPreferredLogicalWidth();
- relativeRect = IntRect((logicalWidth() - bulletWidth) / 2, (logicalHeight() - bulletWidth) / 2, bulletWidth, bulletWidth);
-
- if (!style()->isHorizontalWritingMode()) {
- relativeRect = relativeRect.transposedRect();
- relativeRect.setX(width() - relativeRect.x() - relativeRect.width());
- }
-
- return relativeRect;
}
bool RenderDetailsMarker::isOpen() const
{
- return m_details && m_details->isOpen();
+ if (RenderDetails* owner = details())
+ return owner->isOpen();
+ return false;
}
static Path createPath(const FloatPoint* path)
@@ -180,17 +112,18 @@
Path RenderDetailsMarker::getPath(const IntPoint& origin) const
{
- IntRect rect = getRelativeMarkerRect();
Path result = getCanonicalPath();
- result.transform(AffineTransform().scale(rect.width()));
- result.translate(FloatSize(origin.x() + rect.x(), origin.y() + rect.y()));
+ result.transform(AffineTransform().scale(logicalHeight()));
+ result.translate(FloatSize(origin.x(), origin.y()));
return result;
}
void RenderDetailsMarker::paint(PaintInfo& paintInfo, int tx, int ty)
{
- if (paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
+ if (paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE) {
+ RenderBlock::paint(paintInfo, tx, ty);
return;
+ }
IntPoint boxOrigin(tx + x(), ty + y());
IntRect overflowRect(visualOverflowRect());
@@ -209,4 +142,14 @@
paintInfo.context->fillPath(getPath(boxOrigin));
}
+RenderDetails* RenderDetailsMarker::details() const
+{
+ for (RenderObject* renderer = parent(); renderer; renderer = renderer->parent()) {
+ if (renderer->isDetails())
+ return toRenderDetails(renderer);
+ }
+
+ return 0;
+}
+
}
diff --git a/Source/WebCore/rendering/RenderDetailsMarker.h b/Source/WebCore/rendering/RenderDetailsMarker.h
index de8f60b..f53a0c3 100644
--- a/Source/WebCore/rendering/RenderDetailsMarker.h
+++ b/Source/WebCore/rendering/RenderDetailsMarker.h
@@ -21,38 +21,29 @@
#ifndef RenderDetailsMarker_h
#define RenderDetailsMarker_h
-#include "RenderBox.h"
+#include "RenderBlock.h"
namespace WebCore {
class RenderDetails;
-class RenderDetailsMarker : public RenderBox {
+class RenderDetailsMarker : public RenderBlock {
public:
- RenderDetailsMarker(RenderDetails*);
+ RenderDetailsMarker(Node*);
enum Orientation { Up, Down, Left, Right };
Orientation orientation() const;
- virtual void computePreferredLogicalWidths();
- virtual void destroy();
-
private:
virtual const char* renderName() const { return "RenderDetailsMarker"; }
virtual bool isDetailsMarker() const { return true; }
virtual void paint(PaintInfo&, int tx, int ty);
- virtual void layout();
- virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
- virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
-
- IntRect getRelativeMarkerRect() const;
bool isOpen() const;
Path getCanonicalPath() const;
Path getPath(const IntPoint& origin) const;
-
- RenderDetails* m_details;
+ RenderDetails* details() const;
};
inline RenderDetailsMarker* toRenderDetailsMarker(RenderObject* object)