Title: [133838] branches/chromium/1312
Revision
133838
Author
kar...@chromium.org
Date
2012-11-07 19:23:01 -0800 (Wed, 07 Nov 2012)

Log Message

Merge 133124 - [Refactoring] Move initial style setting for ProgressValueElement from attach method to createShadowSubtree method in HTMLProgressElement.
https://bugs.webkit.org/show_bug.cgi?id=83664

Reviewed by Hajime Morita.

Source/WebCore:

The original code updates inline style during attach(). However,
the attach would be invoked from Element::recalcStyle()'s reattach().
If updating inline styles during the reattach(), style related flags,
i.e. childNeedsStyleRecalc, and needsStyleRecalc are cleared after the
reattach(). So the inline styles are not updated in next
setNeedsStyleRecalc, because ProgressValueElement has already had
InlineStyleChange (existingChanegType == InlineStyleChange) and
markAncestorsWithChildNeedsStyleRecalc is not invoked.

Test: fast/dom/HTMLProgressElement/progress-bar-set-value.html

* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::attach):
Copied updateFromElement from didElementStateChange. If removing the
update, indeterminate-progress-001.html and progress-element.html
under fast/dom/HTMLProgressElement will fail. We still need attach()
and updateFromElement. To remove the attach(), need more refactoring,
i.e. investigating where attach() is invoked from and modifying all
related codes.
(WebCore::HTMLProgressElement::createShadowSubtree):
Initialize m_value by indeterminate-position. The value is default
value of progress element.

LayoutTests:

* fast/dom/HTMLProgressElement/progress-bar-set-value-expected.html: Added.
* fast/dom/HTMLProgressElement/progress-bar-set-value.html: Added.


TBR=ta...@google.com
Review URL: https://codereview.chromium.org/11275208

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1312/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value-expected.html (from rev 133124, trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value-expected.html) (0 => 133838)


--- branches/chromium/1312/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value-expected.html	                        (rev 0)
+++ branches/chromium/1312/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value-expected.html	2012-11-08 03:23:01 UTC (rev 133838)
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<head>
+<style>
+progress {
+    -webkit-appearance: none;
+    border: solid red;
+}
+</style>
+</head>
+<body>
+  <progress max="100" value="50"></progress>
+</body>
+</html>

Copied: branches/chromium/1312/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value.html (from rev 133124, trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value.html) (0 => 133838)


--- branches/chromium/1312/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value.html	                        (rev 0)
+++ branches/chromium/1312/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-set-value.html	2012-11-08 03:23:01 UTC (rev 133838)
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+<head>
+<style>
+progress {
+    -webkit-appearance: none;
+}
+</style>
+<script type="text/_javascript_">
+function runTest() {
+    bad = document.createElement("progress");
+    bad.id="bad";
+    bad.max=100;
+    bad.setAttribute("value",10);
+    bad.setAttribute("style", "border:solid red");
+    document.getElementsByTagName('body')[0].appendChild(bad);
+    document.body.offsetLeft;
+    document.getElementById('bad').value = 50;
+}
+</script>
+</head>
+<body _onload_="runTest();">
+<!-- [bug 100507] https://bugs.webkit.org/show_bug.cgi?id=100507 -->
+<!-- Progress bar shadow tree sometimes is not relayouted. -->
+</body>
+</html>

Modified: branches/chromium/1312/Source/WebCore/html/HTMLProgressElement.cpp (133837 => 133838)


--- branches/chromium/1312/Source/WebCore/html/HTMLProgressElement.cpp	2012-11-08 03:05:41 UTC (rev 133837)
+++ branches/chromium/1312/Source/WebCore/html/HTMLProgressElement.cpp	2012-11-08 03:23:01 UTC (rev 133838)
@@ -106,7 +106,8 @@
 void HTMLProgressElement::attach()
 {
     LabelableElement::attach();
-    didElementStateChange();
+    if (RenderProgress* render = renderProgress())
+        render->updateFromElement();
 }
 
 double HTMLProgressElement::value() const
@@ -175,6 +176,7 @@
     RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document());
     RefPtr<ProgressValueElement> value = ProgressValueElement::create(document());
     m_value = value.get();
+    m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100);
     bar->appendChild(m_value, ASSERT_NO_EXCEPTION);
 
     inner->appendChild(bar, ASSERT_NO_EXCEPTION);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to