Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * The default style sheet used to render MathML. | |
| 3 * | |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 4 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 5 * |
| 4 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 6 * are met: | 8 * are met: |
| 7 * | 9 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
| 11 * notice, this list of conditions and the following disclaimer | 13 * notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 14 * in the documentation and/or other materials provided with the |
| 13 * distribution. | 15 * distribution. |
| 14 * 3. Neither the name of Google Inc. nor the names of its contributors | 16 * 3. Neither the name of Google Inc. nor the names of its contributors |
| 15 * may be used to endorse or promote products derived from this | 17 * may be used to endorse or promote products derived from this |
| 16 * software without specific prior written permission. | 18 * software without specific prior written permission. |
| 17 * | 19 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 31 */ |
| 30 | 32 |
| 31 #include "config.h" | 33 @namespace "http://www.w3.org/1998/Math/MathML"; |
| 32 #include "core/dom/custom/CustomElementMicrotaskElementStep.h" | |
| 33 | 34 |
| 34 #include "core/dom/custom/CustomElementCallbackQueue.h" | 35 /* By default, we only display the MathML formulas without any formatting other than the one specified by the display attribute. */ |
| 35 | 36 math { |
| 36 namespace WebCore { | 37 display: inline; |
| 37 | 38 } |
| 38 PassOwnPtr<CustomElementMicrotaskElementStep> CustomElementMicrotaskElementStep: :create(CustomElementCallbackQueue* queue) | 39 math[display="block"] { |
| 39 { | 40 display: block; |
| 40 ASSERT(queue); | 41 text-align: center; |
| 41 return adoptPtr(new CustomElementMicrotaskElementStep(queue)); | |
| 42 } | 42 } |
| 43 | 43 |
| 44 static const CustomElementCallbackQueue::ElementQueueId kMicrotaskQueueId = 0; | 44 /* We only display the second child of a <semantics> element, which is its first annotation. */ |
| 45 | 45 semantics > * { |
|
esprehn
2014/01/15 20:59:59
This is bad, it ends up in the universal rules so
| |
| 46 CustomElementMicrotaskElementStep::CustomElementMicrotaskElementStep(CustomEleme ntCallbackQueue* queue) | 46 display: none; |
| 47 : m_queue(queue) | 47 } |
| 48 { | 48 semantics > *:first-child + annotation, |
| 49 m_queue->setOwner(kMicrotaskQueueId); | 49 semantics > *:first-child + annotation-xml { |
|
esprehn
2014/01/15 20:59:59
This is bad, it means we will invalidate a sibling
| |
| 50 display: inline-block; | |
| 50 } | 51 } |
| 51 | 52 |
| 52 CustomElementMicrotaskStep::Result CustomElementMicrotaskElementStep::process() | 53 /* If an alttext attribute is specified, we replace the MathML formula with that text. */ |
| 53 { | 54 math[alttext] * { |
|
esprehn
2014/01/15 20:59:59
Another universal rule, it's going to add a rule t
| |
| 54 return m_queue->processInElementQueue(kMicrotaskQueueId) ? DidWork : Result( 0); | 55 display: none; |
| 55 } | 56 } |
| 56 | 57 math[alttext]::after { |
|
esprehn
2014/01/15 20:59:59
This is another universal rule :(
| |
| 57 } // namespace WebCore | 58 content: attr(alttext); |
| 59 } | |
| OLD | NEW |