RenderDetailsMarker should draw the triangle inside the content box
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 00:57:30 +0000 (00:57 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 00:57:30 +0000 (00:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84557

Reviewed by Hajime Morita.

Source/WebCore:

RenderDetailsMarker didn't support cases in which a marker has
borders and/or padings, or non-square size.

Test: fast/html/details-marker-style.html

* rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::getPath):
Scale by contentWidth() and contentHeight().
(WebCore::RenderDetailsMarker::paint):
Move the trianle origin by the ammount of left/top borders and paddings.

LayoutTests:

* fast/html/details-marker-style.html: Added.
* platform/mac-snowleopard/fast/html/details-marker-style-expected.png: Added.
* platform/mac-snowleopard/fast/html/details-marker-style-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114973 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/html/details-marker-style.html [new file with mode: 0644]
LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.png [new file with mode: 0644]
LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderDetailsMarker.cpp

index f776e9a..2147c23 100644 (file)
@@ -1,3 +1,14 @@
+2012-04-23  Kent Tamura  <tkent@chromium.org>
+
+        RenderDetailsMarker should draw the triangle inside the content box
+        https://bugs.webkit.org/show_bug.cgi?id=84557
+
+        Reviewed by Hajime Morita.
+
+        * fast/html/details-marker-style.html: Added.
+        * platform/mac-snowleopard/fast/html/details-marker-style-expected.png: Added.
+        * platform/mac-snowleopard/fast/html/details-marker-style-expected.txt: Added.
+
 2012-04-23  Filip Pizlo  <fpizlo@apple.com>
 
         DFG OSR exit should ensure that all variables have been initialized
diff --git a/LayoutTests/fast/html/details-marker-style.html b/LayoutTests/fast/html/details-marker-style.html
new file mode 100644 (file)
index 0000000..300f686
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<body>
+<style>
+summary.withpadding::-webkit-details-marker {
+    padding: 8px 16px 24px 32px;
+    border-width: 8px 16px 24px 32px;
+    border-style: solid;
+    border-color: lime;
+}
+
+summary.nopadding::-webkit-details-marker {
+    border: 8px solid lime;
+    width: 48px;
+    height: 24px;
+}
+
+details {
+    font-size: 24px;
+}
+</style>
+<div style="-webkit-writing-mode: horizontal-tb;">
+<details><summary class="withpadding">Summary</summary></details>
+</div>
+<div style="-webkit-writing-mode: vertical-rl;">
+<details><summary class="withpadding">Summary</summary></details>
+</div>
+
+<div style="-webkit-writing-mode: horizontal-tb;">
+<details><summary class="nopadding">Summary</summary></details>
+</div>
+<div style="-webkit-writing-mode: vertical-rl;">
+<details><summary class="nopadding">Summary</summary></details>
+</div>
+</body>
+
diff --git a/LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.png b/LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.png
new file mode 100644 (file)
index 0000000..36091a9
Binary files /dev/null and b/LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.png differ
diff --git a/LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.txt b/LayoutTests/platform/mac-snowleopard/fast/html/details-marker-style-expected.txt
new file mode 100644 (file)
index 0000000..dbd1439
--- /dev/null
@@ -0,0 +1,29 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x454
+  RenderBlock {HTML} at (0,0) size 800x454
+    RenderBody {BODY} at (8,8) size 784x438
+      RenderBlock {DIV} at (0,0) size 784x85
+        RenderBlock {DETAILS} at (0,0) size 784x85
+          RenderBlock {SUMMARY} at (0,0) size 784x85
+            RenderDetailsMarker {DIV} at (0,0) size 111x79 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: right
+            RenderText {#text} at (120,57) size 94x28
+              text run at (120,57) width 94: "Summary"
+      RenderBlock {DIV} at (0,85) size 126x173
+        RenderBlock {DETAILS} at (0,0) size 126x173
+          RenderBlock {SUMMARY} at (0,0) size 126x173
+            RenderDetailsMarker {DIV} at (9,0) size 111x79 [border: (8px solid #00FF00) (16px solid #00FF00) (24px solid #00FF00) (32px solid #00FF00)]: down
+            RenderText {#text} at (98,79) size 28x94
+              text run at (98,79) width 94: "Summary"
+      RenderBlock {DIV} at (0,258) size 784x46
+        RenderBlock {DETAILS} at (0,0) size 784x46
+          RenderBlock {SUMMARY} at (0,0) size 784x46
+            RenderDetailsMarker {DIV} at (0,0) size 64x40 [border: (8px solid #00FF00)]: right
+            RenderText {#text} at (73,18) size 94x28
+              text run at (73,18) width 94: "Summary"
+      RenderBlock {DIV} at (0,304) size 79x134
+        RenderBlock {DETAILS} at (0,0) size 79x134
+          RenderBlock {SUMMARY} at (0,0) size 79x134
+            RenderDetailsMarker {DIV} at (9,0) size 64x40 [border: (8px solid #00FF00)]: down
+            RenderText {#text} at (51,40) size 28x94
+              text run at (51,40) width 94: "Summary"
index c39ea50..187dc61 100644 (file)
@@ -1,3 +1,21 @@
+2012-04-23  Kent Tamura  <tkent@chromium.org>
+
+        RenderDetailsMarker should draw the triangle inside the content box
+        https://bugs.webkit.org/show_bug.cgi?id=84557
+
+        Reviewed by Hajime Morita.
+
+        RenderDetailsMarker didn't support cases in which a marker has
+        borders and/or padings, or non-square size.
+
+        Test: fast/html/details-marker-style.html
+
+        * rendering/RenderDetailsMarker.cpp:
+        (WebCore::RenderDetailsMarker::getPath):
+        Scale by contentWidth() and contentHeight().
+        (WebCore::RenderDetailsMarker::paint):
+        Move the trianle origin by the ammount of left/top borders and paddings.
+
 2012-04-23  Kentaro Hara  <haraken@chromium.org>
 
         [V8] Pass Isolate to toV8() (Part6)
index de0b86f..c36cdd5 100644 (file)
@@ -108,7 +108,7 @@ Path RenderDetailsMarker::getCanonicalPath() const
 Path RenderDetailsMarker::getPath(const LayoutPoint& origin) const
 {
     Path result = getCanonicalPath();
-    result.transform(AffineTransform().scale(logicalHeight()));
+    result.transform(AffineTransform().scale(contentWidth(), contentHeight()));
     result.translate(FloatSize(origin.x(), origin.y()));
     return result;
 }
@@ -134,6 +134,7 @@ void RenderDetailsMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOf
     paintInfo.context->setStrokeThickness(1.0f);
     paintInfo.context->setFillColor(color, style()->colorSpace());
 
+    boxOrigin.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
     paintInfo.context->fillPath(getPath(boxOrigin));
 }